Main Page

Installing Debian Etch

Note:

See this page for installing Debian Etch on your Agestar NCB3AST without serial port.

For demo, see my NCB3AST serving information about itself .

Chiang Mai, Thailand, Friday 20 June 2008

Who is this for?

This page is for experienced users who wish to install Debian Etch on his Agestar NCB3AST. You might brick your NAS, you might lose your data, I will not be responsible for anything that might happen to your NAS, yourself, your cat, or anything else.

From http://www.lliures.org/2008/05/02/ft3563-bt-hacking/ this following devices have the same hardware:

  1. Coolmax CN-570
  2. NS-348S
  3. Emprex NSD-100
  4. Agestar NCB3AHT
  5. NAS2
  6. revoltec rs049

The instructions for installing Debian MIGHT work for those devices, but it is not guaranteed.

Preparation

You will need:

  1. Knowledge on how to configure/compile the Linux kernel
  2. A serial port
  3. A configured tftp server
  4. A linux debian host with a cross compiler

Compiling kernel

NOTE: the network driver for 2.6.25.4 only works on agestar, other models can work using latest patch for kernel source (2.6.29 or later).

First, you need to be able to compile the kernel by yourself:

  1. Download ARM cross compiler from code sourcery, choose the GNU/Linux version. Extract it somewhere.
  2. Download kernel source code from www.kernel.org.
  3. Download my latest patch from http://tinyhack.com, just look at last patch in the agestar category. Also download the config file for USB booting.
  4. Extract the kernel, extract the patch in the kernel directory, then do patch -p1 < the_patch_file
  5. Edit Makefile, find the line CROSS_COMPILE, and change it to point to your ARM compiler location.
  6. Copy the downloaded config file to .config
  7. Type make menuconfig, make some adjustment, and exit the menu
  8. Type make to compile the kernel
  9. If all went well, you will get arch/arm/boot/zImage

Booting the kernel

Setup your serial port, I am using kermit, you can use your favorite program to connect to the serial port, the parameter is 38400N1. Here is my ~/.kermrc file (I am using USB to serial).

set line /dev/ttyUSB0
set speed 38400 
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

Now hold the reset button, and turn on the agestar. This will bring you to STR9100> prompt. Put the zImage at your TFTP server, and then type this:

tftpboot 0x1000000 zImage

You may need to set the ARM boot environment (type help) or adjust your TFTP server IP address. If all went well, type:

go 0x1000000

That was only for testing that you can boot the kernel successfully.

Prepare your harddrive

Format it as you like it, have a partition for swap. I think you should use EXT3 for the root partition. Remember the partition number. If you use internal harddisk you will use /dev/sdaX as partition id, if you use external harddisk connected to USB, you will use /dev/sdbX.

Prepare bootstrap

These instructions are based from http://wiki.dns323.info/howto:install_debian. Do these steps from your PC Debian Machine:

i2:~# apt-get install cdebootstrap
Reading package lists... Done
Building dependency tree... Done
cdebootstrap is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
(Note - I already had this installed)
i2:~# mkdir agestar
i2:~# cd agestar
i2:~/agestar# cdebootstrap -aarm etch etch ftp://ftp.us.debian.org/debian
P: Retrieving Release.gpg
P: Retrieving Release
P: Parsing Release
P: Retrieving Release
.
.
.
P: Extracting util-linux
E: Couldn't install system due to errors!''

The error at the end is normal. Now make some normal devices.

i2:~/agestar# cd etch/dev
i2:~/agestar/etch/dev# /sbin/MAKEDEV generic-arm
i2:~/agestar/etch/dev# /sbin/MAKEDEV md

These following for the flash driver. You really do not want to overwrite mtdblock0 since on agestar, that is the armboot, so we make it read-only. As long as you have a serial port and armboot, you can recover the device.

i2:~/agestar/etch/dev# mknod mtdblock0 b 31 0
i2:~/agestar/etch/dev# mknod mtdblock1 b 31 1
i2:~/agestar/etch/dev# mknod mtdblock2 b 31 2
i2:~/agestar/etch/dev# chmod 660 mtdblock*
i2:~/agestar/etch/dev# chmod 440 mtdblock0

Now, copy everything to your disk that you are going to put at the Agestar, put all files on ~/agestar/etch/ to the root partition. Use USB cable to copy the files, much easier and faster.

Installing Debian

Compile the kernel, make sure you use this parameter for the boot options:

console=ttyS0,38400 root=/dev/sda2 rootdelay=10 init=/bin/sh

Adjust /dev/sda2 to your partition. Don't for get the init=/bin/sh. If you use USB cable to transfer the files to the agestar, Unplug the cable from your machine. Boot the device using the new kernel. Now you should reach command prompt. Do these steps on the Agestar:

sh-3.1# cd /var/cache/bootstrap
sh-3.1# export PATH
sh-3.1# mount -t proc proc /proc
warning: can't open /etc/fstab: No such file or directory
sh-3.1# dpkg --force-all -i libc6*deb
Selecting previously deselected package libc6.
(Reading database ... 0 files and directories currently installed.)
Unpacking libc6 (from libc6_2.3.6.ds1-13etch2_arm.deb) ...
dpkg: libc6: dependency problems, but configuring anyway as you request:
 libc6 depends on tzdata; however:
  Package tzdata is not installed.
Setting up libc6 (2.3.6.ds1-13etch2) ...

sh-3.1# dpkg --force-all -i dpkg*deb
Selecting previously deselected package dpkg.
dpkg: regarding dpkg_1.13.25_arm.deb containing dpkg, pre-dependency problem:
 dpkg pre-depends on coreutils (>= 5.93-1)
dpkg: warning - ignoring pre-dependency problem !
(Reading database ... 306 files and directories currently installed.)
Unpacking dpkg (from dpkg_1.13.25_arm.deb) ...
dpkg: dpkg: dependency problems, but configuring anyway as you request:
 dpkg depends on coreutils (>= 5.93-1); however:
  Package coreutils is not installed.
Setting up dpkg (1.13.25) ...

sh-3.1# dpkg --force-all -i libc6*deb
(Reading database ... 532 files and directories currently installed.)
Preparing to replace libc6 2.3.6.ds1-13etch2 (using libc6_2.3.6.ds1-13etch2_arm.deb) ...
Unpacking replacement libc6 ...
dpkg: libc6: dependency problems, but configuring anyway as you request:
 libc6 depends on tzdata; however:
  Package tzdata is not installed.
Setting up libc6 (2.3.6.ds1-13etch2) ...

sh-3.1# dpkg -iGREB .

The above will ask questions and generate a lot of output (and it will take quite a long time). Continue re-running the last command (dpkg -iGREB .) until you don't get any errors. It will tell you at the end of the run if there were errors. It took 4 times for me to get this to be 100% clean. It gave an error at the end about /var/mail already existing. Do 'rm /var/mail' after the 3rd time to get it to run clean.

# vi /etc/inittab
Find the line that says:
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
and turn it into:
T0:23:respawn:/sbin/getty -L ttyS0 38400 vt100

Comment all other getty lines (saves memory).

Now set up fstab:

# vi /etc/fstab

For example this is what i use (first partition is swap, and the next parition is for the root partition):

# [file system] [mount point]           [type]  [options]     [dump]  [pass]
/dev/sda1       none                    swap    sw              0       0
/dev/sda2       /                    ext3    defaults              0       0
proc            /proc                   proc    defaults        0       0

Test

Do sync and restart Debian. Compile your kernel again, this time removing init=/bin/sh, so the parameter is:

console=ttyS0,38400 root=/dev/sda2 rootdelay=10

If everything went well, you can install anything you like. I suggest you install NTP to adjust the time.

Make it permanent

If all went well, now we can write the kernel to the flash.

Transfer arch/arm/boot/zImage to your agestar. Write to flash by using:

dd if=zImage of=/dev/mtdblock1

It will take some time to finish, just pray it will work. Test by rebooting agestar.

And finally: Good Luck.

Copyright © 2008 Yohanes Nugroho