Accidentally cross building Linux 2.6.31
I'm not really planning on re-entering kernel development. While intensely fascinating, it takes too long to compile on the hardware I have left to me, programming in it is finicky and painful, and getting fixes pushed upstream can be a nightmare, especially on the embedded architectures I used to do so much work on. It takes forever to download updates to whatever git tree I'm working out of, where I am, too.... I have a lot of trees and code lying around that let me build custom OSes quickly, but nothing worth publishing, all of it out of date...
...I am planning on kind of getting involved again, to whatever extent necessary, when the village telco ships some boards, but that's it. Well, that, and freeswitch. I keep telling myself that. I have to keep my involvement in charitable projects down enough so I can afford to eat, next year.
But I got a bee up my butt regarding dd-wrt. DD-WRT is a fabulous upgrade to many consumer grade routers, I've been running it (and its cousin, openwrt) off and on, since the projects' inception. They make consumer grade routers tolerable, with features like dynamic dns, local dns, sip routing, and ipv6. I installed the latest on my WRT300N a while back, and it's quite awesome, a real step up in sane additions to your home network.
I've also been fooling around with ipv6 a lot ever since all of google got on it a few months back, and dd-wrt almost - kind of - works - well enough to tolerate. The default dd-wrt doesn't contain ping6 or iptables6 or a current version of radvd and the web server doesn't do ipv6, and there's no dhcp6 server, and I'd really like to get bind running on it... and... it bugs me and...
... the dd-wrt kernel on this particular router is still at 2.4.X, which is so obsolescent it hardly bears thinking of. Worse, in dd-wrt - that kernel gets compiled with an ancient version of gcc - 3.3 - and there was just no way to get the 20GB+ svn checkout of dd-wrt from there to here without a lot of pain I still can't bear thinking of.
Fiddling with toolchain incompatibilities is something that I'm not even willing to get paid for nowadays. Fixing code to compile is not coding.
There has been a lot of changes to IPv6 that landed in the 2.6 kernel and didn't get backported to 2.4, too. In particular, so far as I know routing announcements got made more sane (so default routes should "just work"), mobile ipv6 (which kind of appears to be a dead project) got incorporated, and all this other cool stuff is in there too (and yea, I'm the type to get excited about fannotify).
I had a little spare time this afternoon...
So, on my well connected host (thank YOU isc!), I pulled down Linus's entire git tree today. It took about 4 minutes. kernel.org is on a GigE network 4 hops away.
traceroute to git.kernel.org (22.214.171.124), 30 hops max, 60 byte packets
1 guest.r1.sql1.isc.org (126.96.36.199) 1.469 ms 1.842 ms 1.832 ms
2 int-0-1-0-0-606.r1.sfo2.isc.org (188.8.131.52) 6.497 ms 6.522 ms 6.502 ms
3 int-3-0-0.r1.pao1.isc.org (184.108.40.206) 4.059 ms 4.070 ms 4.050 ms
4 git2.kernel.org (220.127.116.11) 1.757 ms 1.744 ms 1.725 ms
It would probably take a few days to pull the tree where I live now, and forever where I am moving next week. I try to tradeo-ff bandwidth issues with rsync a lot, pulling down source trees to this machine, then (slowly) pulling them down to my home machines. That way I can handle partial transfers and eventually get what I need to home base, but multi-GB downloads are no fun, regardless...
I configured a basic kernel for the mips + broadcom architecture that's in my WRT300N, did an apt-get install of emdebian's cross development infrastructure (another 20 minutes because it had to come from France) and the gcc 4.3.2 cross toolchains for mips and arm...
and fired off a batch process to compile the kernel.
cd ~/src/git/linux-2.6; make O=/home/d/build_wrt CROSS_COMPILE=mipsel-linux-gnu- vmlinux modules
I may be horribly retro for using batch but I love it - I can queue up lots of work for (this very slow) processor, go offline, and get notified via email when each job finishes. (I configure atd to default to a high load average so it handles the multiple cores better) I queued up a download of the latest dd-wrt tree, too...
About an hour and half later, my email dinged. There wasn't a single error in the compile
. It generated the modules, symtabs, and vmlinux, apparently perfectly. Amazing. Compiling for alternate architectures never looked so clean before.
It can't possibly be this easy. No, I don't want to take this further. There's probably definitely something that just won't work on 2.6 on this router, some proprietary module somewhere, and that's why nobody's done it yet... No, I don't want to try booting this kernel on my WRT. No... somebody stop me...
I had entered the kernel development schedule into my org-mode so I can surface every so often and check in on things, and I was kind of aware that Linus was planning on releasing 2.6.31 "soon". It turned out that about 5 minutes after that build completed, he released the that exact same code with the change to the makefile calling it 2.6.31...
Now I have to recompile with the right version number, so I did a make clean, and fired off the same batch process.
And checked in on my svn checkout of the rest of dd-wrt. It had hung partway through... but enough came down for me to figure I really could try a new toolchain through the whole thing, update busybox, radvd, and maybe take a stab at cross compiling a minimal version of bind...Do I really want to rebuild my entire router from source code and move ipv6 another iota towards acceptance?
I just checked the surf report. There's no waves til saturday. I'm doomed. I Sure wish I had two of these wrts available so I could brick one - or a working qemu emulator. Yea, lacking those, it would be insane for me to continue... I *NEED* this router just to exist on the internet...
cd ~/src/qemu-0.11.0-rc2; ./configure; make -j 2
I'm going to dinner now. I need another distraction, fast.Update:
I got back from dinner and went right back into deep hack mode until 6AM. I managed to build an ipv6 enabled version of openwrt for the mesh potato, but have totally failed to get a working mips emulator going...
I guess freeswitch is next. And maybe some more sleep.
Labels: dd-wrt, gcc, linux, org mode