Robby Workman | 24 Mar 05:37 2011

Netgear Stora

Well, as those of you in the IRC channel [1], I recently acquired
a Netgear Stora [2], which is a consumer grade NAS appliance.

It runs a kernel with RedHat userland, and it's terribly
crippled and locked down and allegedly backdoored, and the only way
to administer it is through a web interface that quite frankly sucks
goat balls.  

However, ArmedSlack runs just fine on it after a bit of cajoling
(with a bit of guidance at the OpenStora [3] forums [4]).  You'll
want to get a serial cable for it (you can make one, modify the 
JTAG/UART box for GuruPlug devices, or buy one from "bigbrett" on
the previously mentioned forum - I can confirm that his work fine).

Once you boot with the serial cable attached, you'll need to set
arcNumber=1680 (that's actually not correct, but Stora support
isn't in the mainline kernels, and all of the patchsets are too
old to apply, and 1680 seems to work fine - ymmv), and as usual,
set mainlineLinux=yes   

From there, use INSTALL_KIRKWOOD.TXT (in the armedslack tree) to 
boot the installer environment.  Bring up the network and mount
your NFS share where the armedslack tree lives.  Flash the kernel
uImage (no need for initrd) to /dev/mtd1:

  # flash_eraseall /dev/mtd1
  # nandwrite -p /dev/mtd1 uImage

Now you need to put a ubi image on mtd2.  I tried (and failed)
(SEVERAL times) to create a ubi image that could be flashed to
mtd2; I don't know where I'm going wrong, since I've successfully
created one for a GuruPlug, but regardless, I failed, sooo... [5]
Let's get a ubi filesystem on mtd2:

  # ubiformat /dev/mtd2 -O 2048
  # ubiattach /dev/ubi_ctrl -m 2 -O 2048
  # ubimkvol -N rootfs -m /dev/ubi0
  # mount -t ubifs ubi0:rootfs /mnt
  # tar xf /path/to/rootfs.tar.gz -C /mnt
  # ** edit inside /mnt as needed ** 

Finally, you'll see this in the uboot environment:
  bootargs_root=ubi.mtd=2,2048 root=ubi0:rootfs rootfstype=ubifs init=/linuxrc

You'll want to change that to this:
  bootargs_root=ubi.mtd=2,2048 root=ubi0:rootfs rootfstype=ubifs

Unless I've forgotten something, a reboot should result in
ArmedSlack running on the machine...  :-)

[1] #armedslack on freenode
[5] Here's the method used to create (broken) ubi images:
    (obviously /shared/rootfs will differ)
    # mkfs.ubifs \
        -x zlib \
        -r /shared/rootfs \
        -m 2048 \
        -e 129024 \
        -c 2047 \
        -o ubifs.img
    # ubinize \
        -m 2048 \
        -p 128KiB \
        -s 512 \
        -o rootfs.stora.img \
    # ubiformat \
        /dev/mtd2 \
        -s 512 \
        -O 2048 \
        -f /shared/rootfs.stora.img