meta data for this page
Debian
References
OpenWRT packages: http://bartekk.pdg.pl/openwrt/
http://forum.nas-central.org/viewtopic.php?f=249&t=5145
http://eko.one.pl/?p=openwrt-nsa310
https://sites.google.com/site/realblades/misc/debian-on-zyxel-nsa310
http://linuxwiki.de/ZYXEL%20NSA-310#Debian_Installation
http://openrouter.info/forum/viewtopic.php?f=19&t=1581&start=80
Preparation
First install Debian 6 (squeeze). Put on FAT formatted pendrive: initrd.gz uImage-3.2 uImage-3.5.1
then boot from pendrive (one time, without saving it permanently to u-boot environment) Machine type is 4022
setenv arcNumber 4022 setenv mainlineLinux yes usb start fatload usb 0 0x800000 /uImage-3.2 fatload usb 0 0xb00000 /initrd.gz setenv bootargs 'console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0x900000 ramdisk=32768' bootm 0x800000
and install Debian 6 system as usual. Installer will complain about no matching modules and no matching kernel. During installation, create small /boot ext3 partition for kernels.
To boot from HDD, copy uImage-3.2 from pendrive to HDD /boot partition and set u-boot:
From u-boot console, test partitions readability:
ide reset ide part ext2ls ide 0:1 ext2ls ide 0:3
In my example I got following partitions numbers:
Partition Map for IDE device 0 -- Partition Type: DOS Partition Start Sector Num Sectors Type 1 309248 19222528 83 2 19533822 957237250 5 Extd 3 2048 307200 83
Where 3rd partition is small /boot partition, so we need to load kernel from 'ide 0:3'
setenv arcNumber 4022 setenv mainlineLinux yes setenv bootargs 'console=ttyS0,115200 root=/dev/sda1' setenv bootcmd 'ide reset; ext2load ide 0:3 0x800000 /uImage-3.2; bootm 0x800000' saveenv reset
or 3.5.1 kernel:
setenv bootcmd 'ide reset; ext2load ide 0:3 0x800000 /uImage-3.5.1; bootm 0x800000'
Update to Debian Wheezy
Put following sources into /etc/apt/sources.list
###### Debian Main Repos deb http://ftp.pl.debian.org/debian/ wheezy main contrib non-free deb-src http://ftp.pl.debian.org/debian/ wheezy main contrib non-free ###### Debian Update Repos deb http://security.debian.org/ wheezy/updates main contrib non-free deb http://ftp.pl.debian.org/debian/ wheezy-proposed-updates main contrib non-free deb-src http://security.debian.org/ wheezy/updates main contrib non-free deb-src http://ftp.pl.debian.org/debian/ wheezy-proposed-updates main contrib non-free
apt-get update apt-get dist-upgrade apt-get install linux-base firmware-realtek apt-get clean
Fine tunning
Install missing packages:
apt-get install uboot-envtools smartmontools strace watchdog hdparm
Generate blank modules.dep
mkdir /lib/modules/3.5.1 depmod -a
LEDs
To turn ON System LED (disable blinking) please add line to /etc/rc.local:
echo 1 > /sys/class/leds/nsa310:green:System/brightness
uboot-envtools
Create /etc/fw_env.config with content:
/dev/mtd1 0x0000 0x20000 0x20000 4
MAC address
After bootup, ethernet controller has MAC address '00:00:00:00:00:30'. There are several method to restore correct MAC address which can be obtained from u-boot env: 1) add to /etc/rc.local
ifdown eth0 /sbin/ifconfig eth0 hw ether `fw_printenv -n ethaddr` ifup eth0
or
/sbin/ip link set eth0 address `/usr/bin/fw_printenv ethaddr | /bin/grep -E -o '[[:xdigit:]]{2}(:[[:xdigit:]]{2}){5}'`
2) add line to /etc/network/interfaces
hwaddress ether cc:5d:4e:c9:fc:06
3) Edit and set MAC here: /etc/udev/rules.d/70-persistent-net.rules
Wake-on-lan will work only with fake MAC '00:00:00:00:00:30'
Fix for alloc kernel panic
Add these lines in /etc/sysctl.conf:
# Set VM min memory vm.min_free_kbytes=8192
Buttons
Ref: http://masu.6f.sk/index.php?title=Nsa310_buttons Button works, but requires long pressing > 1sec.
Fan
Detect PWM devices and calibrate fan RPMs using 'pwmconfig'. After many questions an tests the config file /etc/fancontrol will be generated.
# Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 DEVPATH=hwmon0=devices/platform/mv64xxx_i2c.0/i2c-0/0-002e DEVNAME=hwmon0=lm85 FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp3_input FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input MINTEMP=hwmon0/device/pwm1=35 MAXTEMP=hwmon0/device/pwm1=60 MINSTART=hwmon0/device/pwm1=16 MINSTOP=hwmon0/device/pwm1=16 MINPWM=hwmon0/device/pwm1=0
Features
- LM-Sensors are working. You can check values using command 'sensors'
- HDD temperature: smartctl -A /dev/sda | awk '/^194/ {print $10}'
- Should be possible to wake NSA310 (powered off by 'halt' command) sending Wake-On-Lan packet to NSA310 'wakeonlan 00:00:00:00:00:30'
Own kernel
There's no need to keep pestering the poor guy over simple config changes. It's easy to build your own kernel; the instructions are right there in the first post. On a debian host you need to add the emdebian repo and install gcc-4.7-arm-linux-gnueabi (or whatever version) and u-boot-tools to build the kernel.
I just built one with device mapper and crypto target support, and threw in netfilter NAT stuff for giggles.
Here it is: http://allurgroceries.com/nsa310/uImage-3.5.7 And the .config: http://allurgroceries.com/nsa310/config-3.5.7_nsa310_allurgroceries
Kernel 3.18
Download lastest Jessie rootfs from: Linux Kernel 3.18 (FDT) and 3.16 (non-FDT) Kirkwood package and rootfs
Or locally: linux-3.18.5-kirkwood-tld-1-bodhi.tar.bz2 debian-3.18.5-kirkwood-tld-1-rootfs-bodhi.tar.bz2
Unpack rootfs to media, can be USB pendrive for now.
cd /mnt/sdd1 tar -xjf Debian-3.18.5-kirkwood-tld-1-rootfs-bodhi.tar.bz2
Inside rootfs, there is /boot directory which contains bootable kernel, initrd and deveice trees. Go to newly unpacked roots directory and create images recognizable by u-boot. If command mkimage is missing, please install u-boot-tools.
Boot without Flattened Device Tree
This method is supported by old (stock) U-BOOT. In this case FDT structure is appended at end of kernel.
cd /boot cp -a zImage-3.18.5-kirkwood-tld-1 zImage.fdt cat dts/kirkwood-nsa310.dtb>> zImage.fdt mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-3.18.5-kirkwood-tld-1 -d ./zImage.fdt ./uImage-3.18.5 mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-3.18.5-kirkwood-tld-1 -d ./initrd.img-3.18.5-kirkwood-tld-1 ./uInitrd-3.18.5
Test if kernel starts correctly from pendrive:
usb start fatload usb 0 0x800000 /boot/uImage-3.18.5 fatload usb 0 0x1100000 /boot/uInitrd-3.18.5 bootm 0x800000 0x1100000
Boot from HDD (separate small /boot partition, so no /boot prefix in filenames):
ide reset ext2load ide 0:3 0x800000 /uImage-3.18.5 ext2load ide 0:3 0x1100000 /uInitrd-3.18.5 bootm 0x800000 0x1100000
Boot with Flattened Device Tree
NOT SUPPORTED BY OLD (default U-BOOT)
cd boot mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-3.18.5-kirkwood-tld-1 -d ./vmlinuz-3.18.5-kirkwood-tld-1 ./uImage-3.18.5 mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-3.18.5-kirkwood-tld-1 -d ./initrd.img-3.18.5-kirkwood-tld-1 ./uInitrd-3.18.5
Test if kernel starts correctly from pendrive:
usb start fatload usb 0 0x800000 /boot/uImage fatload usb 0 0x1100000 /boot/uInitrd fatload usb 0 0x1c00000 /boot/dts/kirkwood-nsa310.dtb bootm 0x800000 0x1100000 0x1c00000
Boot from HDD (separate small /boot partition, so no /boot prefix in filenames):
ide reset ext2load ide 0:3 0x800000 /uImage-3.18.5 ext2load ide 0:3 0x1100000 /uInitrd-3.18.5 ext2load ide 0:3 0x1c00000 /dts/kirkwood-nsa310.dtb bootm 0x800000 0x1100000 0x1c00000
Adapt own devie tree file
There are multiple HW versions of NSA310 on market, but only 2 device tree are defined in kernel:
- kirkwood-nsa310.dtb - all LEDs are bicolor (red and green), sensors device 'adt7476' on I2C bus
- kirkwood-nsa310a.dtb - like above but without red USB led, and sensor device 'lm85'
My NSA310 version is like nsa310 but with lm85 :), so I've created kirkwood-nsa310b.dts based on kirkwood-nsa310.dts with LM85 section from kirkwood-nsa310a.dts.
apt-get install emdebian-archive-keyring
Debian Jessie
Above rootfs contains Jessie system for NSA325. To use it with NSA310 some changes are needed.
apt source
Adapt to your country location in /etc/apt/sources.list, and add missing contrib and non-free packages
apt-get update apt-get dist-upgrade apt-get install firmware-realtek fancontrol lm-sensors
RAM disk will be regenerated, so you need to recreate uInitrd-xxx again.
Enable LEDs
Adapt /etc/rc.local to own needs:
if [ -d /sys/class/leds/nsa310:green:sys ]; then echo default-on> /sys/class/leds/nsa310:green:sys/trigger echo none > /sys/class/leds/nsa310:red:sys/trigger fi if [ -d /sys/class/leds/nsa310:green:hdd ]; then echo ide-disk1> /sys/class/leds/nsa310:green:hdd/trigger fi if [ -d /sys/class/leds/nsa310:green:esata ]; then echo ide-disk2> /sys/class/leds/nsa310:green:esata/trigger fi if [ -d /sys/class/leds/nsa310:green:usb ]; then echo usb-host> /sys/class/leds/nsa310\:green\:usb/trigger fi
turn off HDD when idle
- by default busybox-syslogd is installed, with logging to RAM
- mount working dir for samba and dhcp client as tmpfs
- switch Samba to use syslog
- tune system /etc/sysctl.conf
smartd
fromsmartmontools
writes it log and state to/var/lib/smartmontools
- put it on tmpfs (and lose history)
- or increase disc check interval in
/etc/default/smartmontools
repair /etc/adjtime
add new line at end of /etc/adjtime
uboot-envtools
/etc/fw_env.config
/dev/mtd0 0x100000 0x20000 0x20000 4
TODO
linux-headers-3.2.0-4-kirkwood - Header files for Linux 3.2.0-4-kirkwood linux-image-3.2.0-4-kirkwood - Linux 3.2 for Marvell Kirkwood linux-headers-2.6-kirkwood - Header files for Linux kirkwood configuration (dummy package) linux-headers-kirkwood - Header files for Linux kirkwood configuration (meta-package) linux-image-2.6-kirkwood - Linux for Marvell Kirkwood (dummy package) linux-image-kirkwood - Linux for Marvell Kirkwood (meta-package)