This page describes how you can boot your WL-700gE without using any internal storage resources except for the CFE boot loader. In other words, neither the flash device nor the hard drive are used to obtain the runtime operating system kernel or filesystem. You need to have a serial console working in order to do this.
This process is partly described in the document BCM4780P_Resource_Guide.doc, which is in the Asus "GPL" "source" bundle. The resource guide describes how to boot the device using a linux kernel image that is downloaded via TFTP from the CFE prompt, and/or using a root filesystem also downloaded via TFTP from the CFE prompt. The way that the TFTP rootfs works is, there is special code in the Broadcom Linux kernel that checks for an NVRAM setting of rootfs_in_ram=yes and then creates a virtual MTD device backed by a particular section of RAM. We don't really want to have to port that (fairly special-purpose) code to the current OpenWRT kernel, so instead we are pursuing the option of using a root NFS filesystem, as described in the Linux kernel document nfsroot.txt.
In order to netboot a WL-700gE, you will need to do some setup on your development machine (specifically: set up TFTP and NFS server software, build a linux kernel and make it TFTP-accessible, and set up a mipsel root filesystem and make it NFS-accessible). There's essentially no setup necessary for the WL-700gE, except for getting access to it over the serial console. (That's the whole point.)
Server Setup
Kernel image and TFTP
Configure the kernel (using ARCH=mips make menuconfig)
configure NFS support and IP autoconfiguration using DHCP
- Under Networking, Networking Options, select IP: kernel level autoconfiguration and then select at least IP: DHCP support (I select them all).
- Then under File Systems, Network File Systems, select NFS file system support and all the trimmings, and make sure that Root file system on NFS is selected.
configure kernel command line
- Under Kernel Hacking, provide a default command line something like:
root=/dev/nfs nfsroot=192.168.236.9:/home/clfs ip=dhcp noinitrd console=ttyS0,115200
Of course, you need to provide the real IP address and path to the NFS export.
(See BuildingOpenWrt for more details on how to build a kernel and SettingUpNfsServer for how to create the root filesystem)
After doing an ARCH=mips make you will find that there's a file called vmlinux in the top of the linux source directory structure. This kernel image can't actually be booted, for reasons that I do not understand. Looking at the OpenWRT build process, I find that this file is copied elsewhere with objcopy, so we'll do the same thing. Perhaps someday a friendly kernel hacker will explain why this is needed...
mipsel-linux-uclibc-objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S vmlinux vmlinux-fixed
place the files
- Copy the kernel image vmlinux-fixed to your tftp directory.
Note that we are using the uncompressed kernel image vmlinux rather than a compressed image. The CFE will only boot a compressed kernel image if it is a traditional vmlinuz compressed image; openwrt produces an LZMA-compressed kernel image vmlinux.lzma, which I cannot get to boot using CFE. The boot command given below can boot an uncompressed kernel image of up to 8mb in size, which is plenty for me. (Keep in mind that this kernel only needs to be complete enough to mount the real root filesystem on the hard drive.)
You can use a compressed linux kernel instead just by running gzip on the vmlinux file. If you do that, then add -z to the CFE boot command.
starting tftp server
run as root: in.tftpd -l -s -B 1400 /home/clfs/boot (using whatever your tftp directory is, if it's not /home/clfs/boot.)
If you don't have in.tftpd, I suggest installing tftp-hpa; Brett uses version 0.42, Eric uses version version 0.48. A tftpd comes with inetutils, which might be worth trying.
NFS Root Filesystem
Look at SettingUpNfsServer if you need to know how to set up the NFS software on your server machine.
WL-700gE Setup
Boot to the CFE console. In short, this means hold down the orange "EZ-Setup" button on the back of the router while powering on the device; then wait until you are in rescue mode, and then hit control-C to abort the TFTP server.
Set up the network properly
If necessary, run ifconfig eth0 -auto to use DHCP to configure the network.
The default IP address for the freesa box will be 192.168.1.1, unless there is an NVRAM setting that changes it. The CFE ifconfig command will initialize the network interface eth0 properly. Incidentally, eth0 appears to be the four LAN ports; I'm using LAN1. I believe eth1 is the WAN interface.
If DHCP is not available, you may may need to configure the network by hand:
CFE> ifconfig eth0 -auto
DHCP registration failed on device eth0
*** command status = -23
CFE> ifconfig eth0 -addr=192.168.15.25 -gw=192.168.15.1 -mask=255.255.255.0 -dns=68.87.69.146
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.15.25, mask 255.255.255.0
gateway 192.168.15.1, nameserver 68.87.69.146
*** command status = 0
CFE> ping 192.168.15.1
192.168.15.1 (192.168.15.1) is alive
192.168.15.1 (192.168.15.1): 1 packets sent, 1 received
*** command status = 0
CFE> ping 192.168.15.109
192.168.15.109 (192.168.15.109) is alive
192.168.15.109 (192.168.15.109): 1 packets sent, 1 received
*** command status = 0
CFE>
Issue the netboot commands
The CFE command to boot a kernel over TFTP is:
boot -addr=0x80001000 -max=0x800000 -tftp IPADDR:KERNEL.FILENAME
If you're using a gzip-compressed kernel image, add a -z option. But you can use an uncompressed kernel of up to 8mb with that command. (Hex 800000 equals 8 megabytes.)
For example, what Brett types is:
boot -addr=0x80001000 -max=0x800000 -tftp 192.168.236.5:vmlinux
Where, Eric uses:
boot -addr=0x80001000 -max=0x800000 -tftp 192.168.23.5:vmlinux
The boot address is obvious, it's the location in RAM that the CFE will transfer control to when booting an operating system. And how do I know that? Simple, it is the value of the nvram variable os_ram_addr.
Results of Current Efforts
It works fine.
Having any modules loaded at boot time is problematic, because getting access to the hard disk is tricky. I avoid those problems just by not having any modules.* files under /lib/modules/$(uname -r).
See High Level Plan for the next steps
Attachments
-
ssh_to_asus_WL-700gE_debian_2.6.19.2.txt
(1.0 kB) - added by Eric Herman
19 months ago.
attached console output of ssh session to netbooted WL-700gE
-
console.out
(31.2 kB) - added by EricHerman
19 months ago.
Serial console output of WL-700gE with tftp booted kernel and NFS mounted root filesystem
-
console1.out
(33.9 kB) - added by EricHerman
19 months ago.
Serial console output of WL-700gE with tftp booted kernel and NFS mounted root filesystem
