Ok, so you are looking for a comprehensive guide on how to install a modern Debian system into the Flash memory of your Sheeva Plug? Your googling has paid of – look no further!
What we will do in this guide:
- Update the bootloader to a recent version which supports direct booting from ubifs partions. So you can just use the stock Debian kernel without any hassle or SD card.
- Install Debian to a ubifs filesystem on the Sheevaplug flash.
Not everything needed in this guide is covered here. It’s assumed you have prepared:
- A terminal program of your choice which you can use to connect to the debug connection of your Sheeva Plug.
- You have a working TFTP server for providing the new firmware etc. to your Sheeva. You can probably adapt this guide to use USB or SD cards, though.
Please note that this guide is specific to the “normal” SheevaPlug, that is the original SheevaPlug, the eSATA SheevaPlug and the Ionics Nimbus 100. Especially the u-boot update procedure will be different and you can brick your non-normal Sheeva that way!
Updating the bootloader
Let’s first update the bootloader to something useful i.e. a recent built of the vanilla u-boot bootloader. So connect to your Sheeva and stop the boot process by pressing the “any” key:
__ __ _ _ | \/ | __ _ _ ____ _____| | | | |\/| |/ _` | '__\ \ / / _ \ | | | | | | (_| | | \ V / __/ | | |_| |_|\__,_|_| \_/ \___|_|_| _ _ ____ _ | | | | | __ ) ___ ___ | |_ | | | |___| _ \ / _ \ / _ \| __| | |_| |___| |_) | (_) | (_) | |_ \___/ |____/ \___/ \___/ \__| ** MARVELL BOARD: SHEEVA PLUG LE U-Boot 1.1.4 (Jul 14 2009 - 06:46:57) Marvell version: 3.4.16 U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CF120 Soc: MV88F6281 Rev 3 (DDR2) CPU running @ 1200Mhz L2 running @ 400Mhz SysClock = 400Mhz , TClock = 200Mhz DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6 DRAM CS base 0x00000000 size 256MB DRAM CS base 0x10000000 size 256MB DRAM Total size 512MB 16bit width Flash: 0 kB Addresses 8M - 0M are saved for the U-Boot usage. Mem malloc Initialization (8M - 7M): Done NAND:512 MB CPU : Marvell Feroceon (Rev 1) 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 Marvell>>
Since all u-boot settings will be lost during the update it’s a good idea to remember the MAC address of your Sheeva :
Marvell>> printenv ethaddr ethaddr=F0:AD:4E:01:49:8F
Which is of cause differs for each Sheeva.
You have to options for your new u-boot image. Either a rather outdated “official” 2012.04.01-2 build which can be downloaded here or you could use my own build 2013.08.26 (based on uboot 2013.10-rc1-00034-g2b26201) from here. Copy it to your TFTP directory. Now let’s flash it:
setenv serverip 172.16.0.187 # IP of your TFTP server setenv ipaddr 172.16.0.15 # IP address for the sheeva tftpboot 0x0800000 u-boot.kwb nand erase 0x0 0x60000 nand write 0x0800000 0x0 0x60000
After a reset you should be greeted by the new bootloader:
U-Boot 2012.04.01 (Jun 01 2012 - 02:27:06) Marvell-Sheevaplug - eSATA - SD/MMC SoC: Kirkwood 88F6281_A1 DRAM: 512 MiB WARNING: Caches not enabled NAND: 512 MiB NAND read from offset 60000 failed -74 *** Warning - readenv() failed, using default environment In: serial Out: serial Err: serial Net: egiga0 88E1116 Initialized on egiga0 Hit any key to stop autoboot: 0 Marvell>>
As you can see, your old settings are all scrambled. It’s a good idea to save back the MAC address now:
setenv ethaddr F0:AD:4E:01:49:8F saveenv reset
Great! You got a great new and powerful bootloader installed which can also boot from ubifs partitions!
Now it’s time to install Debian. Unfortunately we cannot directly install Debian to Flash because it is not supported by the Debian installer. So we first install it to a USB stick and later move it to Flash.
Installing to USB stick
The installation to stick is basically a total standard installation as explained by the well know HOW-TO at cyrius.com. This is the gist of it:
setenv serverip 172.16.0.187 # IP of your TFTP server setenv ipaddr 172.16.0.15 # IP address for the sheeva tftpboot 0x00800000 uImage tftpboot 0x01100000 uInitrd setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most bootm 0x00800000 0x01100000
Continue the installation to stick and do not change the partition layout. The installation will take some time, go and grab a coffee.
Transferring image to flash
Boot from USB stick
Once the installation has finished and u-boot is booted again it’s time to boot from USB and copy the image to flash.
setenv bootargs_console console=ttyS0,115200 setenv bootcmd_usb 'usb start; ext2load usb 0:1 0x00800000 /uImage; ext2load usb 0:1 0x01100000 /uInitrd' setenv bootcmd 'setenv bootargs $(bootargs_console); run bootcmd_usb; bootm 0x00800000 0x01100000' run bootcmd
This will straightly boot up your Debian installation, so log in with your username and password:
Debian GNU/Linux 6.0 sheevaplug ttyS0 sheevaplug login: user Password: Linux sheevaplug 2.6.32-5-kirkwood #1 Sun May 6 16:57:51 UTC 2012 armv5tel The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. user@sheevaplug:~$
Now it’s time to copy your Debian to Flash. For this you have to become root, either by using su or sudo – depending on the method you choose during installation.
For the installation we still have to format the Flash so let’s install the required software (as superuser):
apt-get install mtd-utils
Now we are able to format the Flash as ubifs and mount it to /mnt/:
ubiformat /dev/mtd2 -s 512 ubiattach /dev/ubi_ctrl -m 2 ubimkvol /dev/ubi0 -N rootfs -m mkfs.ubifs --compr=zlib /dev/ubi0_0 mount -t ubifs ubi0:rootfs /mnt
What is left now is copying all the required data to the newly created ubifs partition:
mkdir /tmp/rootfs mount -o bind / /tmp/rootfs/ cp -a /tmp/rootfs/* /mnt/ cp -a /boot /mnt/
What should also be adapted is the fstab of the Debian installation in Flash at /mnt/etc/fstab. It should look like this:
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 ubi0:rootfs / ubifs defaults,noatime,rw 0 0 tmpfs /var/run tmpfs size=1M,rw,nosuid,mode=0755 0 0 tmpfs /var/lock tmpfs size=1M,rw,noexec,nosuid,nodev,mode=1777 0 0 tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
Setup u-boot to boot from ubi partition
Reboot your Sheeva and enter u-boot. Make u-boot know about your partition setup and set the boot sequence:
# Set uboot to boot from ubi setenv mtdids nand0=orion_nand setenv mtdparts mtdparts=orion_nand:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) setenv bootargs_ubi 'console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs' setenv bootcmd_ubi 'ubi part nand0,2; ubifsmount rootfs; ubifsload 0x1100000 /boot/uInitrd; ubifsload 0x800000 /boot/uImage' setenv bootcmd 'setenv bootargs $(bootargs_ubi); run bootcmd_ubi; bootm 0x00800000 0x01100000' saveenv
Congratulations! You’ve just successfully installed Debian to a modern ubifs partition on your SheevaPlug Flash!
You might experience problems when Debian updates your kernel. This is due to a bug. The best workaround is to remove flash-kernel
apt-get remove flash-kernel
Since the “official” u-boot image is rather outdated now, I’ve build a new one based on git master as of 26.08.2013 (2013.10-rc1-00034-g2b26201) you can get it here. I recommend it over the older u-boot versions. This also fixes problems where the SheevaPlug would not boot from a damaged ubifs partition.