Gentoo 2008.0 For N1200

Introduction
General Disclaimer: Note that if this guide is not followed correctly that you could damage your N1200 in a non-recoverable manner. Also through some unlikely event it may not work for you and you may be unable to use your NAS. We have however tested this guide thoroughly on our hardware and not had any issues whatsoever!

Note that you are responsible for backing up your device before carrying out this procedure.

This distribution is based on the NAS-Central PowerPC Gentoo preparation guide.

Known Issues
Be aware that this distribution does not include a daemon/utility/scripts for LED or button event control. Hence some of the LEDs will not function correctly and the buttons will not work.

Hardware

 * Serial port access to your N1200

Files

 * foonas-em alpha for N1200
 * Gentoo install and cuImage kernel file

Boot foonas-em
Download the files in the foonas-em link above and follow the guide on this wiki on how to boot a kernel and ramdisk on a N1200. Once you have booted this firmware login with the user root and the password hydr0g3n.

Partition Device And Format
The Gentoo image ships with the fstab configured for the following layout:


 * /dev/sda1 - 128MB for boot (ext2, not used)
 * /dev/sda2 - 512MB for swap
 * /dev/sda3 - The rest for root (ext3)

You may wish to use other filesystem types such as jfs for the root partition, or even store your data on another partition altogether. If you wish to do so, change /etc/fstab accordingly. Use fdisk to create this partition layout. Following this format the filesystems and mkswap the swap partition:

mke2fs /dev/sda1 mkswap /dev/sda2 swapon /dev/sda2 mke2fs -j /dev/sda3

Mount Partitions And Install
Firstly mount the partitions in the correct places:

mount /dev/sda3 /mnt cd /mnt mkdir boot mount /dev/sda1 /mnt/boot

Now wget the distribution and extract it, in our case tar has no z option so we use tar and gunzip to extract the archive:

wget http://downloads.thecus.nas-central.org/N1200/Distributions/Gentoo_2008.0/gentoo-2008.0-n1200-v1.tar.gz gunzip gentoo-2008.0-n1200-v1.tar.gz tar xf gentoo-2008.0-n1200-v1.tar

Install And Flash Kernel
wget the kernel to the correct place:

cd /mnt/boot wget http://downloads.thecus.nas-central.org/N1200/Distributions/Gentoo_2008.0/cuImage.thecus_n1200

Check that mtd3 is the kernel mtd:

cat /proc/mtd

You should see output similar to:

dev:   size   erasesize  name mtd0: 00040000 00020000 "u-boot" mtd1: 00040000 00020000 "u-boot config" mtd2: 00100000 00020000 "user" mtd3: 001a0000 00020000 "kernel" mtd4: 004e0000 00020000 "ramdisk"

Now flash the kernel to the corresponding /dev/mtdblock device - in this case /dev/mtdblock3:

dd if=/mnt/boot/cuImage.thecus_n1200 of=/dev/mtdblock3 bs=1k

This will take some time, following this you should see output similar to (but maybe not exactly the same as):

1611+1 records in 1611+1 records out

You should now unmount /mnt/boot:

cd /mnt umount /mnt/boot

Configure Distribution

 * Configure a hostname by editing /mnt/etc/conf.d/hostname
 * Configure a domain name by editing /mnt/etc/conf.d/domainname

Now, remove the UTC default timezone and look at the selection of timezones:

rm -f /mnt/localtime ls /mnt/usr/share/zoneinfo

Install the correct timezone, here we use London as as example:

cp /mnt/usr/share/zoneinfo/Europe/London /mnt/etc/localtime

Now configure /etc/conf.d/clock to match this:

vi /mnt/etc/conf.d/clock TIMEZONE="Europe/London"

To do: Editing /etc/rc.conf, /etc/conf.d/rc and /etc/conf.d/keymap

Finally use the fw_setenv utility within foonas-em to configure u-boot to load your distro:

fw_setenv genboot 'setenv bootargs root=/dev/sda3 rw console=ttyS0,115200;bootm FE180000' fw_setenv bootcmd 'run genboot'

Finishing Up
Unmount the remaining partition and reboot into your distribution. Use the root user with the password hydr0g3n to login with once it has finished booting up for the first time. Both serial and ssh will be available to login to:

cd / umount /mnt reboot

Install Fan Control Script
Read the N1200 and N2100 fan control page for installation information.

Install Cron And Syslogd
Install syslogd and cron daemons and start them up:

emerge syslog-ng vixie-cron rc-update add syslog-ng default rc-update add vixie-cron default /etc/init.d/syslog-ng start /etc/init.d/vixie-cron start

Configure U-Boot Utilities
You need to configure u-boot utilities that allow you to modify u-boot configuration settings. Whilst you can temporarily change u-boot settings in u-boot the only way you can change them forever is with these utilities, from within Linux. Open the file /etc/fw_env.config and remove everything from it and enter the following:

/dev/mtd1              0x0000          0x2000          0x20000
 * 1) Configuration file for fw_(printenv/saveenv) utility.
 * 1) MTD device name       Device offset   Env. size       Flash sector size

You should be careful using these utilities as if you make a wrong change you may need to use a serial connection to the N1200 to correct your mistake if you render your device unable to boot.

Configure Local Portage Mirror
Install the mirrorselect utility and choose a better mirror:

emerge mirrorselect

To do: Finish this bit

Set A Password
It is important that you change the root password as soon as possible:

passwd