General NAS-Central Forums

Welcome to the NAS community
It is currently Wed Dec 07, 2016 12:25 pm

All times are UTC




Post new topic Reply to topic  [ 281 posts ]  Go to page 1, 2, 3, 4, 5 ... 19  Next
Author Message
PostPosted: Wed Jan 04, 2012 10:41 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
Code:
#include <standard_disclaimer.h>
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the system failed. Please
 * do some research if you have any concerns about features included in this Kernel/OS
 * before flashing it! YOU are choosing to use these modifications upon your own choice, and if
 * you point the finger at me for messing up your device, I'll just sit and laugh at you.
 */


GITHUB: NSA310-320-debian

I used AA666 NSA320 sources for build on NSA310, parts of this tutorial are taken from his topic(credits to him). We couldn't use his sources because there was no compatible ethernet driver included in his kernel image(Rtl8169 for NSA310).

New 3.5.1 Kernel
Uimage: NSA310 uImage-3.5.1
Peeter123 diff: Kernel 3.5.1 patch
My kernel config: ARM Kernel config 3.5.1


Uimage: NSA310 uImage-3.2
Debian installation ramdisk: Debian 6
Peeter123 diff: Kernel 3.2 patch
My kernel config: ARM Kernel config 3.2

------Compilation from source(CrossCompile on Ubutu)-------
*Grab the linux kernel source: linux-3.2.tar.bz2
*Make sure you have build-essential & gcc-arm-linux-gnueabi installed
*Extract the kernel to a dir in your homedir(for example ~/build)
*Cd to build/
*Put the patchfile next to the linux-3.2.0 dir
*Apply patch: patch -p0 < patch-3.2.0-nsa320
*Copy config-arm to .config in linux-3.2.0 directory
*make nconfig ARCH=arm(Optional if you want to make changes)
*ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make uImage modules
*You'll now have uImage in linux-3.2.0/arch/arm/boot/uImage

My kernel includes:
*Usb audio drivers + ALSA (for MPD)
*Usb printer support
*Ext2,Ext3,Ext4,ntfs,fat filesystems
*RTL8169 ethernet drivers
*Led driver(from AA666)
*Basic stuff such as USB, SATA, SCSI, USB DRIVERS etc.

------Serial Adapter------
U-Boot is only available via a serial console on the board. I've used a bus-pirate to interface with the board. Make sure your cable is only outputting 3.3V.
|*|-|*|*|*| --> pinout on the board: |GND|NC|RX|TX|VCC|

------Prepare usb stick------
Since uboot on the NSA310 doesn't work with ethernet, it is necessary to make an usb drive with the necessary files.

*Get an usb disk with a size that supports FAT16(<4GB)
*Format it to FAT16
*Copy the needed files to the stick

------Start Debian Install------
Uboot:

Prepare u-boot for mainline kernel:
Code:
setenv mainlineLinux yes
setenv arcNumber 4022
saveenv
reset


After reset hit any key to stop autoboot process.

Now we can begin to install Debian Squeeze:

Code:
usb start
fatload usb 0 0x800000 uImage
fatload usb 0 0xb00000 initrd.gz
setenv bootargs 'console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0x900000 ramdisk=32768'
bootm 0x800000


In the case that the Debian installer is unable to see your HDD(s) during installation -> Start a shell from installer menu and create dev nodes for disks and partitions manually:
Code:
mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/sda2 b 8 2


Partition your drive like you want. I've created three partitions:
*150MB ext2 partition (/boot,primary) -> we can boot uImage from this partition
*5GB ext4 partition(/,primary)
*1800GB ext4 partition(/home,logical)
*500MB swap partition(,logical)

------After install:------
Now we can try to boot from harddisk
Code:
usb start
fatload usb 0 0x800000 uImage


Next, try to boot and mount root filesystem.
If you installed root filesystem into /dev/sda1:

Code:
setenv bootargs 'console=ttyS0,115200 root=/dev/sda1'

bootm 0x800000


In case if you successfully booted into installed Debian, you can put kernel into NAND flash or on HDD.

------NAND install:------
If you are confident everything is working...

Download kernel from usb and save it into nand kernel_2 partition:
Code:
fatload usb 0 0x800000 uImage
nand erase 0x4640000 0x300000
nand write.e 0x800000 0x4640000 0x300000


Following command depends on where you installed Debian.
In case if it on sda1:
Code:
setenv bootargs 'console=ttyS0,115200 root=/dev/sda1'


Prepare boot command
Code:
setenv bootcmd 'nand read.e 0x2000000 0x04640000 0x400000; bootm 0x2000000'

saveenv


Try to boot
Code:
boot


------HDD install:------
If you are confident everything is working...

Put uImage in /boot

cat /etc/fstab to see which partition is is mounted on /boot (in my case /dev/sda3)

Following command depends on where you installed Debian.
In case if it on sda1:
Code:
setenv bootargs 'console=ttyS0,115200 root=/dev/sda1'


Prepare boot command
Code:
setenv bootcmd 'ide reset; ext2load ide 0:3 0x800000 /uImage; bootm 0x800000'
saveenv


change ide 0:3 according to your findings at(cat /etc/fstab) and change 3 to the number after sda.

Try to boot
Code:
boot


------Fix wrong mac address------
Run: apt-get install uboot-envtools

Add these lines to /etc/rc.local:

Code:
ifdown eth1
/sbin/ifconfig eth1 hw ether `fw_printenv -n ethaddr`
ifup eth1


Where XX:XX:XX:XX:XX:XX is your original mac extracted from uboot's enviroment variables

------Alloc kernel panics-------
Add these lines in /etc/sysctl.conf:

Code:
# Set VM min memory
vm.min_free_kbytes=8192

------Ledssssss-------
Put these lines in /etc/rc.local to stop blinking once system has booted:

Code:
#Setup leds
echo 1 > /sys/class/leds/nsa310:green:System/brightness


------Disable tmpfs on /tmp-------
Code:
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

# delete files in /tmp during boot older than x days.
# '0' means always, -1 or 'infinite' disables the feature
TMPTIME=0

# spawn sulogin during boot, continue normal boot if not used in 30 seconds
SULOGIN=no

# do not allow users to log in until the boot has completed
DELAYLOGIN=no

# assume that the BIOS clock is set to UTC time (recommended)
UTC=yes

# be more verbose during the boot process
VERBOSE=no

# automatically repair filesystems with inconsistencies during boot
FSCKFIX=no

# mount /run/lock as a tmpfs (separately from /run)
RAMLOCK=no

# mount /run/shm as a tmpfs (separately from /run)
RAMSHM=no

# mount /tmp as a tmpfs
RAMTMP=no


------Shutdown via Powerbutton-------
It is possible to shutdown the box by pressing power button.
Install input-event-daemon and put following to /etc/input-event-daemon.conf:

Code:
[Global]
listen = /dev/input/event0
[Keys]
POWER = shutdown -h now


------Upgrade to wheezy------
*Cd to /etc/apt
*mv sources.list sources.list.bak
*vi sources.list
*Add these contents:
Code:
#############################################################
################### OFFICIAL DEBIAN REPOS ###################
#############################################################

###### Debian Main Repos
deb http://ftp.nl.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.nl.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.nl.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.nl.debian.org/debian/ wheezy-proposed-updates main contrib non-free

##############################################################
##################### UNOFFICIAL  REPOS ######################
##############################################################

###### 3rd Party Binary Repos

#### Debian Multimedia - http://www.debian-multimedia.org/
## Run this command: apt-get update && apt-get install debian-multimedia-keyring && apt-get update
deb http://www.debian-multimedia.org testing main non-free

#### Webmin - http://webmin.com/
## Run this command: wget -q http://www.webmin.com/jcameron-key.asc -O- | apt-key add -
deb http://download.webmin.com/download/repository sarge contrib

*apt-get update
*apt-get dist-upgrade
*Follow on screen instructions


------Known Bugs------
* Ethernet leds don't work @ 1gbit (Workaround to use front-led(support in my 3.2 kernel) -> Netdev led trigger)

If somebody knows a fix, let us know :)

Also, if there is a nice contribution in this topic I will add it to the topic start. :D


Last edited by peeter123 on Mon Sep 24, 2012 5:23 pm, edited 20 times in total.

Top
 Profile  
 
PostPosted: Wed Jan 04, 2012 10:42 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
Reserved for future use ;)


Top
 Profile  
 
PostPosted: Thu Jan 05, 2012 8:11 pm 
Offline

Joined: Sun Nov 13, 2011 3:31 pm
Posts: 26
I have changed /etc/inittab to run getty on ttyS0 by commenting all lines and adding getty for ttyS0

S0:2345:respawn:/sbin/getty 115200 ttyS0 vt100

Network card is Realtek 8168B and driver in kernel is for 8169 which is not 100% compatible. Dedicated driver can be compiled from source, but is non-free. http://lists.debian.org/debian-devel/2011/11/msg00520.html

Maybe samba issue is related to high network usage? Please write steps to reproduce your problem
My ethernet lights blinks - connected via 100Mbit/s cable
I have compiled kernel with my config but i think it is very similar to yours.

My another change is booting from usb by setting bootcmd in u-boot - no pendrive ->no boot.
[Edit] and i can change kernel just by replacing one on pendrive [/Edit]
I'll check later if our box has cryptographic accelerator - that would be nice to have all disks encrypted


Top
 Profile  
 
PostPosted: Thu Jan 05, 2012 8:29 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
osa wrote:
I have changed /etc/inittab to run getty on ttyS0 by commenting all lines and adding getty for ttyS0

S0:2345:respawn:/sbin/getty 115200 ttyS0 vt100
....


I have also modified my /etc/inittab and now the getty part looks like this, I forgot to mention that ;)

Code:
.....
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
......


Actually I've tried both drivers, the r8169 driver gave better performance(40MB/s vs 30MB/s). I'm on a gigabit link and haven't tried 100MBit but I'll believe you when you say the lights work at 100MBit ;)

Server only crashes when I'm using samba, FTP works without any problems(@40MB/s). Haven't experienced any other lock-ups either. You just have to write a lot of small files to the samba share and the box will lock-up.

Next thing I'm gonna try is to upgrade to DEB7(wheezy) and see if the samba problems are gone.

Edit: Still happens on wheezy, less frequent though. But still really unstable.

Thx for you input.


Top
 Profile  
 
PostPosted: Fri Jan 06, 2012 10:19 am 
Offline

Joined: Sun Nov 13, 2011 3:31 pm
Posts: 26
@peeter123
I can't reproduce your samba problem:
I have copied paralelly 625GB (6250 x 100MB) +1.5BG (350000 small files with average size 4kB, median 1733 bytes) with average speed 28MB/s and overall cpu load ~1.5

Only issue i found was console terminal not responding after many hours of high load- but this can be related to my ultra cheap ttl converter or getty respawn/inittab issue.
I can confirm ethernet lights problem - they do not work when working with gigabit speed


Top
 Profile  
 
PostPosted: Fri Jan 06, 2012 2:53 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
Hmm that's weird. Maybe its a kernel problem. Could you attach your kernel config so I can look for the differences?


Top
 Profile  
 
PostPosted: Fri Jan 06, 2012 3:30 pm 
Offline

Joined: Sun Nov 13, 2011 3:31 pm
Posts: 26
http://pastebin.pl/53824
This is AAA666 config with minor changes (network driver?) and version 2.6.38.8
Debian Wheezy , gcc version 4.4.5 (Debian 4.4.5-8)


Top
 Profile  
 
PostPosted: Fri Jan 06, 2012 7:37 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
I've recompiled the kernel with AA666 config + usb audio + usb printing -CONFIG_SYSFS_DEPRECATED and now it works fine. Probably some error or incompatile setting in the kernelconfig.

Thanks that makes my setup a lot more usefull :)

I'll add the new kernel in topicstart.

About cryptography support, found this in datasheet:

Code:
Cryptographic Engine
and Security
Accelerator
The device integrates a Cryptographic Engine and Security Accelerator to support data
encryption and authentication. It also contains a dedicated Direct Memory Access (DMA)
controller to perform the following:

Hardware implementation of encryption and authentication engines to boost packet
processing speed

Dedicated DMA to feed the hardware engines with data from the internal SRAM memory
or from the DDR memory

Implements AES, DES, and 3DES encryption algorithms

Implements SHA1 and MD5 authentication algorithms


Edit: Have now build a working 3.2 kernel with custom sata led-trigger because AA666 patches on sata_mv didn't work anymore :)

Now we have sata-disk trigger in /sys/class/leds/nsa320:red:SATA1/triggers


Top
 Profile  
 
PostPosted: Tue Jan 10, 2012 1:16 am 
Offline

Joined: Tue Jan 10, 2012 1:04 am
Posts: 1
Kudos to you guys for the install you did!

I've been playing with 2.6 kernel on NSA310 for a while but I cant get a control over the fan PWM.
By any chance did you get the thermal sensor working under Debian?


Top
 Profile  
 
PostPosted: Tue Jan 10, 2012 5:16 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
Haha thx, no haven't looked into that part yet but AA666 wrote a driver for thermals. Didn't check it out though, will look into that ;)


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 6:08 pm 
Offline

Joined: Mon Jan 30, 2012 5:57 pm
Posts: 17
Hi,
I followed your guide for installing Debian on my NSA-310. Thank you for sharing your information. I managed to install and boot Debian from USB. First steps are done.

But, when i take off the usb-stick, i´m not able to boot the original zyxel-system. I think i have to change back the arcnumber and something else, but i have no idea what to do. Can you help me with this task? For testing it would be fantastic if i could change the running system, before installing debian in the nand.

Thank you for your help.


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 6:55 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
You can't have a Debian install and a working stock system, Debian is on harddisk and a part of zyxel's original firmware also(probably) it at least needs disk access. I think if you format the HDD you can boot the original zyxel system again ;)

Why don't you stay at debian, no need for all that zyxel shit ;)


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 7:00 pm 
Offline

Joined: Mon Jan 30, 2012 5:57 pm
Posts: 17
Thank you for your fast reply. I dont want to have the old system back for long, but just for testing the performance against the debian installation. I wondered, because i haven´t used any harddisk. I followed your guide but installed debian on an usb-stick.

That´s why i thaught, that the original zyxel "Shit" - System is still in the nand. Isn´t that right? I don´t do the Nand-Installation for now. That´s why i thaught simply unplugging the USB-Stick should start the original system.


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 7:22 pm 
Offline

Joined: Sun Dec 04, 2011 12:38 am
Posts: 37
Location: Enschede, the Netherlands
Ah, hmm if you installed it on a usb stick the original system should work ;) Can you post your serial bootlog when booting without USB? I think you should set: setenv mainLineLinux no.

Edit: A, just what I thought :P


Last edited by peeter123 on Mon Jan 30, 2012 7:46 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 7:29 pm 
Offline

Joined: Mon Jan 30, 2012 5:57 pm
Posts: 17
Hey... I just found out:
Code:
setenv mainlineLinux no
saveenv
reset

Now the Zyxel-System is starting up from Nand.

I had some problems with my usb-sticks. For next i will do a harddisk-installation and when everything is fine i will do the nand-installation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 281 posts ]  Go to page 1, 2, 3, 4, 5 ... 19  Next

All times are UTC


Who is online

Users browsing this forum: barmalej2, dexhain, funtomi and 43 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group