Current Work In Progress: SecondStageBootLoader
The Plan¶
This is just an ad hoc off-the-cuff description of how we currently see the work of FreeSA being broken down. See also: FreeSA Notes.
Flash Image¶
The Flash will contain a SecondStageBootLoader: a minimal system containing a linux kernel and a minimal root filesystem. The init script will use pivot-root to "pole vault" into the root filesystem on the hard disk.
Disk Image¶
The hard drive filesystem will contain essentially a full CLFS build, except for the kernel image itself (which will only be in the firmware, unless we ever see kexec for mips actually working). The cross-toolchain will be exactly as described in CLFS (glibc-based), except for the kernel headers which will use the headers from the patched OpenWRT kernel.
All possible kernel modules will be built and will reside on the internal disk filesystem; that way, we will only need to worry about installing a new flash image when we switch to a new kernel version.
The real root filesystem will be built using a normal glibc-based toolchain.
What we will build external to the WL-700gE is just the first part of the CLFS system; then we'll netboot the device (TFTP kernel, NFS root filesystem) and do the rest of the build on the freesa box itself using the serial console.
Stage 0¶
The goal is to establish that we have the tools to develop FreeSA. done
- Add a serial console (done)
- Build the Asus Firmware (done)
- Flash and boot rebuilt firmware (done)
- Flashless Development Cycle (done)
- using CFE, boot a kernel via tftp (done)
- said kernel loads root filesystem via NFS (done)
- ssh to WL-700gE (done)
Stage 1¶
The goal is to have a running WL-700gE with a current kernel that can access the internal hard disk. done
flashing OpenWRT¶
- build & flash & boot system with OpenWRT (done)
- mount the hard drive (done)
- fold this knowledge into our flashless development cycle (in progress)
flashless development cycle¶
- Investigate Latest OpenWRT patches (in progress)
- Start with a machine booted using TFTP kernel, rootfs via NFS (done)
- Eric is booting the 2.6.19.2 kernel built from OpenWRT trunk (done)
- Add patches related to WL-700gE (in progress)
- get the rootfs updated to match current kernel & modules (not started)
- Eric is booting the 2.6.19.2 kernel built from OpenWRT trunk (done)
- Check to see if GPIO control is exposed over /proc (in progress)
- initially was not:
asus-debian:/proc# find . -iname "*gp*io*" asus-debian:/proc# asus-debian:/sys# find . -iname "*gp*io*" asus-debian:/sys#
- Modify the kernel so that GPIO control is exposed over /proc (in progress)
root:~# find /proc -iname "*gp*io*" /proc/diag/gpiomask /proc/irq/3/gpio root:~#
success condition:¶
- mount the hard disk (done)
If we make it to this point, then we fundamentally have the capability to
bootstrap a system.
- drink a toast (done)
Stage 2¶
The goal is to verify that all critical hardware is supportable with a current kernel. (in progress)
Using the network-booted stuff, verify that the following hardware components all work:
- eth0
root:~# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436
txqueuelen:0
eth0 Link encap:Ethernet HWaddr 00:17:31:2A:90:0B
inet addr:192.168.23.3 Bcast:192.168.23.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500
txqueuelen:1000
root:~#
- eth1 (investigate why eth1 complains at boot)
- Wireless
- USB ports
- 2-wire serial bus
- LM63 temperature sensor
- RTC
The only thing that is IMPORTANT and liable to be difficult is the wireless. (Other critical components are obviously supported if we get here: IDE, GPIO...) However, it looks like this is detected with latest OpenWRT build, so that is very good news.
Stage 3¶
The goal is to have a FreeSA kernel image that has a root filesystem mounted from the internal HD. (done)
Try using initramfs with the stage1 kernel and so on, using early userspace to power-on the HD, load modules, etc., to access the hard drive and then do a pivot-root to make the HD the root fs.
Probably it would be a good idea as well to make the boot process smart enough to see whether there is a valid HD root filesystem, and IF NOT then switch to NFS-mounting a root filesystem? Or for this initial version do we want to recommend people not program this kernel into the flash until they have their HD rebuilt?
If initramfs does not work -- then switch to using squashfs, and build a TRX image that does the IDE init and pivot-root magic. Of course that means we need to know how to build a TRX image. "Shouldn't be a problem."
Stage 4¶
the goal is to have a CLFS distribution resident on the hard disk and bootable by the SecondStageBootLoader's kernel and/or initial rootfs. (done)
- Build a MIPS CLFS initial system. (done)
- Use the NFS rootfs to install the CLFS initial system on the internal HD. (done)
- Boot the system so that the serial console && dropbear ssh provides access to the CLFS initial system. (done)
- Complete the entire CLFS build process, using package users, from the serial console/shh. (done)
Stage 5¶
the goal is a SecondStageBootLoader which can pivot root to root filesystem on the hard disk (in progress)
- build a uClibc toolchain (done)
- construct a root filesystem capable of being loaded into a trx image (in progress)
- get init to pivot root into hard disk (use TFTP and NFS root to demonstrate it will work) (done-ish)
- fix errors and make nice (in progress)
- build a trx image (in progress)
- flash into firmware (Program the stage2 kernel into the flash chip).
- watch it boot
Declare victory!
Stage 6¶
the goal is a beta- get wireless working, and both eth working at least
- basic DHCP and NAT
- litbuild
Stage 7¶
the goal is to complete the FreeSA distribution
- Build a custom cross-toolchain from source
- the OpenWRT toolchain is free but difficult to understand, not targeted to our needs, but a useful start to springboard from.
- see litbuild
- Using package users and/or litbuild, build and configure all of the software packages that provide features we want.
Other Tasks¶
- we should investigate costs and turn-around time for having Asus re-flash a warrenty void unit. (no feedback)
- make alpha/beta release
- trx images of the SecondStageBootLoader
- tar balls of root filesystems
- quick instructions on how to use this without a serial console, just CFE and the orange button
- Mailing List
- Public Git Repos
Further Steps¶
These are optional but would be awfully nice.
- provide a way for people to bootstrap a FreeSA build without having a serial console AT ALL.
- maybe using a USB/serial converter, with console at /dev/ttyUSB0 (maybe look at Remote Serial Console HOWTO for some ideas)
- build a nettrom-style flash image that allows the runtime kernel to be loaded from TFTP or HD, and allows root filesystem to be NFS-mounted or HD-based. (probably requires kexec for MIPS)
- create a TRX image that, if there is no rootfs and software installation on the hard drive, creates a FreeSA installation by partitioning the hard drive, creating filesystems, and then starts up a server (sshd, ftpd, something like that) to allow files to be installed into the hard drive. This is minimally what is necessary for the "prebuilt FreeSA" distribution.
- Include some Advanced Routing & Traffic Control examples like prioritizing VoIP trafic high and ftp traffic low.
- Include some security examples to work in conjunction with ARTC so that we may confidently open up our wireless connection for the neighbors to use, without having to worry that the neighbors might be a threat to their machines, and having confidence that our traffic takes priority over the neighbors so we don't care if they want to try to be bandwidth hogs.
- make it easy to add a machine with MAC, ip address, and a note as to who it belongs to