How to install Debian with Linux 3.2.4 on a Netgear Stora

- 29/09/2013 - source

I followed a very good howto on OpenStora to have Debian on a Netgear Stora, but the kernel given there was really old - 2.6.32.
The Debian installer crashed. But that old kernel seemed to run just fine, it only needed a good root filesystem.

/mnt/lydiaroot/ will be a USB stick containing the Stora’s rootfs.

Starting the old kernel

As explained by the linked tutorial,

You should have an initramfs prompt.
That’s because you have no rootfs but the kernel is working.

Making the rootfs with multistrap

Because the installer was crashing every time I tried, I made a Debian rootfs with multistrap.

Create a config file (lydia_multistrap.conf):

[General]
arch=armel
directory=/mnt/lydiaroot/
cleanup=true
noauth=true
unpack=true
bootstrap=Grip
aptsources=Grip

[Grip]
keyring=emdebian-archive-keyring
suite=sid-grip
source=http://ftp.uk.debian.org/emdebian/grip
packages=netbase ifupdown iproute net-tools samba udev mtd-utils dnsutils vim

And run it:

multistrap -f lydia_multistrap.conf

You should have a proper rootfs in /mnt/lydiaroot/ now.
umount it and start again the old kernel. You may need to add init=/bin/bash to the boot args.

Multistrap installed packages but didn’t configure them:

dpkg --configure -a

And you have a working Linux 2.6.32 kernel on your Netgear Stora!

But that’s an old kernel, and the latest udev version had serious problems with it when I tried to boot at that point. A Linux update fixed it.

Building Linux 3.2.4 with patches

I found that the tutorial’s author has updated his patches on Github for Linux 3.2.4. Because it was taking forever on the Stora, i’ve chose to cross-compile the kernel on my ArchLinux laptop using arm-linux-gnueabi-gcc. It may be different on Debian.

Get Linux and apply these patches:

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.4.tar.bz2
tar -xjvf linux-3.2.4.tar.bz2
git clone https://github.com/kenchy/stora_iconnect_debian_3.2.4.git
cp stora_iconnect_debian_3.2.4/* linux-3.2.4/ -r
cp working_config .config

Build the kernel:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH="/mnt/lydiaroot/" CONFIG_MACH_NETGEAR_MS2110=y # -j N
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH="/mnt/lydiaroot/" CONFIG_MACH_NETGEAR_MS2110=y uImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH="/mnt/lydiaroot/" CONFIG_MACH_NETGEAR_MS2110=y modules
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH="/mnt/lydiaroot/" CONFIG_MACH_NETGEAR_MS2110=y modules_install
sudo cp arch/arm/boot/uImage /mnt/lydiaroot/boot/uImage-3.2.4

We now have the new kernel installed. Next step: initramfs. Boot your old kernel via TFTP, and make it using mkinitramfs:

mkinitramfs -o linux-3.2.4 3.2.4
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0000000 -e 0x0000000 -n "Stora Ramdisk" -d linux-3.2.4 uInitrd
cp uInitrd /mnt/lydiaroot/boot/uInitrd-3.2.4

Done! Reboot your Stora and boot on this new kernel:

setenv bootargs $(console) root=/dev/sda1 rootdelay=8
usb reset
ext2load usb 0 0x200000 /boot/uImage-3.2.4
ext2load usb 0 0x800000 /boot/uInitrd-3.2.4
bootm 0x200000 0x800000

To setup permanent boot, go back to the first tutorial. If it fails, you may need to install kernel to NAND.