Debian Squeeze on Sheevaplug NAND

March 28, 2010, 6:49 p.m.


CLICK FOR UPDATED INSTRUCTIONS 2010-12-13

I managed to install Debian Squeeze on a Sheevaplug AKA Plugcomputer with minimal bloodshed. Ubuntu 9.10 AKA Karmic is not compatible and Jaunty was feeling stale on non-security packages.

WARNING: You may brick your plug computer. Proceed at your own risk.

If you follow any of the guides I found on doing this, there are essentially two that will get you most of the way there. I wrote this because I spent a couple of hours combining them and reverse-engineering some of the sheevaplug installer.

You will need the JTAG usb/serial adapter that should have shipped with your plug computer. In my case Windows 7 64 bit didn't have a driver but pulled it down from Windows Update and it works great via Putty. 115200 baud 8 bit 1 stop no parity no flow control. The serial port will vary based on your machine, look for the serial port that appears in Device Manager when you plug in the JTAG adapter.

Create your rootfs.tar.gz image by following this README. It is pretty straightforward except that in order to get enough free space you need to have an ext2 partition with 1GB available. For me that meant putting a microSD(in a miniSD adapter) card into the JTAG/USB device. -OR- Just download his pre-made rootfs.tar.gz tarball. His package is probably fine, just remember to do the ssh key step when you are done. When you have this file, copy it to the root of a FAT formatted USB flash drive connected to your PC.

While you are downloading things, get this and extract it to the root of the same flash drive.

Once you have all of the appropriate files on your USB drive, safely disconnect it and insert it into the plug computer's USB port.

Continuing will destroy all data on the plug computer. Backup whatever it is you need first. samba.conf? cups config? home folder?

Attach the serial console if you haven't already and make sure it is talking. Pressing enter should give you a login prompt of your currently installed OS. Reboot your currently installed OS, or because we're nuking it anyway hit the reset button on the JTAG/USB connector.

It will give a countdown to interrupt normal boot really quickly after the reset. Hit your any key to interrupt. You should get the Marvell>> prompt now. Type "version" and look at the Marvell version. If you already know that you have the 3.4.27+pingtoo or better version, skip this section. Otherwise perform these commands:


usb start
fatload usb 0:1 0x0800000 /uboot/uboot.bin

If either of those commands gave you an error, STOP! The next step will brick your device if you do not have the uboot.bin loaded into RAM correctly. It may not be irreversible, but you will not have a good time.

nand erase 0x0 0xa0000
nand write 0x0800000 0x0 0xa0000
reset

Credit to cyrius.com for the info.


Here is where I had absolutely no fun at all. Per the suggestion in the Squeeze rootfs tarball creation I tried to run the Sheevaplug installer version 1.0.0 in Windows 7 x64. If you can get this to work, then I applaud you. The device ID that is hard-coded five folders deep in the openocd config file is wrong. In short it is really made for 32 bit versions of Linux or Windows XP and not much else. It took me an hour to accept this truth, learn from my mistake grasshopper.


How to really do it. This doesn't require running a debugger and doing a DCC transfer into NAND with a PHP? "shell" script and whatnot. Which I mean...php-cli required to do a firmware flash? What?

Once you have performed the above steps you should be able to perform these commands and be running Debian Squeeze on your plug computer. Be sure to change ethaddr to the MAC address printed on your plug computer. The MAC below is a private MAC, don't use it. Copy and paste these lines one at a time into the serial Marvell console. Trying to paste the whole shebang will end up with gibberish as your serial buffer overflows. That is potentially catastrophic depending on what commands it took.

setenv bootargs_root 'ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs'
setenv ethaddr 'ac:de:48:00:00:01'
setenv mtdpartitions 'mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)'
setenv bootargs_console 'console=ttyS0,115200'
setenv rootinfo 'root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand'
setenv real_bootcmd 'setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000'
setenv bootcmd 'run recover1'
setenv recover1 'setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset'
setenv recover2 'run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) $(rootinfo); bootm 0x00800000 0x01100000'
setenv recover3 'run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000'
setenv recover4 'usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd'
saveenv
reset

Do not interrupt the startup and install That last command will reboot the device and run through the commands starting at bootcmd. This was taken from the sheevaplug installer and modified to actually work from the serial console. If you read the last few commands you can see what it is doing: recover1, reboot, recover4,3,2, reboot DEBIAN!

Don't forget to change your SSH key.


ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

and to change the root password from the default of 'nosoup4u'

Have fun.


tags( #linux #sheevaplug )

Code

Various Coding and Scripting Endeavors

Life

Whats going on generally.

Neat Stuff

Things I have found useful or interesting on the internet, for what it is worth.

Follow caller9com on Twitter