OpenWrt Forum Archive

Topic: buildroot problems / understanding / long and boring :(

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hi guys,

I encounter a few problems during firmware building process I would like to discuss to find a possible solution and to better understand how buildroot works.

The first problem is related to packages and the TARGETS:= variable entries.

Ideally I would like to build a squashfs filesystem containing the following packages: iproute2 pppoecd dropbear libpthread

so I changed the TARGETS:=  variable to:

TARGETS:=host-sed iproute2 pppoecd dropbear libpthread openwrt-code.bin

unfortunately when I issue "make" I get the following errors:

make[1]: Entering directory `/home/esivieri/dev/openwrt/buildroot/build_mipsel/iproute2'
Please, Compile the kernel first
make[1]: *** [check-kernel] Error 1
make[1]: Leaving directory `/home/esivieri/dev/openwrt/buildroot/build_mipsel/iproute2'
make: *** [/home/esivieri/dev/openwrt/buildroot/build_mipsel/iproute2/tc/tc] Error 2

it clearly states that I should compile the kernel first, I agree with that but I'm not compiling a package, I'm compiling the firmware WITH the iproute package.

OK, now let's say I dont want iproute2 anymore but I want to the firmware AND the other selected packages:

New variable:
TARGETS:=host-sed pppoecd dropbear libpthread openwrt-code.bin

and new error message:

make[1]: /home/esivieri/dev/openwrt/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-gcc: Command not found
make[1]: *** [magic.o] Error 127

Here it says it cannot find the cross compiler anymore mipsel-linux-uclibc-gcc

I figured out that a "make clean" also deletes the toolchain and the build_mipsel contents.

So I decided to build the firmware without any extra builtin packages and the change change the buildroot's Makefile "clean"  from:
#clean:
#       rm -rf $(TOOL_BUILD_DIR) $(BUILD_DIR) $(IMAGE)
                $(BASE_DIR)/packages
                openwrt-linux.trx openwrt-g-code.bin   openwrt-gs-code.bin
                openwrt-kmodules.tar.bz2

to:

clean:
        rm -rf  $(IMAGE)
                $(BASE_DIR)/packages
                openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin
                openwrt-kmodules.tar.bz2

to be able to finally make the firmware with the required builtin packages.

I did that, it worked but some of the nvram.overraids and other  modifications I made wasnt reported in the new created images because most of the stuff was already compiled and copied by previews builds.

I'm sure I'm missing something, I'm sure that might be a better way to achieve what I'm trying to do, any of you guys have a suggestion please?

-----------------

Another point isnt clear for me is the module tarball. I need iptables MAC support and I added "mac"  to the PF_EXT_SLIB:= variable in /buildroot/build_mipsel/iptables-1.2.11/extensions/Makefile to be sure to have the MAC library compiled and installed. (WORKED!)
Now I also want to have ipt_mac.o automatically copied in /lib/modules/2.4.20/ but I wasnt able to find any reference to tell the buildroot process to copy it in the right place instead of including it in the modules tarball (openwrt-modules.tar.bz2).

If you guys know how to do it that would be great.

------------------

Another problem I encountered is with dropbear. I included dropbear in the TARGETS:= variable, after I flashed my router I figured out that dropbear wasnt installed, it copied the S51dropbear start script in /etc/init.d but the executrable files wasnt there. I triplechecked all the executables directories without luck. I'm wondering if this problem might be related to the fact that the firmware was actually already compiled a few "make" before (see first problem).

Well, that's all for the moment, I hope I put enought details to be able to get some feedback from you guys, if you need further informations just ask me, I'm also hanging in #wrt54g as nettie.

Thanx again for your time.

Best,

nettie.

At first build it as it is, "then" add the packages which should be contained in the squashfs to targets and build again.

There is no priority-queue in the build-process for targets (afaik) at the moment.

Btw. "make dirclean" should be good at most circumstances.

The rest: Don't know, but you might compile the ipt-module into the kernel or just copy it too the build_mipsel/root directory, not that clean .. but.. smile

antimac

The makefile is designed to be done one pass, first the firmware(with default setting), then modules. Do it in that sequence first without changing anything.

Then you can change the TARGET to include more. However, not all target is coded to put things into the resulting root/ which will be included into the firmware. You have to go through the .mk file and see if they do. Some(espeically the newer one for ipkg in mind) would just compile the stuff without popular the root, you need to add the target and script in the .mk.

You can also hand copy whatever you want to the target root and continue the firmware packaging process which will include everything you put there. You can even change the init scripts and so long you don't delete stuff, it will not be overwritten.

For me, it turned out to be easier to build packages as ipkg's and merge them to the rootfs with ipkg. There is an offline mode provided by ipkg that lets you do that. (option offline_root <path to buildroot>.Then simply use make to build your image. Nevertheless, some packages require special treatment (such as dropbear, where you have to generate a hostkey thus needing a dropbearkey binary for your host-arch).

Thanx a lot for your support guys, now it's definitely more clear. I'll follow all your suggestions and see what I can do smile

Thanx again.

Best,

nettie

The discussion might have continued from here.