[OpenWrt-Devel] [PATCH 2/4] kernel: add backported phy/phylink/sfp patches

Eneas Queiroz cotequeiroz at gmail.com
Wed Nov 27 12:01:30 EST 2019

On Wed, Nov 27, 2019 at 10:28 AM Russell King - ARM Linux admin
<linux at armlinux.org.uk> wrote:
> The build system is just very painful for a new-comer to understand.
> I don't doubt that it does what you need it to, but trying to work
> out stuff from it is a nightmare unless you have some knowledge
> about how it is setup.
> For example, referencing:
>  https://openwrt.org/docs/guide-developer/single.package
> and trying to build just the kernel.  So:
>  $ make tools/install
>  $ make toolchain/install
>  $ make target/linux/install
> fails because there is no opkg host tool present.

I'm no build system expert, so if I say anything too wrong, anyone,
please correct me.  This is just what I do while testing changes.  For
the final test, I do a whole build with 'make dirclean && make' to
avoid any trouble.

I'm assuming you just want to build the kernel modules, not the full
image, right?  If you want a flashable image, then a plain 'make' is
probably the best way to do it.

TLDR: Whenever I need to compile just the kernel, I use 'make
{toolchain,target,package/linux}/compile package/index'.
These steps will not need opkg built or anything else.

make toolchain/compile
- This step should only be needed once, unless you change the
toolchain.  This will perform tools/compile, so that step is not
really necessary.

make target/compile
- This builds the kernel image, including the built-in modules, but
does not make the flashable image--you'll need target/install for

make package/linux/compile
- Builds the module packages.  If you're building a module package,
you won't need to perform make target/install.

make package/index
- Builds the files needed to be able to publish the bin dir to use
with opkg.  I tend to copy the ipk file and install it from there, to
not have to worry about opkg downloading the package from the original

If I need to start from a clean kernel, I use 'make
target/{clean,compile} package/linux/compile'
make target/clean
 - Removes the kernel build directory, (including the files compiled
with "make package/linux/compile", but not the final ipks under bin).
This is useful, so you won't clean and have to rebuild too much.

> Trying to find out how to build opkg is really not easy.  You find
> "host-compile" and "host-install" targets in the makefiles, so you
> assume that if you try make package/system/opkg/host-install, maybe
> it'll install a host built opkg into staging_dir/host/bin - but no,
> that doesn't work.  That seems to be utterly impossible to do.
> That has alone made me develop a great hate for the implementation
> after spending a lot of time trying to figure it out.

'make package/opkg/host/compile' does the trick.



openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list