Installing Debian Jessie on RaidSonic ICY BOX IB-NAS6210

After quite some time using Debian Squeeze on the 6210 box, I finally managed to re-install the machine using Debian Jessie. Last time, I used an installation copied from a Sheevaplug. This time, I wanted to do a clean install using the Debian Installer. Basically, this works well since support for the 6210 is now part of the standard kernel. However, Debian does not support the 6210 as an official installation target. This necessitates a couple of special steps during the installation.

The following is based on Martin Michlmayr’s guides to setup U-Boot and Debian on other Kirkwood machines.

You will need a serial connection to your box, see here how to do this. Debian will not be installed on the internal NAND flash, thus you need an USB stick or a hard disk to store the operating system. However, following the steps below requires to update the U-Boot boot loader which is stored on flash.

Update U-Boot

I like to have a modern U-Boot and I will make use of new features in the description below. Additionally, the kirkwood-ib62x0.dts in the Linux kernel assumes the flash layout of the current upstream U-Boot and not the one of the original U-Boot.

Warning: The new U-Boot is bigger than the old one and has a different default layout of the MTD partitions. Flashing a newer U-Boot will overwrite the original firmware of the device (that is, not only the old U-Boot but also the original operating system). Thus, you must be sure that you are not going to need it again. Additionally, flashing is always a risky operation that may brick your device. You have been warned. Don’t make me responsible for any damage you do.

Boot into current U-Boot and save the environment

Start your favorite terminal program (I use minicom). Power on the box and abort the standard U-Boot boot procedure by hitting Enter when prompted.

Before updating, it makes sense to store the values stored in the current U-Boot environment. Use the printenv command to do this:

printenv

and save the output for later reference.

Especially, there will be the Ethernet MAC address somewhere (it should also be printed on a label on the bottom side of the IB-NAS 6210):

ethaddr=00:02:E4:14:1F:39

Compile an U-Boot 2016.09

We will need two things:

  1. U-Boot (in the form of an u-boot.kwb image)
  2. The kwboot tool to boot from the serial port.

If you are compiling on an ARM box:

git clone git://git.denx.de/u-boot.git
cd u-boot
git checkout v2016.09
make ib62x0_defconfig
make all

On an Fedora 24 x86-64 box: (On other distributions, you will have to
find out how to install an ARM cross-compiler)


sudo dnf install arm-none-eabi-gcc-cs
git clone git://git.denx.de/u-boot.git
cd u-boot
git checkout v2016.09
export CROSS_COMPILE=arm-none-eabi-
make ib62x0_defconfig
make all

You should end up with a ‚u-boot.kwb‘ file in the root directory of
the repository and the ‚kwboot‘ tool at ‚tools/kwboot‘.

If you don’t want to compile yourself, here is the ‚u-boot.kwb‘ I obtained: u-boot.kwb SHA256 of this file should be 2b71dda5877959dc6e67946b0b93dc0d897354fda17ca38637836c22f1a04a36)

Try it:

./tools/kwboot

Will print something like this:

Usage: kwboot [OPTIONS] [-b | -D ] [-B ]

-b : boot with preamble (Kirkwood, Armada 370/XP)
-p: patch to type 0x69 (uart boot)
-D : boot without preamble (Dove)
-d: enter debug mode
-a: use timings for Armada XP
-q : use specific request-delay
-s : use specific response-timeout
-o : use specific xmodem block timeout

-t: mini terminal

-B : set baud rate

Boot the new U-Boot via UART and flash it

Although not required, I like to verify that a newly compiled U-Boot
actually works before flashing it. Since Kirkwood SoCs have a UART
boot mode, we can boot the new U-Boot via the serial console. (Note: I
couldn’t get it to work reliably with my USB to serial adapter. you may need a
good USB to serial adapter or a real serial port for this to work.)

After booting the new U-boot works, we will use it to flash the new
U-Boot. In order to do this, put the ‚u-boot.kwb‘ file onto a tftp server
or on an USB stick (ext2 filesystem on first partition).

To boot, turn off your NAS box first and start kwboot like this:

./u-boot/tools/kwboot -B 115200 -t -b u-boot.kwb -p /dev/ttyS0

It waits for the box to come up. When you turn on the box, it should
begin to upload the image (might need a couple of tries):


Sending boot message. Please reboot the target...\
Sending boot image...
0 % [......................................................................]
1 % [......................................................................]
3 % [......................................................................]
5 % [......................................................................]
7 % [......................................................................]
8 % [......................................................................]
10 % [......................................................................]
12 % [......................................................................]
14 % [......................................................................]
15 % [......................................................................]
...
99 % [...........................]
[Type Ctrl-\ + c to quit]
U-Boot 2016.09 (Sep 15 2016 - 21:35:39 +0200) RaidSonic ICY BOX IB-NAS62x0

SoC: Kirkwood 88F6281_A1
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
Error: egiga0 address not set.

IDE: ide_preinit failed
Hit any key to stop autoboot: 0
ib62x0 =>

Flash from TFTP server

Use the following commands to flash the image (obviously, you will
have to adapt the IP addresses…)


setenv serverip 192.168.24.1
setenv ipaddr 192.168.24.12
tftpboot 0x800000 u-boot.kwb

Warning: The following nand commands will overwrite parts of the original firmware and render it unusable. Don’t do this if you still want to use the original software that comes with the system. If you don’t flash the new U-Boot, the remainder of the installation won’t work.


nand erase 0x0 0xe0000
nand write 0x800000 0x0 0xe0000

Alternative flash from USB stick

Plug in the stick and boot the new U-Boot via UART as explained above


usb start
ext2load usb 0:1 0x0800000 u-boot.kwb

Warning: The following nand commands will overwrite parts of the original firmware and render it unusable. Don’t do this if you still want to use the original software that comes with the system. If you don’t flash the new U-Boot, the remainder of the installation won’t work.


nand erase 0x0 0xe0000
nand write 0x800000 0x0 0xe0000

Setup the environment including MAC address

Reboot:

reset

It should boot into the new U-Boot:

U-Boot 2016.09 (Sep 15 2016 - 21:35:39 +0200) RaidSonic ICY BOX IB-NAS62x0

SoC: Kirkwood 88F6281_A1
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: egiga0
Error: egiga0 address not set.

IDE: ide_preinit failed
Hit any key to stop autoboot: 0
ib62x0 =>

We don’t have the MAC address set and no valid environment in the flash. To change this (again: Use your own MAC address here that you saved before, not the one below):


setenv ethaddr 00:02:E4:14:1F:39
saveenv
reset

Boots into U-Boot without complaining about the „Net“:

U-Boot 2016.09 (Sep 15 2016 - 21:35:39 +0200) RaidSonic ICY BOX IB-NAS62x0

SoC: Kirkwood 88F6281_A1
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
IDE: ide_preinit failed
Hit any key to stop autoboot: 0
ib62x0 =>

Congrats, you have a shiny U-Boot 2016.09 on your machine now.

Prepare a Kernel for the Debian Installer

Since our U-Boot can boot using a DTB, we simply take a kernel of the Debian installer and provide our own DTB.

Unfortunately, these kernels have appended DTBs and these seem to take
precedence to a DTB provided by the boot loader. I couldn’t find a the
stock vmlinuz kernel image from which the „uImage“ files available for
the Debian install were generated. Thus, I chopped off the DTB of one of these images (if you don’t want to do this yourself, there is a download link below. However, that file may be outdated depending on when you read this.):

Get kirkwood images for Sheevaplug eSATA:

wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/netboot/marvell/sheevaplug-esata/uImage
wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/netboot/marvell/sheevaplug-esata/uInitrd

The SHA256 of the files I downloaded were (if they have been updated in the meantime, they may of course differ. I downloaded mine on September 17, 2016):


512c928f708fa01e0c5c16be128bae0f83c63fc6f6d5288a868d97aadfdbed23 uImage
c6662ff220f0db3cc325221d1d4644b294464cee51fce3c6879928380d9b7bf1 uInitrd

And the correct DTBs:

wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/device-tree/kirkwood-ib62x0.dtb
wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/device-tree/kirkwood-sheevaplug-esata.dtb

SHA256s if the files I downloaded:


55491d45094d3b3ac76d5ce700f4d368affb33277ca7fc8701fc8e1db4254300 kirkwood-ib62x0.dtb
e3c532f5714442840bfb4b14b17e4cf01f8033ee12e321d1fdcf7dc5a193db10 kirkwood-sheevaplug-esata.dtb

Chop off the first 64 Bytes of uImage to remove the image Header


dd if=uImage of=vmlinuz-sheevaplug-esata bs=64 skip=1

Find out the size of the DTB that should have been appended to that image:


ls -l kirkwood-sheevaplug-esata.dtb

Output:


-rw-rw-r--. 1 baatz baatz 10361 Sep 14 00:48 kirkwood-sheevaplug-esata.dtb

If that DTB has been appended, the last 10361 bytes should be the DTB:


tail -c 10361 vmlinuz-sheevaplug-esata | cmp kirkwood-sheevaplug-esata.dtb

This should report no differences (i.e. print nothing). Chop off the
10361 of the appended DTB to get the original vmlinuz image:


head -c -10361 vmlinuz-sheevaplug-esata > vmlinuz-kirkwood

And make an uImage:


mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d vmlinuz-kirkwood uImage-kirkwood

If you don’t want to do these steps yourselve, download is at: http://simon.baatz.info/downloads/uImage-kirkwood

SHA256 of my version:


4cd8b2d1cd0062f835b9ee3668466c827686b1ffd12ff8c897436c5c0253a090 vmlinuz-kirkwood

Put „uImage-kirkwood“, „uInitrd“, and „kirkwood-ib62x0.dtb“ on a TFTP Server.

Install Debian

Boot into the U-Boot command line and enter (of course, you will need to change the IP addresses to match your network setup):


setenv serverip 192.168.24.1
setenv ipaddr 192.168.24.12
tftpboot 0x00800000 uImage-kirkwood
tftpboot 0x010f0000 kirkwood-ib62x0.dtb
tftpboot 0x01100000 uInitrd

Set the kernel command line arguments and boot the kernel with the DTB:


setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
bootm 0x00800000 0x01100000 0x010f0000

Debian installer should come up. There is no need to have a dedicated
„/boot“ partition as long as your root partition is plain ext4 (the
default) and is on a device that is readable by U-Boot.

During the installation the installer will complain that it can’t find
a suitable kernel. We will fix this later; tell the installer to
continue without one:


lqqqqqqqqqqqqqqqqqqqqu [!] Install the base system tqqqqqqqqqqqqqqqqqqqqk
x x
x No installable kernel was found in the defined APT sources. x
lx x
xx You may try to continue without a kernel, and manually install your x
xx own kernel later. This is only recommended for experts, otherwise you x
xx will likely end up with a machine that doesn't boot. x
xx x
xx Continue without installing a kernel? x
mx x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Also, the installer will warn you that no boot loader has been installed:


lqqqqqqqqqqqqqqqqqu [!] Continue without boot loader tqqqqqqqqqqqqqqqqqqk
x x
x No boot loader installed x
x No boot loader has been installed, either because you chose not to or x
x because your specific architecture doesn't support a boot loader yet. x
x x
x You will need to boot manually with the kernel on partition x
x /dev/sda1 and root=/dev/sda1 passed as a kernel argument. x
x x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Just continue.

Caution: When you see this, press Escape


lqqqqqqqqqqqqqqqqqqqu [!!] Finish the installation tqqqqqqqqqqqqqqqqqqqqk
x x
x Installation complete x
x Installation is complete, so it is time to boot into your new system. x
x Make sure to remove the installation media (CD-ROM, floppies), so x
x that you boot into the new system rather than restarting the x
x installation. x
x x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

In the menu select „Execute a shell“:


lqqqqqqqqqu [!] Debian installer main menu tqqqqqqqqqk
x x
x Choose the next step in the install process: x
x x
x Choose a mirror of the Debian archive x
x Download installer components a x
x Set up users and passwords a x
x Configure the clock a x
x Detect disks a x
x Partition disks a x
x Install the base system a x
x Configure the package manager a x
x Select and install software a x
x Continue without boot loader a x
x Finish the installation a x
x Change debconf priority a x
x Save debug logs x
x Execute a shell a x
x Abort the installation x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

The target partition should already be mounted under /target. Let’s start a chroot:


mount -o bind /proc /target/proc
mount -o bind /dev /target/dev
mount -o bind /var/lock /target/var/lock
chroot /target /bin/bash

In the chroot:


aptitude install linux-image-kirkwood

Your /boot directory should now contain a vmlinuz image and an initial ramdisk:


ls /boot

Should output something like:


System.map-3.16.0-4-kirkwood initrd.img-3.16.0-4-kirkwood
config-3.16.0-4-kirkwood vmlinuz-3.16.0-4-kirkwood

Next install flash-kernel:


aptitude install flash-kernel

However, it will complain that the platform is not known:


flash-kernel

Gives:


Unsupported platform.

Add the machine description to /etc/flash-kernel/db :


cat >> /etc/flash-kernel/db <<EOF
Machine: RaidSonic ICY BOX IB-NAS62x0 (Rev B)
Kernel-Flavors: kirkwood
DTB-Id: kirkwood-ib62x0.dtb
DTB-Append-From: 3.12
U-Boot-Kernel-Address: 0x00008000
U-Boot-Initrd-Address: 0x0
Boot-Kernel-Path: /boot/uImage
Boot-Initrd-Path: /boot/uInitrd
Boot-DTB-Path: /boot/dtb
Required-Packages: u-boot-tools
EOF

Unfortunately, the booted kernel does not seem to provide the necessary information about the machine id (?). For now, let’s force the machine id by writing the machine id to `/etc/flash-kernel/machine`:


echo "RaidSonic ICY BOX IB-NAS62x0 (Rev B)" > /etc/flash-kernel/machine


flash-kernel

Now, there should be an uImage and an uInitrd in the /boot directory. Output of ls /boot:


System.map-3.16.0-4-kirkwood initrd.img-3.16.0-4-kirkwood
config-3.16.0-4-kirkwood uImage
dtb uInitrd
dtb-3.16.0-4-kirkwood vmlinuz-3.16.0-4-kirkwood
dtb.bak

As the last step in the chroot, let’s find out the UUID of the root device:


cat /etc/fstab

Should print something like:


cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# # / was on /dev/sda1 during installation
UUID=0a2cfabe-507f-4797-841f-4fbf608c7b14 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=cc2c5e00-ef52-43a5-a9d4-63dc3923340c none swap sw 0 0

Save the UUID of the root partition for later use (in the example it is „0a2cfabe-507f-4797-841f-4fbf608c7b14“)
Use „exit“ to exist the chroot. Unmount our mounts


umount /target/proc
umount /target/dev
umount /target/var/lock

Use „exit“ to exit the shell and get back to the Debian installer menu.

Select „Finish the installation“ and this time, choose „Continue“ to reboot.
Press any key to stop U-Boot.

We need to set the variables needed to boot. Here I boot from the
first partition of the first IDE device. Additionally, you will need to adapt the UUID.


setenv bootargs_console console=ttyS0,115200
setenv bootargs_root root=UUID=0a2cfabe-507f-4797-841f-4fbf608c7b14
setenv bootcmd_usb 'usb start; ext2load usb 0:1 0x00800000 /boot/uImage; ext2load usb 0:1 0x01100000 /boot/uInitrd'
setenv bootcmd_ide 'ext2load ide 0:1 0x00800000 /boot/uImage; ext2load ide 0:1 0x01100000 /boot/uInitrd'
setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_root}; run bootcmd_ide; bootm 0x00800000 0x01100000'
saveenv

Reboot using „reset“

Log in as „root“. Try to get the machine id:


cat /proc/device-tree/model

Should print:


RaidSonic ICY BOX IB-NAS62x0 (Rev B)

Looks good. We don’t need to force the machine id anymore:


rm /etc/flash-kernel/machine

Run flash-kernel again:


flash-kernel

Reboot to verify that everything still works.

10 Gedanken zu „Installing Debian Jessie on RaidSonic ICY BOX IB-NAS6210

  1. Hi,
    I’m stuck in a force machine Id step.
    What I must write after “ cat >> /etc/flash-kernel/db /etc/flash-kernel/machine“ and „flash-kernel“ I got the same first error: „Unsupported platform“
    Where am I wrong?

    1. Hi,
      I’m stuck in a force machine Id step.
      What I must write after „cat >> /etc/flash-kernel/db /etc/flash-kernel/machine“
      and „flash-kernel“ I got the same first error:
      „Unsupported platform“
      Where am I wrong?

    1. The „cat >> /etc/flash-kernel/db < " was not complete (the encoding was wrong and the command did not show correctly the page). I fixed it and it should be ok, see above. The machine description that need to be appended to "/etc/flash-kernel/db" is:
      Machine: RaidSonic ICY BOX IB-NAS62x0 (Rev B)
      Kernel-Flavors: kirkwood
      DTB-Id: kirkwood-ib62x0.dtb
      DTB-Append-From: 3.12
      U-Boot-Kernel-Address: 0x00008000
      U-Boot-Initrd-Address: 0x0
      Boot-Kernel-Path: /boot/uImage
      Boot-Initrd-Path: /boot/uInitrd
      Boot-DTB-Path: /boot/dtb
      Required-Packages: u-boot-tools

      Thanks for pointing this out and sorry for the confusion.

  2. And obviously after
    echo „RaidSonic ICY BOX IB-NAS62x0 (Rev B)“ > /etc/flash-kernel/machine“
    and „flash-kernel“ I got the same first error:
    Unsupported platform
    Where am I wrong?
    Sorry for the multi message but the box don’t show what I really wrote

  3. Oh Yes! Now flash-kernel work properly. Thank you so much!
    But now the board can’t start the OS. Here the sreen:
    ——————————————————————–
    U-Boot 2016.09 (Nov 04 2016 – 20:56:25 +0100) RaidSonic ICY BOX IB-NAS62x0

    SoC: Kirkwood 88F6281_A1
    DRAM: 256 MiB
    WARNING: Caches not enabled
    NAND: 256 MiB
    In: serial
    Out: serial
    Err: serial
    Net: egiga0
    IDE: ide_preinit failed
    Hit any key to stop autoboot: 0
    starting USB…
    USB0: USB EHCI 1.00
    scanning bus 0 for devices… 3 USB Device(s) found
    scanning usb for storage devices… 1 Storage Device(s) found
    2083397 bytes read in 249 ms (8 MiB/s)
    10009620 bytes read in 767 ms (12.4 MiB/s)
    ## Booting kernel from Legacy Image at 00800000 …
    Image Name: kernel 3.16.0-4-kirkwood
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 2083333 Bytes = 2 MiB
    Load Address: 00008000
    Entry Point: 00008000
    Verifying Checksum … OK
    ## Loading init Ramdisk from Legacy Image at 01100000 …
    Image Name: ramdisk 3.16.0-4-kirkwood
    Image Type: ARM Linux RAMDisk Image (uncompressed)
    Data Size: 10009556 Bytes = 9.5 MiB
    Load Address: 00000000
    Entry Point: 00000000
    Verifying Checksum … OK
    Loading Kernel Image … OK

    Starting kernel …

    Uncompressing Linux… done, booting the kernel.
    ——————————————————–

    But nothing happens.

    Here my printenv: (I’m trying to start OS from USB)

    ib62x0 => printenv
    baudrate=115200
    bootargs=console=ttyS0,115200 root=UUID=9adb5ab4-f827-4bda-a788-539a0b0a7c04
    bootargs_console=console=ttyS0,115200
    bootargs_root=root=UUID=9adb5ab4-f827-4bda-a788-539a0b0a7c04
    bootcmd=setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_usb; bootm 0x00800000 0x01100000
    bootcmd_usb=usb start; ext2load usb 0:1 0x00800000 /uImage; ext2load usb 0:1 0x01100000 /uInitrd
    bootdelay=3
    console=console=ttyS0,115200
    ethact=egiga0
    ethaddr=00:01:d2:0e:26:e4
    fdt=/boot/ib62x0.dtb
    kernel=/boot/zImage
    mainlineLinux=yes
    mtdids=nand0=orion_nand
    mtdparts=mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),-@0x100000(root)
    stderr=serial
    stdin=serial
    stdout=serial

    Environment size: 730/131068 bytes

    1. Strange. I don’t have any idea at the moment.

      Could you try to set the „earlyprintk“ kernel parameter? Hopefully that will give you some output.


      setenv bootargs_console 'console=ttyS0,115200 earlyprintk'
      saveenv

  4. Hello everyone.
    After setting again the environment the OS start normally. I don’t know why. But I’ve just found out that Jessie is not compatible whit my finally goal, so can i do it with Debian 7 wheezy?
    Thank you all.

    1. Great that it works now! I haven’t any experience with installing Debian 7 on this box. Out of curiosity, why does Debian 8 does not work for your application?

      1. I want to use openmediavault, but it isn’t Jessie compatible.
        I’ve tried Jessie’s repackaged kernel with wheezy ramdisk, but the installer don’t recognize the Ethernet card, though show me mv643xx driver.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.