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.

Bulk conversion of audio files

My MP3 player needs MP3 files (hence the name).

The following snippets use gstreamer in a for loop.

Convert *.flac to *.mp3:
Original script here

for song in *.flac ; do gst-launch filesrc location="$song" ! flacdec ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.flac/.mp3}" ; done

Convert *.ogg to *.mp3:

for song in *.ogg ; do gst-launch filesrc location="$song" ! decodebin2 ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.ogg/.mp3}" ; done

Convert *.wav to *.mp3:

for song in *.wav ; do gst-launch filesrc location="$song" ! decodebin2 ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.wav/.mp3}" ; done

Required packages:
gstreamer-tools, gstreamer0.10-plugins-ugly

Prepare a package (Pioneers) for a Debian i18n-release

Pioneers needs an i18n update, but Debian is in deep freeze, so only i18n related patches (and security patches) will be accepted.

  • Get all patches:
    gawk 'BEGIN { i=1812; while (i < 1844) { print "svn diff -r " (i-1) ":" i " > svn" i ".patch"; i++ }}' | sh
  • Review the patches and remove all non-i18n, non-security related patches
  • Prepare the repository, go to the moment of the last release:
    svn update -r 1812
  • Fetch all updates to the debian packaging:
    cd debian;svn update
  • Prepare quilt as instructed in the Debian wiki:
    export QUILT_PATCHES=debian/patches
    export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
  • Prepare quilt:
    quilt push -a
  • Apply each relevant patch:
    quilt new svn1819.diff
    lsdiff svn1819.patch | xargs quilt add
    quilt remove ChangeLog
    patch -p0 -i svn1819.patch
    quilt refresh
    quilt header --dep3 -e
      Description: as in the ChangeLog
      Author: as in the ChangeLog
      Origin: upstream
      Applied-upstream: svn revision 1819
  • End quilt:
    quilt pop -a
  • Add all patches to svn
  • Start the release cycle

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.

Encrypted store with EncFs for GPG keys

Information is gathered from: here and here.

  1. Preparation
    1. Become a member of the fuse group
      sudo adduser your_username fuse
      newgrp - fuse
    2. Create a directory for the encrypted files (on the remote storage)
    3. Create a mount point (somewhere in home)
  2. Create the encrypted system/Mount the encrypted system
    encfs folder_to_mount mount_point
  3. Use it
  4. Umount
    fusermount -u mount_point
  1. Create signing subkey
    gpg --edit-key 0xFFFFFFFF
    addkey
  2. Backup the key
    gpg --export 0xFFFFFFFF > publickey.gpg
    gog --export-secret-keys > secretkeys.gpg
    gpg --export-secret-subkeys > secretsubkeys.gpg
  3. Set the gnupg environment to the encrypted location
    export GNUPGHOME=mount_point
  4. Unset the gnupg environment
    unset GNUPGHOME
  5. Remove the private key for the master
    gpg --delete-secret-keys 0xFFFFFFFF
  6. Check that the private key is removed
    gpg --edit-key 0xFFFFFFFF
    gpg addkey

    Adding the subkey should fail
  7. Re-import the secret key
    gpg --import secretkey.gpg
  8. Send the key to the keyserver
    gpg --send-key 0xFFFFFFFF

Downloaden van alle foto’s van mijnalbum.nl

Zie http://keeshink.blogspot.nl/2008/09/fotos-downloaden-van-mijnalbumnl.html voor het oorspronkelijke artikel

 

Installeren: python-lxml

Daarna dit script draaien met als argument het album-id (kijk in http://www.mijnalbum.nl/Album=[AlbumID]U&Foto=[FotoID])

#!/usr/bin/python

import sys
from lxml import etree
from lxml import objectify
from urllib import urlopen

# pass the album id as a command line argument
album_id = sys.argv[1]
thumbs_url = 'http://www.mijnalbum.nl/index.php?m=albumview&a=2&key='
thumbs_url += album_id

parser = etree.HTMLParser()
page = urlopen(thumbs_url)
html = page.read()

htmltree  = etree.HTML(html)

for element in htmltree.xpath("body/table/tr/td[@class='thumbfoto']"):
    id = element.get('id')
    to_be_stripped = 'thumbcont-'
    foto_id = id.replace(to_be_stripped,'',1)
    foto_url = 'http://www.mijnalbum.nl/GroteFoto-'+foto_id+'.jpg'
    print foto_url

Daarna de uitvoer omleiden met xargs wget

QWare TB-1217 tablet USB drivers for Windows

When the tablet is initially connected to Windows, it will not be detected as an Android device.

To enable the device to be accessed from the Android SDK:

  • Install the Google USB driver from the Android Manager
  • Add the following lines in %Program Files%\Android\android-sdk\extra\google\usb-driver\android_winusb.inf in the section [Google.NTx86]:
    ; QWare tablet
    %SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0003
    %CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0003&MI_01
  • Reboot
  • The tablet is now correctly recognized as an Android device