Before we start the painful process of trying to build an entirely new firmware from source code ourselves, let's make sure we can at least build the Asus firmware using the tools and source they provide.
- Start with the massive GPL zip file you get from Asus. When you unpack it, you'll have a toolchain tarball and a GPL tarball. (Said tarball is temporarily mirrored here )
- Unpack the toolchain tarball into
/opt, so that it becomes/opt/brcm/.... The path is significant -- GCC toolchains must be built specifically to live in a particular filesystem location, and this cross-toolchain is built to live in/opt/brcm. - Unpack the "GPL" "source" tarball wherever you like. It presumes that it will be live in
/root/WL700g, but one of the first things we're going to do is fix that so that it can be built from wherever you want, and doesn't have to be built as root. I put "GPL" and "source" in quotes because a lot of the stuff in that tarball is not source code and is not under the GPL. For example, the real-time-clock chip (as far as I can tell) has two source files, only one of which is present in source form at all (the other is a precompiled binary object file), and that source file is not under GPL anyway. Once you have unpacked the tarball, change all the directories to be writable with something like:find . -type d -exec chmod 775 {} \; - Ensure that you have the program
ashavailable. I installed dash 0.5.3, which I got from here. I've also used ash 0.4.0, but it doesn't build very easily on modern systems. - You also will need a program
rcscleanbecause it is invoked during the build process. This is part of RCS, an ancient version control system that nobody should ever use any more. I worked around the need for this program by creating an empty bash script that just returns 0 (success). - Add the MIPS cross-toolchain binaries to your PATH with:
export PATH=/opt/brcm/hndtools-mipsel-linux/bin:$PATH - Change directory to the
nasoc/src/appsdirectory. There is aREADME_ASUSthere that reveals that the process to build the firmware image ismake rebuild && make image-WL700gE - Some files have the build directory path
/root/WL700ghard-coded, which is absurd. Fix this in all of the*.pcfiles. If you've unpacked the bundle into$HOME/srcyou can do this with:for file in $(find . -name "*.pc"); do cp $file{,.orig}; sed -e "s/\/root\//\/home\/$USER\/src\//" $file > $file.new; mv $file.new $file; diff $file.orig $file; done; - Delete all the
.dependfiles under busybox.find ./busybox -name ".depend" -exec rm {} \; - Execute
make clean. - Now you need to ensure that the tarfiles (in the
tarfilessubdirectory) have the right privileges on their contents. (Initially they don't.) So:pushd mipsel- you don't need install.rc3 at all:
rm -rf install.rc3 tar xzvf ../tarfiles/install.tar.gztar xzvf ../tarfiles/exinstall.tar.gz- popd
find . -type d -exec chmod 775 {} \;make clean(yes, again)
- There are several places where Makefiles try to run
mkcramfs. I don't have one of those; I havemkfs.cramfsinstead. If that's your situation as well, you can either create a mkcramfs symlink or modify the relevant Makefiles: Makefile, mfgtest_root/Makefile, and pivot_root/Makefile. Also make sure that the program is on your PATH! - The build process creates a file
/usr/local/bin/ez-ipupdate. That's right! It installs a MIPS cross-compiled binary onto the host system. This is the sort of thing that leads me to do my builds as a non-root user. Modifyez-ipupdate/Makefileso that the commands in theinstallandinstall-amtargets start withecho.
At this point, the make rebuild and make image-WL700gE commands completed for us without error. Give it a try. You should find yourself with a mipsel/WL700gE_1.0.4.6.nas when it completes.
If you get a segmentation fault when running generate_igpayatinlay -- this has happened to me from time to time, and I do not understand why -- you can work around it:
pushd translation_database- run
./generate_igpayatinlay ../www/translate_EN.txt ../www/translate_JP.txt_utf8 "Japanese" > igpayatinlay_sources_jp.cuntil that succeeds - run a similar command for Taiwanese (TW) if necessary
- Save the generated
igpayatinlay_sources_??.cfiles by renaming them - Modify the Makefile so that it copies the files back to the expected
igpayatinlay_sources_??.cnames rather than re-runninggenerate_igpayatinlay popd
halle:~ eric$ cat dload/ez-ipupdate_Makefile.patch
--- ez-ipupdate/Makefile.orig 2006-11-22 18:07:12.000000000 +0100
+++ ez-ipupdate/Makefile 2006-11-22 18:07:53.000000000 +0100
@@ -300,9 +300,9 @@
install-data-am:
install-data: install-data-am
install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ echo @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: $(PROGRAMS)
@@ -312,10 +312,10 @@
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
install: $(PROGRAMS)
- install -D ez-ipupdate $(INSTALLDIR)/usr/sbin/ez-ipupdate
- $(STRIP) $(INSTALLDIR)/usr/sbin/ez-ipupdate
+ echo install -D ez-ipupdate $(INSTALLDIR)/usr/sbin/ez-ipupdate
+ echo $(STRIP) $(INSTALLDIR)/usr/sbin/ez-ipupdate
romfs:
$(ROMFSINST) /bin/ez-ipupdate
halle:~ eric$