SheevaPlug and OpenRD
To following these instructions you need to:
- understand how to compile your own custom kernel
have experience of using a TFTP server and installed a running one (I recommend 'tftpd-hpa')
- read through:
- have a cross-compiler already installed (I recommend you use the one from emdebian)
installed 'git-core' and run: 'git config --add user.name "Firstname Surname"; git config --add user.name me@example.com'
Building
The Kernel
As well as the toolchain and the usual kernel building dependencies, you will need to make sure you have 'uboot-mkimage' installed so that you can generate suitable kernels that uboot can run:
$ mkdir /usr/src/kirkwood $ cd /usr/src/kirkwood $ echo 'alias amake="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make"' > cross-compile $ git clone git://git.marvell.com/orion.git $ cd orion $ . ../cross-compile $ amake kirkwood_defconfig $ # I recommend you disable module support unless you know what you are doing $ amake menuconfig $ amake uImage
Now this is done, copy '/usr/src/kirkwood/arch/arm/boot/uImage' to '/srv/tftp'.
The Root Filesystem
This is a case of pretty much just following the instructions on my TS-78xx Debian Installer with the following clauses:
instead of building everything in '/usr/src/build/' it will be going into '/usr/src/kirkwood/build/'
add to the 'apt-get install ...' line the package 'mtd-utils'
you need to replace the '/' mountpoint line in 'rootfs/etc/fstab' with instead: 'ubi0:rootfs / ubifs relatime 1 1'
stop just before you would get to the 'mkfs.jffs' command, as we are using UBIFS the rest of the page is not relevant
[snipped editing of ubi.cfg] # cat ubi.cfg ---- [ubifs] mode=ubi image=ubifs.img vol_id=0 vol_size=128MiB vol_type=dynamic vol_name=rootfs vol_flags=autoresize ---- # mkfs.ubifs -v -r rootfs -m 2048 -e 129024 -c 4096 -o ubifs.img -x zlib # ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubi.cfg
Burning to the NAND
Annoying it turns out that u-boot cannot deal with the ECC bytes used on NAND so that if you were to flash the filesystem in u-boot, Linux is unable to use it thinking that all the data has been corrupted beyond repair. This unfortunately means we have to use a USB key ('/dev/sdb') to temporarily store a root filesystem (and install 'mtd-utils') that can then be used to burn a root filesystem to the NAND; maybe a newer u-boot does support this, but as this is a once off event, why bother risking yourself timewise having to do more work (for example with JTAGing).
I normally am an XFS-fanatic, however it does not work under ARM I use JFS instead which is stable, very reliable and good on systems that do not have much 'fire power'.
# mkfs.jfs /dev/sdb # mkdir usb # mount /dev/sdb usb # cp -a rootfs/* usb # cp ubi.img usb [snipped amending '/' mount entry in usb/etc/fstab] # grep sda usb/etc/fstab ---- /dev/sda / jfs relatime 1 1 ---- # umount usb
Now unplug the USB key from your workstation and plug it into your new toy.
You have to save the environment variables to use them here (reverted1 with 'resetenv' for factory defaults though):
Hit any key to stop autoboot: 3 <---- hit key Marvell>> setenv mainlineLinux yes Marvell>> setenv arcNumber 2097 <---- for an OpenRD-Client use 2361 Marvell>> setenv bootargs console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw Marvell>> saveenv Marvell>> nand erase 0x100000 0x400000 Marvell>> tftp 0x2000000 uImage [snipped] done Bytes transferred = 1865728 (1c7800 hex) Marvell>> nand write.e 0x2000000 0x100000 0x[INSERT-HERE-HEX-SIZE-ABOVE] <--- my example it would be '1c7800' Marvell>> reset Hit any key to stop autoboot: 3 <---- hit key Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sda rootdelay=10 rw Marvell>> run bootcmd
N.B. on my toy u-boot had been primed so that the TFTP server has the IP address '10.4.50.5' and the OpenRD had the IP address '10.4.50.165' (netmask '255.255.255.0'). On my workstation I typed 'ip addr add 10.4.50.5/24 dev wlan0' to trivially configure the network card (this just adds a second subnet to your NIC, so it should not break existing connectivity). For the SheevaPlug I had to use 'ip addr add 10.10.0.2/24 dev wlan0' as the server IP was '10.10.0.2' and client IP was set to '10.10.0.1' (netmask '255.255.255.0')
You should now be staring at a login prompt, you should be able to log in as 'root' with no password. If this is the first time with your box, you should set the time to something vaguely sane (then use 'chrony', 'openntpd' or 'ntpd' later on) so that tinkerings to the filesystem do not have a 'mad' date, type 'date' on your own workstation and paste it in below.
# date -s '[DATE-OUTPUT-FROM-WORKSTATION]'
Now erase and burn your NAND flash space (do not worry about any bad blocks errors, it is all quite normal and expected):
# flash_eraseall /dev/mtd2 # nandwrite -p /dev/mtd2 /ubi.img # reboot
After a reboot you should find you have a completely primed and ready for action NAND booting Debian toy to play with.
originally set on the SheevaPlug to 'bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none' whilst on the OpenRD-Client to 'console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw ubi.mtd=1,2048 root=ubi0:rootfs rootfstype=ubifs' (1)