DreamPlug

Disk partitions
The existing disk partitions are as follows:


 * /dev/sda is the internal SD card and separated so sda1 is a ~100 MiB FAT16 partition with kernel uImages and sda2 is a ~4 GiB ext3 partition carrying the stock (in my case Debian) OS.
 * /dev/sdb is the external SD card slot
 * /dev/sdc is the first external disk via USB or eSATA
 * …the rest follows in the same logic.

U-boot
A clean u-boot environment that first boots from the external USB and has an option to boot from the internal SD (check yours with printenv).

To swich just change the bootcmd to include either gentoo_bootcmd (for USB) or stock_bootcmd (for internal SD).

bootdelay=3 baudrate=115200 ethact=egiga0 ethaddr=F0:AD:4E:00:B0:8E eth1addr=F0:AD:4E:00:B0:8F clear_kernel_in_mem=echo Purging kernel in memory; mw 0x6400000 0x0 0x300000 ipaddr=192.168.1.103 serverip=192.168.1.111 x_bootcmd_usb=usb start x_bootcmd_ethernet=192.168.1.1 stock_bootargs=root=/dev/sda2 rootdelay=10 console=ttyS0,115200 gentoo_bootargs=root=/dev/sdc2 rootdelay=10 console=ttyS0,115200 stock_load_kernel=fatload usb 0 0x6400000 uImage stock_bootcmd=usb start; fatload usb 0 0x6400000 uImage; setenv bootargs root=/dev/sda2 rootdelay=10 console=ttyS0,115200; bootm 0x6400000; gentoo_bootcmd=usb start; fatload usb 0 0x6400000 uImage; setenv bootargs root=/dev/sdc2 rootdelay=10 console=ttyS0,115200; bootm 0x6400000; bootcmd=clear_kernel_in_mem; run gentoo_bootcmd stdin=serial stdout=serial stderr=serial

Environment size: 838/4092 bytes

Don’t forget to `saveenv` if you want to keep the environment after the reboot.

Note: you have to escape ; with \ if you want to use it in setenv. Note: if you want to remove a setenv line, just call setenv with the variable, but no definition (e.g. `setenv x_boot_lala` will delete the line that defines x_boot_lala).

Roll your own
The stock version of U-Boot that ships with the DreamPlug does not pass a device tree as required by newer kernels. Flashing a newer version of U-Boot is an option but due to the way the hardware initializes, this is extremely tedious to do, if not almost impossible. This poor user tried unsuccessfully for two days. Alternatively, newer kernels (3.2+) support appending the device tree to the kernel image manually. Give yourself an easy life with the following steps.

Manually appending the device tree

 * 1) emerge dev-embedded/u-boot-tools
 * 2) Configure and build the kernel as usual with CONFIG_ARM_APPENDED_DTB enabled.
 * 3) make kirkwood-dreamplug.dtb
 * 4) cat arch/arm/boot/dts/kirkwood-dreamplug.dtb >> arch/arm/boot/zImage
 * 5) make uImage
 * 6) Copy arch/arm/boot/uImage to the device. Don't forget the modules!

Cross-compiling
The DreamPlug is not very fast. Save some time and build the kernel on another machine. Only a stage 1 toolchain is required for building a kernel.
 * 1) emerge sys-devel/crossdev
 * 2) crossdev -s1 -t arm-none-eabi
 * 3) Append ARCH=arm CROSS_COMPILE=arm-none-eabi- to all invocations of make.

Built-in vs modular drivers
Be aware that building the SATA driver (sata_mv) into the kernel will result in any drives attached to the DreamPlug at boot time taking priority over any SD cards. In other words, /dev/sda will be a SATA drive, not an SD card. This will most likely cause a boot failure. The simplest option is to build the driver as a module. Another option is to use an initrd. If neither of these appeal, there is a third option as of 3.7. You can now specify the root device in the form root=PARTUUID=XXXXXXXX-XX with an NT disk signature and partition number. This has been verified to work on the DreamPlug.

Kernel configuration
A minimal(ish) kernel configuration for 3.6.5 can be found here. Only DreamPlug hardware drivers have been enabled, except for wireless and Bluetooth, which have been left disabled for security reasons.

Pre-built images
You can still use a pre-built kernel image, like the ones available on PlugComputer Forums …but where's the fun in that? ;)