DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-06-28 09:29:31

Ingram
Member
Registered: 2011-02-08
Posts: 9

Arch Linux ARM on NSA-220

When it is primarily intended for use with plugboxes, it should run as well on NSA-220

However I am having difficulties with booting it up from usb like debian. I noticed that by default it comes with uImage instead of zImage (some plugbox convention I guess). After trying to extract the uImage (unsure if it works in real life), I still couldn't boot. One way to get the zImage should be by rebuilding kernel from sources. In arch linux building packages is a piece of cake by getting a PKGBUILD file (with some other files, for example see kernel26) and running makepkg on that folder - makepkg being one of arch's build tools. (in this case it is needed to replace the uImage with zImage inside PKGBUILD)

Anyway, in conclusion I need some help and ideas how to get it all running. (most likely I have problems with finding out whats the real error since theres no display)

Offline

 

#2 2011-06-28 09:39:36

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: Arch Linux ARM on NSA-220

You don't have to use arch linux kernel at all. And most likely you can't because it does not contain necessary patches to support NSA-220. You need to use zyxel kernel from firmware GPL tarball.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#3 2011-06-28 10:11:48

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

Good point. But does this mean I need to use the exact same kernel version as firmware or can I patch a newer one up? I was unable to chroot arch from debian because of the kernel being too old.

Offline

 

#4 2011-06-28 13:59:19

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: Arch Linux ARM on NSA-220

Ingram wrote:

Good point. But does this mean I need to use the exact same kernel version as firmware or can I patch a newer one up? I was unable to chroot arch from debian because of the kernel being too old.

Sure you can but its not all that easy. You can use DNS-323 example target which is already supported in vanilla kernel.
You can also try to downgrade coreutils (and possibly some other packages too) so that chroot would work.

But seriously, it would be easier to use just gentoo or debian linux for whatever you are tring to accomplish with arch smile


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#5 2014-12-07 20:31:21

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

3 years later I finally managed to get Arch Linux ARM booting *yay* (kernel 3.17.4). The device had been sitting on the shelf for most of that time and now I figured that it would be about time to have a working NAS again (maybe a sweet torrent seeding box for all of my favorite linux distros).

Interestingly it only took a days worth of effort. I used ubuntu to cross-compile a kernel with orion5x support and then tried the 4 different supported device tree configurations - they do not use machtypes anymore. Out of the box, maxtor mss2 configuration seemed to work the best. USB and ethernet are probably the most notable things that are not working.

The kernel is loaded using the same way as for debian but since I didn't know how to make my own initramfs or what to put in it so that it could boot from usb, I had to use a hard drive for the rootfs.

I will try tweaking the kernel/device tree files to see if I can get usb and ethernet working.

Offline

 

#6 2014-12-07 22:19:31

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Arch Linux ARM on NSA-220

Very nice! Can the ancient bootloader simply boot a 3.17 kernel?

Offline

 

#7 2014-12-07 23:15:08

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

Looks like it, at least via reloaded.ko. I bet if it were even an old version of u-boot, getting newer things working would be a lot easier.

Also after taking a closer look at the kernel source, I think I am going to need lots of help with understanding how the hardware is being set up. Also there might be a possibility that I do not have the needed kernel modules compiled.

In a moment I'll share the instructions/files which I used to get it into the state that it is right now.

Offline

 

#8 2014-12-08 03:04:31

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

Also if anyone wonders, why I am such a fan of Arch Linux, then it's basically the best of Gentoo and Debian worlds - you get awesome up to date software and for most of the part you don't have to compile it yourself.

Between the time I did this and the time writing, the kernel package has been already updated to [nope]3.17.6[/nope] 3.18 :-)

Alright, as promised, a small walkthrough.

I used the latest Ubuntu - 14.10 to cross compile the kernel first.

Arch Linux has nifty shell scripts which are used to make packages in a standard manner. Since I didn't need a package, just a kernel then I snatched the kernel config file from https://github.com/archlinuxarm/PKGBUIL … inux-armv5

I downloaded the sources from http://www.kernel.org/pub/linux/kernel/ … 7.4.tar.xz and extracted them. The patches seemed to fix stuff that did not concern me, so I did not apply any.

Now we need a cross-compiler. I used a tutorial for RPi for information on cross-compiling. In short

Code:

sudo apt-get install gcc-arm-linux-gnueabi make ncurses-dev

Code:

export CCPREFIX=arm-linux-gnueabi-

Then I renamed config file to .config and ran

Code:

make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig

Then I selected some stuff from there orion5x related, bad memory. For that I post my own config - http://pastebin.com/M30muGf6 - you can diff it against the arch linux one from the repo to see what's different.

Finally to build the stuff needed

Code:

make -j5 ARCH=arm CROSS_COMPILE=${CCPREFIX} zImage modules dtbs

Then export the modules somewhere else

Code:

mkdir ~/modules
make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=~/modules modules_install

Simple kernel building till now, right? Now it is going to get interesting.

Since the kernel has booting support using dtb files (read these slides), but the bootloader doesn't actually support it, we have to append dtb files to zImage. One for each board for which the dtb was built. One of the config options had to be set for that as well.

Code:

cat arch/arm/boot/zImage arch/arm/boot/dts/orion5x-lacie-d2-network.dtb > zImage-orion5x-lacie-d2-network
cat arch/arm/boot/zImage arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dtb > zImage-orion5x-lacie-ethernet-disk-mini-v2
cat arch/arm/boot/zImage arch/arm/boot/dts/orion5x-maxtor-shared-storage-2.dtb > zImage-orion5x-maxtor-shared-storage-2
cat arch/arm/boot/zImage arch/arm/boot/dts/orion5x-rd88f5182-nas.dtb > zImage-orion5x-rd88f5182-nas

Then I snatched the scripts and boot folder from lenny_for_nsa220.zip and placed it on my usb, which was formatted as ext3. I placed the zImages to the boot folder and linked one of them at a time as zImage. The last one, orion reference design seemed to be the only one that did not boot, maxtor shared storage 2 seemed to work the best (explained later).

While we are at it, let's hardcode the root device in boot/reload.sh and change USBDEVICE=$1 to USBDEVICE=/dev/sda1 so that it would be the first hard disk and not the usb.

This should be everything from the USB side.

Finally we have to prepare the hard disk. I formatted the disk as one-partition ext3 and extracted arch linux rootfs on it from http://archlinuxarm.org/developers/downloads

I used http://archlinuxarm.org/os/ArchLinuxARM … est.tar.gz

Once that was on the disk, I added the modules from ~/modules to /usr/lib/modules, but this seemed to have little to no effect as lsmod was pretty much empty after booting.

But now there is nothing other left than just stick the usb and disk to the nsa220 and let it boot.

When I tried, mss2 zImage had one usb working (left one), or at least it detected the thumb drive after init, others with the exception of reference design just booted and detected the hard disk. No networking.

username and pw are root/root.

During the 2 and half years of studying computer science at university, I've learned that there is nothing more fun than blinking LED-s on computers, so we're going to do that next.

Code:

echo 17 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio17/direction
echo 1 > /sys/class/gpio/gpio17/value
echo 0 > /sys/class/gpio/gpio17/value

This should toggle between the green COPY LED.


If you do not want to compile your own kernel, then 3.17.4 zImages and modules can be found at https://www.dropbox.com/s/fyy1zh8i1j0p8 … ar.gz?dl=0

During booting there are messages of the debian initrd being discarded - might the zImage be too large?

Also after looking the kernel source, I still see board support that is implemented without dtb files, last time I tried any of those, I failed miserably.

Last edited by Ingram (2014-12-08 16:06:03)

Offline

 

#9 2014-12-17 21:20:31

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

It's been a while so a small heads-up.

Most of the things are working already, getting lots of help from irc.

There are small issues with the ethernet right now (it only works if the cable is plugged in _after_ kernel has booted), I guess this is because of using reloaded.ko as the old driver from 2.6.18 leaves the unit in an unknown state and this might not be reset properly in the newer sources. I will try booting via tftp in a few days. If anyone knows how to do it with this bootloader then I'm all ears.

Also components that are connected to higher GPIO-s do not work properly yet (namely power button, piezo buzzer and pins which are used to power off the machine). This has to be fixed in kernel drivers.

Right now I am working on making the flash layout visible for the kernel as the old kernel arguments aren't working.

Offline

 

#10 2014-12-18 16:51:03

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Arch Linux ARM on NSA-220

Ingram wrote:

I guess this is because of using reloaded.ko as the old driver from 2.6.18 leaves the unit in an unknown state and this might not be reset properly in the newer sources.

Have you seen that the original Lenny stick always booted twice? On the first (cold) boot the stick called reboot, and on the second boot it used reloaded.ko. That was because something didn't work on cold boot, but I can't remember what.

Offline

 

#11 2014-12-18 17:47:54

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

I noticed but never understood why it was done like that.

Offline

 

#12 2014-12-20 04:25:01

Ingram
Member
Registered: 2011-02-08
Posts: 9

Re: Arch Linux ARM on NSA-220

I tried loading the kernel via tftp and then straight booting it. Ethernet is still not quite working (pretty much the same as via reloaded.ko) and the fan won't start spinning. Everything else seems to be the same.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB