This post describes how to install an OpenWrt kernel and rootfs on the internal NAND flash of the Seagate Dockstar so that it will boot into OpenWrt at power-on, with no USB storage device required.
Update: I've consolidated this HOWTO and the following one into a single guide to installing OpenWrt on the Dockstar.
WARNING: this approach requires you to open the case and install a serial cable, and completely replaces the factory-installed software with OpenWrt. No one has tried to restore the factory firmware yet, so we don't know whether that's possible. Proceed at your own risk.
1. Open the case and install a serial cable. See this page for the serial pinout (and how to open the case) and this page for a picture of where to find the connector.
2. You need to build your own OpenWrt kernel and root filesystem image, because the Marvell Kirkwood target currently supports only the Sheevaplug, which has a different NAND flash layout.
Use "make menuconfig" to configure the build system for a kirkwood target. Add squashfs in the target images section. Also select built-in luci and ntpclient packages.
(This step isn't required, but I recommend it for easier recovery from bad flash writes below.) Use "make kernel_menuconfig" to add built-in SCSI disk, USB EHCI, USB storage, and ext2 filesystem support.
Do an initial build.
3. Change to build_dir/linux-kirkwood/linux-2.6.30.10 and apply the following patch:
--- a/arch/arm/mach-kirkwood/sheevaplug-setup.c
+++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c
@@ -33,7 +33,11 @@ static struct mtd_partition sheevaplug_nand_parts[] = {
.offset = MTDPART_OFS_NXTBLK,
.size = SZ_4M
}, {
- .name = "root",
+ .name = "rootfs",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = SZ_32M
+ }, {
+ .name = "rootfs_data",
.offset = MTDPART_OFS_NXTBLK,
.size = MTDPART_SIZ_FULL
},
If you want to stop the LED from blinking, also apply this patch:
--- a/arch/arm/mach-kirkwood/sheevaplug-setup.c
+++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c
@@ -62,9 +62,15 @@ static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
static struct gpio_led sheevaplug_led_pins[] = {
{
- .name = "plug:green:health",
+ .name = "dockstar:green:health",
.default_trigger = "default-on",
- .gpio = 49,
+ .gpio = 46, /* green */
+ .active_low = 1,
+ },
+ {
+ .name = "dockstar:orange:misc",
+ .default_trigger = "none",
+ .gpio = 47, /* orange */
.active_low = 1,
},
};
@@ -84,7 +90,8 @@ static struct platform_device sheevaplug_leds = {
static unsigned int sheevaplug_mpp_config[] __initdata = {
MPP29_GPIO, /* USB Power Enable */
- MPP49_GPIO, /* LED */
+ MPP46_GPIO, /* LED green */
+ MPP47_GPIO, /* LED orange */
0
};
(Both of the above patches are based on work done by Alexander Holler <holler@ahsoftware.de>)
Rebuild the kernel with "make" at the top level. The build system will only need to rebuild the kernel.
4. Copy the kernel image from bin/kirkwood/openwrt-kirkwood-uImage to a TFTP server on your network.
5. Prepare the rootfs image. Do not use the squashfs file in bin/kirkwood. (It is a combined image with both the kernel and the root filesystem.) Instead, cd to build_dir/linux-kirkwood and run the command
dd if=root.squashfs of=openwrt-kirkwood-rootfs.squashfs conv=sync bs=128k
This pads the (rootfs-only) squashfs file to a 128K multiple. Copy the resulting openwrt-kirkwood-rootfs.squashfs to the TFTP server.
6. Connect your Dockstar to your network and use a terminal program like minicom to connect to it (speed 115200, no flow control). Power-on the Dockstar. You should be able to see the output of the u-boot bootloader as it boots, and if you type any character you can interrupt the boot sequence and interact with u-boot. You should see something like this:
U-Boot 1.1.4 (Jul 16 2009 - 21:02:16) Cloud Engines (3.4.16)
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 00690D60
Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz
DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 128MB
DRAM Total size 128MB 16bit width
Flash: 0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:256 MB
CPU : Marvell Feroceon (Rev 1)
CLOUD ENGINES BOARD: REDSTONE:1.0
Streaming disabled
Write allocate disabled
USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 0
CE>>
Use the "setenv" command in u-boot to set the ipaddr and netmask variables for the Dockstar's IP address, and the serverip variable to the IP address of your TFTP server. Check that you have connectivity by doing
CE>> ping $(serverip)
7. Now you're ready to flash the kernel and rootfs images onto your Dockstar. Warning: double-check everything you type before hitting "return". If you overwrite the u-boot partition by mistake, you will brick your Dockstar.
CE>> mw 0x1000000 0 0x100000
CE>> tftpboot 0x1000000 openwrt-kirkwood-uImage
# take note of the "bytes transferred in hex and make sure that it's less than 0x100000
# if not, redo the "mw" command above with a larger size, and use that size in the commands below
# CAREFULLY erase the uImage partition and flash it with the new kernel
CE>> nand erase 0x100000 0x400000
CE>> nand write.e 0x1000000 0x100000 0x100000 # or larger size if needed
CE>> mw 0x1000000 0 0x200000
CE>> tftpboot 0x1000000 openwrt-kirkwood-rootfs.squashfs
# as above, make sure 0x200000 is larger than the rootfs image size, and adjust accordingly
# CAREFULLY erase the rootfs partition and flash it with new squashfs image
CE>> nand erase 0x500000 0x2000000
CE>> nand write.e 0x1000000 0x500000 0x200000 # or larger size if needed
# CAREFULLY erase the rootfs_data partition so openwrt will create a jffs2 overlay filesystem
CE>> nand erase 0x2500000 0xdb00000
8. Set some magic u-boot parameters and save them:
CE>> setenv arcNumber 2097
CE>> setenv mainlineLinux yes
CE>> saveenv
9. Try it! Type "reset", or just power-cycle the Dockstar. It should boot into OpenWrt.
Troubleshooting
I have had problems with incorrect flash writes for the second (rootfs) partition. If your kernel boots but prints error messages about errors in the squashfs root partition, that might be the problem. Here's how I recovered from that.
1. If you didn't do the "recommended" part of step 2 (enabling support for USB storage and ext2 in the kernel), do it now. Rebuild the kernel and re-flash it.
2. Format a USB drive with one partition containing an ext2 filesystem. As root, un-tar the contents of bin/kirkwood/openwrt-kirkwood-rootfs.tar.gz onto the USB drive, and also copy the openwrt-kirkwood-rootfs.squashfs image onto the drive (as a regular file).
3. In u-boot, do
CE>> setenv bootargs_root root=/dev/sda1 rootdelay=10 rootfstype=ext2
CE>> boot
Your Dockstar should boot with the USB drive as its root filesystem.
4. Configure OpenWrt so that it can network to the outside world. Then do:
# opkg update
# opkg install mtd-utils
(Alternatively, you can copy the mtd-utils package, or its commands, onto the USB drive before booting the Dockstar.)
5. Use the mtd-utils commands to flash the mtd2 partition:
# flash_eraseall /dev/mtd2
# nandwrite /dev/mtd2 /openwrt-kirkwood-rootfs.squashfs
6. Type "reboot" and hope that your rootfs partition is now correct.
(Last edited by ecc on 10 Jul 2010, 01:20)