We will have two main components in FreeSA: a flash-resident firmware image where, among other things, the kernel will live; and a hard disk-based filesystem containing the full operating system distribution.
Flash Image
The flash must contain the kernel and a small initial root filesystem. Under normal operations, the only thing this will be used for is activating the hard disk, mounting the real root filesystem on the hard disk, and then running init on the real root filesystem.
Under abnormal circumstances, the initial root filesystem must permit installation or recovery of the freesa system. This probably means, at a minimum, it should provide a way to obtain a root console prompt from the internal root filesystem. Ideally, this root shell could then be used to mount a full root filesystem image over NFS, for example; or partition and format the internal hard disk, then install an OS tarball found over the network using NFS or Samba or netcat.
The filesystem embedded in the flash image will be similar to the OpenWRT trx image -- that is, unless for some reason it turns out this is a bad idea, the kernel will be lzma compressed, and the root filesystem will be a squashfs image. It will also be built using a uClibc cross-toolchain, just like OpenWRT is.
- We will need to reverse-engineer the OpenWRT build process enough that we can build the cross-toolchain and all utilities ourselves, rather than relying on the OpenWRT build process. It's not that there is anything wrong with the OpenWRT build process; it's just that we don't understand it, and we want to understand the FreeSA construction process.
- The cross-toolchain for the firmware will be exactly like the OpenWRT cross-toolchain, uClibc-based and so on -- unless we can get away with using the glibc one, or unless we can build the firmware using native tools on a FreeSA system (in which case we might want to do that instead of using cross-tools).
- We will try to determine a minimal set of OpenWRT patches to apply to the Linus kernel to get something that works.
- The combination of the kernel plus the initial root filesystem will need to support:
- the IDE interface (aec92xx)
- root filesystem (xfs)
- network (b44)
- ssh or telnet server when in recovery mode; or maybe http://www.xenoclast.org/nca/
- possibly NFS or something similar
- tools like wget and fdisk and the like
- it won't need things like wireless
- It would be cool if we could use a USB gadget of some sort to provide a serial console; that would require:
- additional kernel drivers (homework: try these kernel config steps)
- some USB Console configuration homework on our part
- the purchase of a pair of gadgets perhaps like this USB to serial thing
It appears that there is just no way to access or control the CFE boot loader except using a real serial console, so an important goal of the FreeSA firmware is to make it unnecessary to access CFE.
(If we can use kexec on the FreeSA device, then the internal firmware's role will be a second-stage boot loader, whose job is to provide a way to load a "real" runtime kernel and boot it. But we suspect it will not be trivial to get kexec to work for us.)
Flash Image Contents
The initial goal is to support normal operations as stated above: activating the hard disk, mounting the real root filesystem on the hard disk, and then running init on the real root filesystem. What programs are needed to support this?
- exec
- pivot-root
- chroot
- the kernel modules that spin the hard disk.
- the "insmod" program
- udev to create the device node files as they are synthesized
- mount
- an init script
This will need to be based on a uClibc toolchain, since the root filesystem plus kernel image need to be 1728mb or less.
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). 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.
