Last weekend I've been working on configuring a Linux kernel that will run on the NAS200 without modifications. The Linksys kernel has a number of modifications for the RDC3211 chip but the mainline kernel now supports the RDC321x thanks to Florian Fainelli who works on RDC support at the OpenWRT project. Basically, I took the .config from Jac2b and copied it into the kernel source tree of Gentoo 2.6.27-r8 (I used the Gentoo patches but it should work with a plain vanilla kernel tree as well; it was just easier for me to do it this way because I already had a Linux system based on Gentoo). I ran "make oldconfig" and then kept compiling and tweaking until I got it to run on the NAS200. The .config file is here. It's a work in progress; some stuff is implemented and some stuff is not. The main line kernel supports the GPIO for the LEDs and the fan, but there's no software in Gentoo that controls them, so the LEDs and fan stay on. Some stuff doesn't work at all yet, such as the Real-Time-Clock; I tried to get I2C and the RTC going but when I did that, the unit kept turning off its power in the middle of the boot. I didn't flash anything into the ROM, I simply used Redboot to download the kernel from a TFTP server (HTTP is also supported but TFTP was easier to set up for me). It was pretty easy to get the kernel to boot up to the point of the panic where it can't mount the root file system. It took me a while before I figured out how to partition the flash (in the Linksys kernel this is hard-coded in the kernel, I did it from the kernel command line). Then I realized that it's not much use anyway because even though Squashfs is supported in this Gentoo kernel, LZMA is not. Unfortunately the Squashfs-LZMA team announced that now Squashfs is part of the kernel, they will not do any further LZMA kernel patches and we'll just have to wait until LZMA gets merged as well, probably around version 2.6.30 as far as I understand. So I decided I might as well use the hard disk as root file system instead of the flash. I could of course copy the Linksys root filesystem to the harddisk but I thought, let's go one step further and try a Gentoo root file system. I unpacked the stage3 tarball for x86 (not i686!) for Gentoo 2008.0 and a recent Portage snapshot into /harddisk/volume_1/data (/dev/sda1). I had to re-pack it into a tar.gz using my Linux PC because Jac2 doesn't have bzip2 decompression. I tweaked some of the configuration files using the Gentoo handbook (I've done many Gentoo installs before). The config file tweaks are also a work in progress as you can see from the boot warnings and errors; for example it detects both network adapters but only starts eth0 and fails. One of the files that needed to be edited was /etc/inittab so that there are no regular consoles, only a serial port console at 38400 bps which is what I used (in combination with Teraterm Pro) to generate the log. Code: +Ethernet eth0: MAC address 00:01:02:03:04:05 IP: 192.168.21.249/255.255.254.0, Gateway: 192.168.20.254 Default server: 0.0.0.0 RedBoot(tm) bootstrap and debug environment [ROM] Non-certified release, version v2_0 - built 10:54:50, Jun 22 2007 Platform: PC (I386) Copyright (C) 2000, 2001, 2002, Red Hat, Inc. RAM: 0x00000000-0x000f0000, 0x000720b0-0x000a0000 available R3210 00:0012 11-01-2006 <press Ctrl+C to enter prompt mode> RedBoot> ^C RedBoot> ip_address -l 192.168.1.7 IP: 192.168.1.7/255.255.254.0, Gateway: 192.168.20.254 Default server: 0.0.0.0 RedBoot> load -r -v -h 192.168.1.112 -m tftp -b 0x400000 bzImage-NAS200 | Raw file loaded 0x00400000-0x0063060f, assumed entry at 0x00400000 RedBoot> linux -b 0x400000 -l 0x300000 -r 0xfffa00000 -s 0x600000 -c "console=ttyS0,38400 mtdparts=physmap-flash.0:0x1c0000(Kernel),0x600000(Initrd),0x20000(Config),0x20000(Redboot) root=/dev/sda1" mem_size: 2000000 initrd 1a00000 len 600000 Linux version 2.6.27-gentoo-r8-NAS200 (root@coppertoo) (gcc version 4.1.2 (Gentoo 4.1.2 p1.1)) #28 Sun Mar 1 19:59:12 MST 2009 BIOS-provided physical RAM map: BIOS-e801: 0000000000000000 - 000000000009f000 (usable) BIOS-e801: 0000000000100000 - 0000000002000000 (usable) DMI not present or invalid. last_pfn = 0x2000 max_arch_pfn = 0x100000 RAMDISK: 01a00000 - 02000000 ACPI Error (tbxfroot-0218): A valid RSDP was not found  ACPI: no DMI BIOS year, acpi=force is required to enable ACPI ACPI: Disabling ACPI support 32MB LOWMEM available. mapped low ram: 0 - 02000000 low ram: 00000000 - 02000000 bootmap 00001000 - 00001400 (7 early reservations) ==> bootmem [0000000000 - 0002000000] #0 [0000000000 - 0000001000] BIOS data page ==> [0000000000 - 0000001000] #1 [0000100000 - 00005592c8] TEXT DATA BSS ==> [0000100000 - 00005592c8] #2 [0001a00000 - 0002000000] RAMDISK ==> [0001a00000 - 0002000000] #3 [000055a000 - 000055d000] INIT_PG_TABLE ==> [000055a000 - 000055d000] #4 [000009f000 - 0000100000] BIOS reserved ==> [000009f000 - 0000100000] #5 [0000007000 - 000000d000] PGTABLE ==> [0000007000 - 000000d000] #6 [0000001000 - 0000002000] BOOTMAP ==> [0000001000 - 0000002000] Zone PFN ranges: DMA 0x00000000 -> 0x00001000 Normal 0x00001000 -> 0x00002000 Movable zone start PFN for each node early_node_map active PFN ranges 0: 0x00000000 -> 0x0000009f 0: 0x00000100 -> 0x00002000 Allocating PCI resources starting at 10000000 (gap: 2000000:fe000000) Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8031 Kernel command line: console=ttyS0,38400 mtdparts=physmap-flash.0:0x1c0000(Kernel),0x600000(Initrd),0x20000(Config),0x20000(Redboot) root=/dev/sda1 Initializing CPU#0 PID hash table entries: 128 (order: 7, 512 bytes) Console: colour dummy device 80x25 console [ttyS0] enabled Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory: 21452k/32768k available (2896k kernel code, 10924k reserved, 1213k data, 192k init, 0k highmem) virtual kernel memory layout: fixmap : 0xffff9000 - 0xfffff000 ( 24 kB) vmalloc : 0xc2800000 - 0xffff7000 ( 983 MB) lowmem : 0xc0000000 - 0xc2000000 ( 32 MB) .init : 0xc0506000 - 0xc0536000 ( 192 kB) .data : 0xc03d40df - 0xc05036b0 (1213 kB) .text : 0xc0100000 - 0xc03d40df (2896 kB) Checking if this processor honours the WP bit even in supervisor mode...Ok. Calibrating delay loop... 49.66 BogoMIPS (lpj=248320) Mount-cache hash table entries: 512 CPU: 486 Checking 'hlt' instruction... OK. Freeing SMP alternatives: 0k freed khelper used greatest stack depth: 7516 bytes left net_namespace: 320 bytes NET: Registered protocol family 16 PCI: Using configuration type 1 for base access khelper used greatest stack depth: 7324 bytes left ACPI: Interpreter disabled. Linux Plug and Play Support v0.97 (c) Adam Belay pnp: PnP ACPI: disabled SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb PCI: Probing PCI hardware bus: 00 index 0 io port: [0, ffff] bus: 00 index 1 mmio: [0, ffffffff] NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 2, 20480 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP reno registered NET: Registered protocol family 1 checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd Freeing initrd memory: 6144k freed platform rtc_cmos: registered platform RTC device (no PNP device found) audit: initializing netlink socket (disabled) type=2000 audit(1249617720.956:1): initialized HugeTLB registered 4 MB page size, pre-allocated 0 pages VFS: Disk quotas dquot_6.5.1 Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) squashfs: version 3.4 (2008/08/26) Phillip Lougher NTFS driver 2.1.29 [Flags: R/W]. JFFS2 version 2.2. (NAND) Â© 2001-2006 Red Hat, Inc. SGI XFS with security attributes, large block numbers, no debug enabled SGI XFS Quota Management subsystem msgmni has been set to 53 io scheduler noop registered io scheduler anticipatory registered (default) io scheduler deadline registered io scheduler cfq registered Serial: 8250/16550 driver4 ports, IRQ sharing enabled Ã¿serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A brd: module loaded loop: module loaded <6>r6040: RDC R6040 NAPI net driver,version 0.18 (13Jul2008) <6>r6040: RDC R6040 NAPI net driver,version 0.18 (13Jul2008) Driver 'sd' needs updating - please use bus_type methods sata_sil 0000:00:04.0: enabling device (0005 -> 0007) sata_sil 0000:00:04.0: cache line size not set. Driver may not function sata_sil 0000:00:04.0: Applying R_ERR on DMA activate FIS errata fix scsi0 : sata_sil scsi1 : sata_sil ata1: SATA max UDMA/100 mmio m512@0x10080000 tf 0x10080080 irq 9 ata2: SATA max UDMA/100 mmio m512@0x10080000 tf 0x100800c0 irq 9 ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310) ata1.00: ATA-7: ST3500630AS, 3.AAE, max UDMA/133 ata1.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 0/32) ata1.00: configured for UDMA/100 ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 310) ata2.00: ATA-8: WDC WD10EACS-65D6B0, 01.01A01, max UDMA/133 ata2.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 0/32) ata2.00: configured for UDMA/100 scsi 0:0:0:0: Direct-Access ATA ST3500630AS 3.AA PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sda3 sd 0:0:0:0: [sda] Attached SCSI disk sd 0:0:0:0: Attached scsi generic sg0 type 0 scsi 1:0:0:0: Direct-Access ATA WDC WD10EACS-65D 01.0 PQ: 0 ANSI: 5 sd 1:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB) sd 1:0:0:0: [sdb] Write Protect is off sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 1:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB) sd 1:0:0:0: [sdb] Write Protect is off sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sdb: sdb1 sdb2 sdb3 sd 1:0:0:0: [sdb] Attached SCSI disk sd 1:0:0:0: Attached scsi generic sg1 type 0 physmap platform flash device: 00800000 at ff800000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Using buffer write method Using auto-unlock on power-up/resume cfi_cmdset_0001: Erase suspend on write enabled 4 cmdlinepart partitions found on MTD device physmap-flash.0 Creating 4 MTD partitions on "physmap-flash.0": 0x00000000-0x001c0000 : "Kernel" 0x001c0000-0x007c0000 : "Initrd" 0x007c0000-0x007e0000 : "Config" 0x007e0000-0x00800000 : "Redboot" ehci_hcd 0000:00:0a.1: EHCI Host Controller ehci_hcd 0000:00:0a.1: new USB bus registered, assigned bus number 1 ehci_hcd 0000:00:0a.1: irq 14, io mem 0xc1000000 ehci_hcd 0000:00:0a.1: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1: Product: EHCI Host Controller usb usb1: Manufacturer: Linux 2.6.27-gentoo-r8-NAS200 ehci_hcd usb usb1: SerialNumber: 0000:00:0a.1 ohci_hcd 0000:00:0a.0: OHCI Host Controller ohci_hcd 0000:00:0a.0: new USB bus registered, assigned bus number 2 ohci_hcd 0000:00:0a.0: irq 15, io mem 0xc1001000 usb usb2: configuration #1 chosen from 1 choice hub 2-0:1.0: USB hub found hub 2-0:1.0: 2 ports detected usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb2: Product: OHCI Host Controller usb usb2: Manufacturer: Linux 2.6.27-gentoo-r8-NAS200 ohci_hcd usb usb2: SerialNumber: 0000:00:0a.0 USB Universal Host Controller Interface driver v3.0 Initializing USB Mass Storage driver... usbcore: registered new interface driver usb-storage USB Mass Storage support registered. PNP: No PS/2 controller found. Probing ports directly. i8042.c: Warning: Keylock active. serio: i8042 KBD port at 0x60,0x64 irq 1 mice: PS/2 mouse device common for all mice i2c /dev entries driver md: raid0 personality registered for level 0 md: raid1 personality registered for level 1 md: multipath personality registered for level -4 device-mapper: ioctl: 4.14.0-ioctl (2008-04-23) initialised: firstname.lastname@example.org TCP cubic registered NET: Registered protocol family 17 RPC: Registered udp transport module. RPC: Registered tcp transport module. Using IPI Shortcut mode md: Autodetecting RAID arrays. md: Scanned 0 and added 0 devices. md: autorun ... md: ... autorun DONE. RAMDISK: Couldn't find valid RAM disk image starting at 0. UDF-fs: No VRS found XFS mounting filesystem sda1 Starting XFS recovery on filesystem: sda1 (logdev: internal) XFS resetting qflags for filesystem sda1 Ending XFS recovery on filesystem: sda1 (logdev: internal) VFS: Mounted root (xfs filesystem). Freeing unused kernel memory: 192k freed khelper used greatest stack depth: 6932 bytes left INIT: version 2.86 booting consoletype used greatest stack depth: 6608 bytes left stty used greatest stack depth: 6536 bytes left Gentoo Linux; http://www.gentoo.org/ Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 Press I to enter interactive boot mode * Mounting proc at /proc ... [ ok ] * Mounting sysfs at /sys ... [ ok ] * Mounting /dev for udev ... [ ok ] * Seeding /dev with needed nodes ... [ ok ] * Starting udevd ... [ ok ] * Populating /dev with existing devices through uevents ... [ ok ] * Letting udev process events ... [ ok ] * Finalizing udev configuration ... [ ok ] * Mounting devpts at /dev/pts ... [ ok ] * Remounting root filesystem read-only ... [ ok ] * Checking root filesystem ...fsck: fsck.xfs: not found fsck: Error 2 while executing fsck.xfs for /dev/sda1 [ ok ] * Remounting root filesystem read/write ... [ ok ] * Updating /etc/modprobe.conf by hand ... [ ok ] FATAL: Could not load /lib/modules/2.6.27-gentoo-r8-NAS200/modules.dep: No such file or directory * Checking all filesystems ...fsck: cannot check /dev/sda1: fsck.xfs not found [ ok ] * Mounting local filesystems ... [ ok ] * Activating (possible) swap ... [ ok ] * Your TIMEZONE in /etc/conf.d/clock is still set to Factory! * Setting system clock using the hardware clock [UTC] ... [ ok ] * Configuring kernel parameters ... [ ok ] * Updating environment ... [ ok ] * Cleaning /var/lock, /var/run ... [ ok ] * Wiping /tmp directory ... [ ok ] * Caching service dependencies ... [ ok ] * Device initiated services: net.eth0 udev-postmount * Setting hostname to localhost ... [ ok ] * Loading key mappings ... [ ok ] * Setting terminal encoding to UTF-8 ... [ ok ] * Setting user font ... [ ok ] * Starting lo * Bringing up lo * 127.0.0.1/8 [ ok ] * Adding routes * 127.0.0.0/8 ... [ ok ] * Starting eth0 SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address * Configuration not set for eth0 - assuming DHCP * No DHCP client installed [ !! ] * Initializing random number generator ... [ ok ] INIT: Entering runlevel: 3 * Mounting network filesystems ... [ ok ] * Starting local ... [ ok ] modprobe: FATAL: Could not load /lib/modules/2.6.27-gentoo-r8-NAS200/modules.dep: No such file or directory This is localhost.unknown_domain (Linux i486 2.6.27-gentoo-r8-NAS200) 04:04:22 localhost login: By the way, if you have Jac2b running, you can play around with Gentoo a little bit (even if you don't have a serial port) without loading the kernel, by simply unpacking a stage3 to the root of the first hard disk and (optionally) a portage snapshot to the usr directory and chrooting to it. Remember to use tar xvzp -f yourconvertedtarball.tgz (don't forget the p option to make sure protections are set properly) -- the Busybox tar is a little wonky so the -f option must be separate. Remember to copy /etc/resolv.conf to the chroot /etc first or no Internet addresses will resolve, and you may also want to mount proc and bind-mount /dev. After you chroot into a Gentoo tree, you should always source /etc/profile and then run env-update. It should even be possible to unpack and run Debian or another i386/i486 based distro by unpacking it to the root of a harddisk and writing an early.sh that starts it by mounting proc, bind-mounting dev and chrooting to the new root filesystem with something like chroot /harddisk/volume_1/data/sbin/init. Your chroot should remove the earlyfail file as part of its startup scripts. I'm planning on doing some more tweaks to the kernel .config and then I'll probably work on an OpenWRT build for the NAS200. ===Jac PS for a serial console you will need a MAX3232 level converter for RS-232. Some cellphone serial cables provide a USB serial port for which you don't need the MAX3232. For more information check www.nslu2-linux.org. The pinout of the NAS200 serial port is identical to the one on the NSLU2.