Tag Archives: sheevaplug

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.

Connecting a DVB-T stick to the SheevaPlug

The stock Debian kernel (2.6.32-5-kirkwood) does not have the kernel module for the DVB-T stick with USB-ID: 1d19:1102 (Aldi) or 0ccd:00d7 (Terratec TStick+). I’ve use the following steps from the description by Dionysios Fragkopoulos:

  • Install the kernel headers:
    # aptitude install linux-headers-`uname-r`
  • Install the requirements:
    # aptitude install patchutils libproc-processtable-perl wget bzip2
  • Get the source code:
    $ git clone git://linuxtv.org/media_build.git
  • Build it:
    $ ./build
    Note: It takes more than 630MiB, so extra disk space must be attached to the SheevaPlug (non-FAT partition)
  • Copy the modules to the kernel path (manually, because I want to save disk space on the root partition):
    # cp rtl283?.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
    # cp dvb-usb-rtl28xxu.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
    # cp dvb_usb_v2.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
  • Update the module list:
    # depmod -a
  • Plug in the usb device

It works!
The /dev/dvb/adapter0 devices are now present.

Next steps to write in the blog:

  1. Configure the stick
  2. Configure PVR software

Use a regular Debian kernel on the Sheevaplug

A long time ago I found information about installing ubifs on the Sheevaplug.
However, it used a non-Debian kernel. This port describes the steps to boot from a regular Debian kernel.

The information used is found here, here, here and here.

$ dpkg-reconfigure linux-image-2.6.32-5-kirkwood
A warning is issued about the name of the root device ubi0:rootfs
$ flash-kernel
It doesn’t write to the flash memory, but generates /boot/uImage and /boot/uInitrd

The following environment is used in U-Boot (version 2011.12):

baudrate=115200
bootargs=console=ttyS0,115200 mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs) rw ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
bootcmd=run bootubi
bootdelay=3
bootnand=${x_bootcmd_kernel}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; ${x_bootcmd_usb}; ${x_bootcmd_sata}; bootm 0x6400000;
bootubi=run x_bootcmd_ubi; run x_bootcmd_regular; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x800000 0x1100000;
ethact=egiga0
ethaddr=XX:XX:XX:XX:XX:XX
mtddevname=uImage
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x0500000(rootfs)
partition=nand0,0
stderr=serial
stdin=serial
stdout=serial
x_bootargs=console=ttyS0,115200 mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs) rw
x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000
x_bootcmd_regular=setenv mainlineLinux yes; setenv arcNumber 2097;
x_bootcmd_sata=ide reset;
x_bootcmd_ubi=ubi part nand0,1; ubifsmount rootfs; ubifsload 0x800000 /boot/uImage; ubifsload 0x1100000 /boot/uInitrd;
x_bootcmd_usb=usb start;

In order to use the setenv command, the $ and ; must be escaped with a backslash.The highlighted parts are the parts I needed for a correct boot.