When I refer to sending commands over netconsole, you will do the same if you are using the serial port. Obviously, any references to setting up or starting netconsole do not apply
Connect the Dockstar to a network with DHCP, but disconnected from the internet. (Note that if you've been using the Dockstar as intended, it will have updated itself and SSH will no longer be available. You'll need to open it up and follow this guide using the serial header. See generic.serial)
SSH in. root is the username and stxadmin is the password. Run killall hwbd then reconnect to the internet.
Install updated uBoot (from http://projects.doozan.com/uboot/)
This will also install and set up fw_envtools in order to modify bootloader parameters from within the operating system, and allow booting from USB drives (see additional resources). This script should work on most distros, but was designed to be run from the original firmware.
cd /tmp wget http://projects.doozan.com/uboot/install_uboot_mtd0.sh chmod +x install_uboot_mtd0.sh ./install_uboot_mtd0.sh
You may skip this step if you are connected to the Dockstar via the serial headers on the board – this simply tunnels the physical serial port over the network and is necessary if you'd rather not open up your Dockstar. It might come in handy later, so it doesn't hurt to do this.
Please note that netconsole will not work once the system has booted, as the operating system will take over control. It is not a complete replacement for access to the serial port. The main purpose is to identify errors during boot and gain access to the uboot console.
Configure netconsole (server IP is your machine)
fw_setenv serverip <your IP address> fw_setenv ipaddr <dockstar’s IP address> fw_setenv if_netconsole 'ping $serverip' fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 3; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;' fw_setenv preboot 'run if_netconsole start_netconsole'
This will essentially combine what used to be mtd2 (32MB) and mtd3 (219MB) into a single rootfs partition.
fw_setenv mtdparts ‘mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)’
Flash layout now looks like this:
| New Flash Layout | |||
|---|---|---|---|
| mtd# | mtd0 | mtd1 | mtd2 |
| size | 0x0100000 | 0x0400000 | 0xfb00000 |
| in MiB | 1 | 4 | 251 |
| name | u-boot | uImage | rootfs |
| file system | none | none | jffs2 |
(see flash.layout for more info)
fw_setenv rescue_bootcmd 'if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi' fw_setenv rescue_set_bootargs 'setenv bootargs console=$console ubi.mtd=2 root=/dev/mtdblock2 ro rootfstype=jffs2 $mtdparts $rescue_custom_params' fw_setenv rescue_installed 1
Start a TFTP server on your machine, bound to all interfaces or the one as specified in serverip and host these files:
If using the netconsole method, run
nc -l -u -p 6666to monitor boot console. Ensure that any firewalls are off. Remember that you will need to run 2 simultaneous instances of nc. Refer to the link in the netconsole section for more details.
Reboot the Dockstar, press “any key” when prompted to enter the console (alphanumeric key, enter doesn’t seem to work)
Run the following commands at the bootloader prompt:
mw 0x6400000 0xffff 0x300000 tftpboot 0x6400000 openwrt-kirkwood-uImage nand erase 0x100000 0x400000 nand write.e 0x6400000 0x100000 0x400000 mw 0x6400000 0xffff 0x200000 tftpboot 0x6400000 openwrt-kirkwood--jffs2-128k.img nand erase 0x500000 0xfb00000 nand write.e 0x6400000 0x500000 0x200000
And that's it! Your Dockstar has had its bootloader updated, flash repartitioned and OpenWRT installed.
To run any other programs, or to preserve flash life, you can also run the OS off a USB drive. The Dockstar will automatically boot off any connected USB storage device provided the necessary files are on the first partition. See the next section for details
I have OpenWRT installed on flash as a backup / recovery setup. My primary install is on the first partition of an external HDD so as to not wear out the flash.
To install OpenWRT onto a USB drive of any sort, you need to do the following:
openwrt-kirkwood-rootfs.tar.gz onto this partitionopenwrt-kirkwood-uImage onto the root of the same partition and rename as uImage
If the device is plugged in at boot, then the Dockstar should start with a clean installation. If there's a problem, it will be in the boot log. If it fails to start, double check that uImage is named as such and that the partition is ext2 formatted.
If using external storage, it is recommended that you create a swap partition of around 256MB. (OpenWRT does not seem to use much swap on this device)
This is required if you'd like to modify your uboot environment variables from within OpenWRT.
Run
opkg update opkg install uboot-envtools
Put this into a new file at /etc/fw_env.config
# MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd0 0xc0000 0x20000 0x20000
(This might also be possible to achieve by simply running the uboot install script again, as it will skip installation of u-boot if a valid version is found, but should still install fw_envtools)