Monthly Archives: March 2016

Upgrading Debian on the Sheevaplug

Starting point: Sheevaplug running Debian 7.9 on an ubifs filesystem.

See the installation notes for Jessie.

Step 1: Create a backup.
I want to create the backup when the partitions to backup are not mounted.
Step 1.1: Prepare a boot environment
Get uImage and uInitrd as described on the Sheevaplug installation page:
wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/netboot/marvell/sheevaplug/uImage
wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/netboot/marvell/sheevaplug/uInitrd
md5sum u*
f05abb9a8cc619fff9bf2d585dc4b231 uImage
da2240f621404712a908dbc9593c3bda uInitrd

Step 1.2: Reboot into u-boot
Within u-boot:

usb start
fatload usb 0:1 0x00800000 /uImage
fatload usb 0:1 0x01100000 /uInitrd
setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
bootm 0x00800000 0x01100000

Run the installer, for locale “C”. Use the manual network configuration. Pick a suitable Debian mirror. Give usernames and passwords. When the partition disks appears, go to ‘Go Back’
** mount -t ubifs rootfs /x does not work.
** Mount the usb to /x: mkdir /x;mount -t /dev/sda1 /x
** dd if=/dev/mtd2ro of=/x/mtd2ro
Copy the file to the PC and verify whether it can be read (based on UBIFS documentation:

modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15 overridesize=12
modprobe ubi mtd=0
ubidetach /dev/ubi_ctrl -m 0
ubiformat /dev/mtd0 -f mtd2ro
ubiattach /dev/ubi_ctrl -m 0
mkdir x
mount -t ubifs ubi0 x

During @apt-get upgrade@, the disk was full.
mount –bind /y/usr/usr /usr
mount –bind /y/lib/lib /lib
Then remove /lib with @rm -fr /lib@
ARGS! All command depend on /lib… Restore it with:
/y/lib/lib/ld-linux.so.3 –library-path /y/lib/lib:/y/lib/lib/arm-linux-gnueabi /bin/mkdir /lib
/y/lib/lib/ld-linux.so.3 –library-path /y/lib/lib:/y/lib/lib/arm-linux-gnueabi /bin/cp /y/lib/lib/ld-linux.so.3 /lib
/y/lib/lib/ld-linux.so.3 –library-path /y/lib/lib:/y/lib/lib/arm-linux-gnueabi /bin/cp /y/lib/lib/arm-linux-gnueabi /lib/ -ax


Accessing ubifs from within the Sheevaplug

mkdir /xx
cd /xx
wget http://ftp.debian.org/debian/pool/main/l/linux/linux-image-3.2.0-4-ixp4xx_3.2.78-1_armel.deb
ar x linux-image-3.2.0-4-ixp4xx_3.2.78-1_armel.deb
xzcat data.tar.xz | tar x

wget http://ftp.debian.org/debian/pool/main/l/linux/linux-image-4.13.0-1-marvell_4.13.13-1_armel.deb
ar x linux-image-4.13.0-1-marvell_4.13.13-1_armel.deb
xzcat data.tar.xz | tar x
depmod -b /xx
modprobe -d /xx ubi

wget http://ftp.de.debian.org/debian/pool/main/m/mtd-utils/mtd-utils_1.5.1-1_armel.deb
mkdir mtd-utils
cd mtd-utils/
ar x ../mtd-utils_1.5.1-1_armel.deb
xzcat data.tar.xz | tar x

modprobe -d /xx ubifs

-> fails: UBIFS error (pid 3918): cannot initialize compressor zlib, error -2

 

wget http://security.debian.org/debian-security/pool/updates/main/l/linux/linux-image-3.16.0-4-ixp4xx_3.16.7-ckt20-1+deb8u4_armel.deb
ar x linux-image-3.16.0-4-ixp4xx_3.16.7-ckt20-1+deb8u4_armel.deb
xzcat data.tar.xz > data.tar
mkdir data
cd data

8 tar xf ../data.tar ./lib/modules/3.16.0-4-ixp4xx/kernel/fs/ubifs/ubifs.ko
10 tar xf ../data.tar ./lib/modules/3.16.0-4-ixp4xx/kernel/drivers/mtd/ubi/ubi.ko
12 modprobe ./lib/modules/3.16.0-4-ixp4xx/kernel/fs/ubifs/ubifs.ko
13 modprobe ./lib/modules/3.16.0-4-ixp4xx/kernel/drivers/mtd/ubi/ubi.ko

wget http://ftp.de.debian.org/debian/pool/main/m/mtd-utils/mtd-utils_1.5.1-1_armel.deb
mkdir mtd-utils
cd mtd-utils/
ar x ../mtd-utils_1.5.1-1_armel.deb
xzcat data.tar.xz > data.tar
cd usr/sbin
./ubiattach -m 2
mount -t ubifs ubi0 /y

Restoring a backup:
./ubidetach -m 2
./ubiformat /dev/mtd2 -f /media/mtd2ro
./ubiattach -m 2
dmesg | tail -20
mount -t ubifs ubi0 /y
ls /y

Sheevaplug and power loss

After a power loss, the Sheevaplug did not start up any more.
After some fiddling, I got it to work (ubifs needed to be mounted)
Then…
I attempted to upgrade U-Boot.
I wasn’t prepared to do a lot of migrating and attempted to downgrade and flashed U-Boot with garbage.

With Debian 6 I was able to run openocd and reflash U-Boot, as described here:

This will reflash the plug with a new U-Boot called uboot.bin (this is the .bin file and not ELF and the name must be uboot.bin).

> cd
> openocd -f /usr/local/lib/openocd/board/sheevaplug.cfg -c init -c sheevaplug_reflash_uboot -c exit

Wait 1.5 minutes.

It needs to be an older version of Debian, because the newest version rejects the JTAG part of the USB connection.