Howdy,
I seem to be having more difficulty than I should surrounding building a custom firmware for a WRT54G. By making use of the references at http://downloads.openwrt.org/docs/build … ation.html, I have downloaded the CVS tree. On different attempts, I have tried to make use of both the experimental and the stable. No, I did not merge the two, I would purge or move the directory for what I had been working on and, when I needed to re-download the source, started fresh.
Now, looking at the documentation, it seems like a very simple and easy process of 'make menuconfig', pick your options, and 'make' to build it all up. In theory it looks good, it picks required libraries, it does the whole process, and takes quite some time to build the toolchain, and then work on the image. However, I get several failures through the process. One such failure is:
for file in c crypt dl m nsl resolv rt uClibc util; do \
cp /root/openwrt/staging_dir_mipsel/lib/lib$file*.so.* /root/openwrt/build_mipsel/base-files/uclibc/lib/; \
done
cp: cannot stat `/root/openwrt/staging_dir_mipsel/lib/libuClibc*.so.*': No such file or directory
Now, I'm not sure if this is a bad thing or not. It seems like it would be, but it doesn't fail here, it just continues on. I had to generate a log of the build to see this particular error. Other errors I've had:
cp /root/openwrt/build_mipsel/nvram/*.so /root/openwrt/staging_dir_mipsel/usr/lib
cp: cannot stat `/root/openwrt/build_mipsel/nvram/*.so': No such file or directory
make[2]: *** [install-dev] Error 1
make[2]: Leaving directory `/root/openwrt/package/nvram'
make[1]: *** [nvram-compile] Error 2
make[1]: Leaving directory `/root/openwrt/package'
make: *** [package/compile] Error 2
This one generates an error and fails, stopping the build. I looked into it, and for some reason, that nvram shared object does not build. In tracing it further, I see that the include file <shutils.h> is not found anywhere. Doing a find on the buildroot, I get the following:
[root@localhost openwrt]# find . -name shutils.h
./target/linux/package/openwrt/include/shutils.h
Well, ok. I can follow this somehow. I go into the Makefile in openwrt/build_mipsel/nvram and change the EXTRA_CFLAGS to this:
EXTRA_CFLAGS := -c -I. -I../include -I/root/openwrt/target/linux/package/openwrt/include
At this point, it will find the header file and build successfully. Unfortunately for my first run, and since I had to build it in that directory by hand, it assumed 'gcc' (not the cross-compiler) was to be used. Adding a line...
CC=mipsel-linux-uclibc-gcc
...found the right compiler, assuming I included the staging_dir_mipsel/bin directory to my path.
The next error kicked off around the iptables package with the following lines:
kernelconfig.mk:1: /root/openwrt/build_mipsel/linux/.config: No such file or directory
make[2]: *** No rule to make target `/root/openwrt/build_mipsel/linux/.config'. Stop.
make[2]: Leaving directory `/root/openwrt/package/iptables'
make[1]: *** [iptables-prepare] Error 2
make[1]: Leaving directory `/root/openwrt/package'
make: *** [package/compile] Error 2
Now, I did some research and found the topic make fails on iptables from around July, '05. Unfortunately, there is no resolution in that post, but I fumbled one up myself. It seems like it's asking for the kernel configuration file (since IPTables is fairly kernel-centric). I hunted for a .config file and got this:
[root@localhost openwrt]# find . -name .config
./.config
./toolchain_build_mipsel/linux-2.4.30/.config
./toolchain_build_mipsel/uClibc-0.9.27/.config
Looks like the one I'm looking for is in the linux-2.4.30 directory, so I make a symbolic link from build_mipsel/linux over to there so that, not only can it find the .config file, but any header files it might need as well. For that problem, that takes care of things.
To my dismay, I wound up having one issue that was wholly related to my environment. Autoconf needed to be version 2.59 in order to build the package for Libnet-1.0.2a. I upgraded and continued my build, only to hit yet another issue surrounding something that didn't build:
cp -a /root/openwrt/build_mipsel/wireless_tools.28/libiw.so* /root/openwrt/staging_dir_mipsel/usr/lib/
cp: cannot stat `/root/openwrt/build_mipsel/wireless_tools.28/libiw.so*': No such file or directory
make[2]: *** [install-dev] Error 1
make[2]: Leaving directory `/root/openwrt/package/wireless-tools'
make[1]: *** [wireless-tools-compile] Error 2
make[1]: Leaving directory `/root/openwrt/package'
make: *** [package/compile] Error 2
Well, go into the build_mipsel/wireless_tools.28/ directory and check things out and find that, first, the Makefile needs to be adjusted. Wants to use the normal CC variable for the compiler, and notes in the Makefile that it needs to be changed for cross-compilation. So, I change it to the following and run a 'make' in that directory:
## Compiler to use (modify this for cross compile)
CC = mipsel-linux-uclibc-gcc
## Other tools you need to modify for cross compile (static lib only)
AR = mipsel-linux-uclibc-ar
RANLIB = mipsel-linux-uclibc-ranlib
Once that's built using the proper compiler, I go back to the openwrt directory, do yet another 'make', and let it run it's pace again. This time, everything seems to be ok, it kicks through all steps that it knows about, does a few things, and then ends out. However, this is where I am stuck at. I do not see an image file. I do not see the options to tell the make file to build the image. In fact, notations such as 'the target root directory is in build_mipsel/root' is inaccurate, since it seems like they're found in build_mipsel/base-files/base-files/. This seems to be the same for both the stable (whiterussian) buildroot and the current experimental (as of 9/27/05).
Other pertinent information:
Build environment: RedHat Linux 9.0
User account: root (this is a test system only, but I figured this would just be easier)
Make version: not sure, whatever is standard
Autoconf version: 2.59 (per upgrade required)
Other software: 99% (save for autoconf) default versions for RedHat 9.0. This is pretty much a clean install of the OS, with very little customization done on it.
Any help with this would be appreciated. I am very interested in getting a custom firmware built, but it seems like I've hit a brick wall. Assistance on the experimental is prefered (it has bind as a package, which I use for nsupdate), but I'll take help on the stable if that's all that is available.
Thanks.