Difference between revisions of "Kurobox support in stock 2.6 kernels"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Install u-boot into FLASH)
(u-boot)
Line 70: Line 70:
 
  $ ln -sf linux-2.6.23.9 linux
 
  $ ln -sf linux-2.6.23.9 linux
  
===u-boot===
+
===U-Boot===
  
 
The current latest working version of U-Boot for the Kurobox is 1.2.0 (as of this writing, 12/3/2007). We'll need to apply patches to this version, however, for this work. Don't worry about the trailing CR's in the patch files, they'll be stripped at patch-time.
 
The current latest working version of U-Boot for the Kurobox is 1.2.0 (as of this writing, 12/3/2007). We'll need to apply patches to this version, however, for this work. Don't worry about the trailing CR's in the patch files, they'll be stripped at patch-time.

Revision as of 12:51, 25 January 2008

As of 2.6.20-rc2, standard kernels support the Linkstation and Kurobox with no additional kernel patches. This page will document all the stuff you need to run these kernels by the installation of the U-Boot bootloader.

Contents

Introduction

This page differs from the older Using a custom kernel and loader.o guide in one important respect:

  • The 2.6.20 kernel has an additional requirement: a *.dtb file, which is a database of hardware peripherals, supplied by the bootloader.

The good thing about this is, it will allow you to build a generic PowerPC kernel which works unchanged on all sorts of devices.

The bad thing is, it requires a bootloader with support for dtb files. At time of writing, this means U-Boot from git (not the old 1.1.4 release), and it also rules out the loader.o hack. But read on... we'll be using the uloader.o hack instead.

Assumptions

You should have a normal linux PC, or an Apple Mac, on the same ethernet network, and the ability to run netcat ('nc') on that machine.

You should also have a normal Linux distribution installed on the hard drive of your Kurobox, and booting properly. Your Kurobox will also need a working C compiler, as we will be compiling everything directly on it. It will also need the following tools & libraries installed: bzip2, git-core, make, patch, perl, tar, unzip, wget,bison, flex, libncurses5-dev and your text editor of choice. My command listings will use "$" to indicate commands run as a normal user, and "#" to indicate commands to be run as root. Most of this stuff will be done as a normal user, and unless specified otherwise, all commands should be run on the Kurobox directly.

If you do not already have a linux distribution installed on your hard drive, I recommend Gentoo or Debian. (I use Gentoo Linux, so I already know my compiler works.) You could set up a cross compiler on your PC/Mac and use that, but setting up such things is described elsewhere.

My U-Boot configuration modifications assume your linux box does not have a separate partition for /usr or /usr/src. In other words, this directory should be on the root partition (/). If this is not the case, you will need a different value for the U-Boot "ubpart" environment variable. If you don't get this right, U-Boot won't be able to find the right file when you tell it to write U-Boot into flash, and will output an error message.

Note that you MUST be running either the 2.4.17 or the 2.4.20 kernel in order to flash or try U-Boot on RAM. This is because the uloader.o, a module which is required for those processes, is only compatible with those kernels. If you have installed other kernels, you can still follow this procedure by going into EM mode.

Safety

Read the Rough edges section before you begin, to understand the things you should watch out for.

Do not attempt this unless you feel comfortable hacking C sources. Do not attempt this unless you are comfortable with linux, normal users and root user, permissions, and that kind of thing. Also, don't attempt this unless you have a day or two to play around with it. This is not a 15 minute exercise.

Most of the stuff you'll be doing here is pretty harmless. If you follow these instructions correctly, you won't be in any danger of bricking your box until you get to the actual flashing part, in Install u-boot into FLASH, below. But you'll be testing a RAM build first, and you'll be using netconsole, so you should be able to spot any problems before you re-flash anything. Notice, that even a successful RAM-based U-boot test does NOT guarantee that the eventual re-flashing will be successful too, so even then exists the possibility for bricking your system.

Guennadi Liakhovetski developed the kernel support, with his Kurobox HG. I am using a Kurobox HG, too. He thinks it will work with Kurobox HDs, Linkstation I, Terastations, i.e., all compatible PPC-based systems, but I have yet to hear of anyone who has tested it. I would be very interested to hear from anyone who does test it... at least you should be safe with a RAM build without risk of bricking your unit.

Finally, this will violate your warranty. If you didn't already know that, maybe this isn't for you.

Getting the things you need

You will need the following:

nc

You will need nc, also known as 'netcat', installed on your PC (Apple Macs normally have it pre-installed). If you don't have it you should be able to use apt-get or emerge or whatever to install it... if you can't find a package for your distribution, its website is here. So, install that and make sure it works.

paranoid@chirp ~ $ nc -h
[v1.10]
connect to somewhere:   nc [-options] hostname port[s] [ports] ...
listen for inbound:     nc -l -p port [-options] [hostname] [port]
[etc etc etc]

kurobox setup

As mentioned in the Assumptions and Safety section above, you will need to install the following tools & libraries: bzip2, git-core, make, patch, perl, tar, unzip, wget, bison, flex, libncurses5-dev, gcc. The details of installing packages varies from distribution to distribution, but generally you can use apt-get on Debian, or emerge on Gentoo, to install these packages.

We will be compiling most things as a normal user; make sure our build directory is writable by that user. My Kurobox user is "paranoid", and Gentoo uses "users" as the group name; please replace this with your user/group of choice.

$ su
# chown -R paranoid:users /usr/src
# exit

kernel

Download the linux kernel sources onto your Kurobox, in the /usr/src directory. 2.6.20 is current at time of writing, and that's what I'm using.

[12/3/2007 - Update] - 2.6.23.9 installed successfully using this article's described method.

$ cd /usr/src
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.9.tar.bz2
$ tar xjf linux-2.6.23.9.tar.bz2
$ ln -sf linux-2.6.23.9 linux

U-Boot

The current latest working version of U-Boot for the Kurobox is 1.2.0 (as of this writing, 12/3/2007). We'll need to apply patches to this version, however, for this work. Don't worry about the trailing CR's in the patch files, they'll be stripped at patch-time.

$ cd /usr/src
$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.2.0.tar.bz2
$ wget http://www.kurobox.com/revolution/downloads/contest/patches.zip
$ tar jvxf u-boot-1.2.0.tar.bz2
$ unzip patches.zip
$ cd u-boot-1.2.0
$ patch -p1 < ../u-boot-kurobox.patch
$ patch -p1 < ../u-boot-kurobox-fdt.patch

dtc tool

There are several versions of this tool floating around; I believe this is the latest one:

$ cd /usr/src
$ git clone git://www.jdl.com/software/dtc.git dtc

Build dtc

The "dtc" tool will be used later on to compile the hardware database source file, *.dts, into a hardware database binary, *.dtb. So, build it and put it in /usr/local/bin.

$ cd /usr/src/dtc
$ make
$ su
# ln -sf /usr/src/dtc/dtc /usr/local/bin/
# exit

Set up a netconsole

You nowl need to run netcat on your PC or Apple Mac in order to communicate with U-boot over your LAN. This allows you to interact with the bootloader so you can see what is happening, and to send it commands.

You will need to have your PC or Apple Mac and your Kurobox on the same LAN, and you'll need to know the IP addresses of both. Write them down.

On your PC or Apple Mac run the following command, replacing 1.2.3.4 with the IP address of your Kurobox:

$ nc -u -p 6666 -v -v 1.2.3.4 6666

Netcat should output a message like the following, and then sit there waiting to receive packets from the network:

1.2.3.4: inverse host lookup failed:
(UNKNOWN) [1.2.3.4] 6666 (?) open

Leave this window open as we will be using it later.

Configure U-Boot

This part requires some text editing in order to change the values included in the Kurobox patch into something which will be useful for you. I'm just documenting my own modifications here; it's likely that not all of them are necessary. Consider this section a work in progress; feel free to edit, simplify and clarify.

Go into the U-Boot sources and open your text editor (vi, ne, lpe, jed, nano, whatever) on the linkstation config file:

$ cd /usr/src/u-boot-1.2.0
$ ne include/configs/linkstation.h

Find the IP addresses on line 38:

#define CONFIG_IPADDR_LS       192.168.11.150
#define CONFIG_SERVERIP_LS     192.168.11.149

Change these addresses so that CONFIG_IPADDR_LS is the IP address of your Kurobox, and CONFIG_SERVERIP_LS is the IP address of your PC or Apple Mac. These addresses determine where the netconsole packets go so it is important to get these right. Here's a silly example:

#define CONFIG_IPADDR_LS       1.2.3.4
#define CONFIG_SERVERIP_LS     5.6.7.8

Find CONFIG_BOOTARGS on line 129. It currently says:

#define CONFIG_BOOTARGS                        "root=/dev/hda1"

You need to change it to the following replacing 1.2.3.4 with your Kurobox IP, and 5.6.7.8 with your PC/Apple Mac IP:

#define CONFIG_BOOTARGS                        "root=/dev/sda1 netconsole=6666@1.2.3.4/,@5.6.7.8/ rtc-rs5c372.probe=0,0x32"

Find the UBFILE definitions, on line 137. Originally they say:

#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
#define UBFILE                 "share/u-boot/u-boot-hd.flash.bin"
#elif defined(CONFIG_HGLAN)
#define UBFILE                 "share/u-boot/u-boot-hg.flash.bin"
#elif defined(CONFIG_HTGL)
#define UBFILE                 "share/u-boot/u-boot-ht.flash.bin"

Change them so they say:

#define IMAGEROOT "usr/src/"
#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
#define UBFILE                 IMAGEROOT "u-boot-hd.flash.bin"
#elif defined(CONFIG_HGLAN)
#define UBFILE                 IMAGEROOT "u-boot-hg.flash.bin"
#elif defined(CONFIG_HTGL)
#define UBFILE                 IMAGEROOT "u-boot-ht.flash.bin"

Note: 1 complete new line at the beginning, and 3 line changes; the addition of IMAGEROOT text and the removal of the words 'share/u-boot/'.

Finally, find the environment variable section, starting on line 148. This list becomes the default variables for U-Boot while it is running. Specifically we want to change the "ubpart=" on line 176:

       "ubpart=0:3\0"                                                          \

This means "hda3". My /usr/src/ is on the root partition, hda1, so I use:

       "ubpart=0:1\0"                                                          \

The combination of ubpart and UBFILE determine where U-Boot will find the FLASH version of itself. This is important later on when you write U-Boot to flash.

Build your U-Boot (RAM)

Now you're going to build a RAM version of U-Boot for testing. You will be building it differently depending on which unit you have:

Kurobox

$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HDLAN_RAM_config
$ make linkstation_HDLAN_RAM
$ cp u-boot-hd.ram.bin ..

Kurobox HG

$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HGLAN_RAM_config
$ make linkstation_HGLAN_RAM
$ cp u-boot-hg.ram.bin ..

Build your U-Boot (FLASH)

Now you're going to build a FLASH version of U-Boot which is what you will end up using. Like the RAM build above you will be building it differently depending on which unit you have:

Kurobox

$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HDLAN_config
$ make linkstation_HDLAN
$ cp u-boot-hd.flash.bin ..

Kurobox HG

$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HGLAN_config
$ make linkstation_HGLAN
$ cp u-boot-hg.flash.bin ..

Install mkimage

U-boot built a tool called "mkimage" as part of its build process. The kernel needs this tool in order to produce kernel images in the "uImage" file format. So we need to install it.

$ su
# ln -sf /usr/src/u-boot-1.2.0/tools/mkimage /usr/local/bin/
# exit

Alternatively, you can download a precompiled version:

# wget http://www.kurobox.com/sylver/u-boot/mkimage
# chmod 0755 mkimage
# mv mkimage /usr/local/bin/

Build your kernel

Start with the default linkstation config file, and enable any other options you need. Some guidelines:

  • The default linkstation config uses PATA, which is a separate driver from the normal IDE stuff. CONFIG_IDE should be disabled, otherwise they will conflict. The platform maintainer (Guennadi Liakhovetski) said he had problems with the IDE driver, which is why the kernel config uses the PATA driver instead.
  • The linkstation kernel config has enabled the right architecture options for the devices present in the kurobox. This means things like rtc, serial port, ethernet port, usb, etc. You might still want to add support for networking options, filesystems, and usb devices you may wish to use.

To get your config set up, do the following:

$ cd /usr/src/linux
$ cp arch/powerpc/configs/linkstation_defconfig .config
$ make menuconfig

Note: When the menu appears if you want to leave it at the default configuration just select 'exit' and yes to save.

When you're ready, build your kernel image (this takes quite some time, see note):

$ make uImage modules[1]
$ su
# make modules_install
# cp arch/powerpc/boot/uImage /boot/vmlinux.UBoot
# cp arch/powerpc/boot/dts/kuroboxHG.dts /boot/

Compile your .dtb file

This step is pretty easy. You just run the command documented in a comment at the top of the kuroboxHG.dts file.

$ cd /boot
$ su
# dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts
# exit

With the current version of the dtc tool you should get back:

DTC: dts->dtb  on file "kuroboxHG.dts"

Older versions used to give the following error/warnings but the resulting file is correct:

Warning: "linux,boot-cpu" property is deprecated in blob version 2 or higher
Warning: physical boot CPU not set.  Use -b option to set
ERROR: Missing /chosen node
Input tree has errors

My md5sums, for the curious:

daab8096fde51ea7e1dabcaefc89e98c  kuroboxHG.dtb
f903ceae405b543f068ee5649590cd6d  kuroboxHG.dts

Figure out your uloader.o

When I first loaded U-Boot, I followed the instructions on this page. I had some confusion, because that page said my Kurobox HG was supposed to be running a 2.4.20 kernel, but in fact it had a 2.4.17 kernel. Their 2.4.17 module was built for a normal kurobox... on an HG, it requires an extra module parameter. Since this took me a while to figure it out, I'm going to be extra-specific in this section.

You need to know what hardware you have, and what version of the kernel it is currently running. You might be running a 2.4.17 kernel, or a 2.4.20 kernel. You can find out what kernel you're running with the following command:

$ uname -a

Which will produce output like the following. I've highlighted the kernel version number:

Linux kuro-1 2.4.17_mvl21 #24 2004 10 19  17:17:03 JST ppc 82xx Sandpoint GNU/Linux 
             ^^^^^^

If you have installed another kernel, you will need to boot into EM mode, and issue the uname -a command there to figure out with kernel you will be using.

kurobox with 2.4.17 kernel

Download the 2.4.17 build of uloader, and prepare to use it.

$ cd /usr/src
$ wget http://www.linuxnotincluded.pwp.blueyonder.co.uk/linkstation/downloads/uloader-2.4.17.tar.gz
$ tar xzvf uloader-2.4.17.tar.gz
$ cp uloader-2.4.17/uloader.o .
$ echo 'sync;insmod -f uloader.o uboot=/usr/src/u-boot-hd.ram.bin && init 6' >u-boot-load-hd.sh
$ chmod +x u-boot-load-hd.sh

kurobox hg with 2.4.17 kernel

Download the 2.4.17 build of uloader, and prepare to use it.

$ cd /usr/src
$ wget http://www.linuxnotincluded.pwp.blueyonder.co.uk/linkstation/downloads/uloader-2.4.17.tar.gz
$ tar xzvf uloader-2.4.17.tar.gz
$ cp uloader-2.4.17/uloader.o .
$ echo 'sync;insmod -f uloader.o uboot=/usr/src/u-boot-hg.ram.bin laddr=0x07f00000 && init 6' >u-boot-load-hg.sh
$ chmod +x u-boot-load-hg.sh

kurobox hg with 2.4.20 kernel

Download the 2.4.20 build of uloader, and prepare to use it.

$ cd /usr/src
$ wget http://www.linuxnotincluded.pwp.blueyonder.co.uk/linkstation/downloads/uloader-2.4.20.tar.gz
$ tar xzvf uloader-2.4.20.tar.gz
$ cp uloader-2.4.20/uloader.o .
$ echo 'sync;insmod -f uloader.o uboot=/usr/src/u-boot-hg.ram.bin && init 6' >u-boot-load-hg.sh
$ chmod +x u-boot-load-hg.sh

Try out the RAM build of U-Boot

WARNING! If this step does not succeed fully, check your steps to this point, and do not proceed to the next step!

Finally we're ready to try it out. At this point you should have:

  • nc running on your PC or Apple Mac for the netconsole
  • a /usr/src/uloader.o file
  • a /boot/vmlinux.UBoot file

If you have a Kurobox HG you should also have:

  • a /usr/src/u-boot-load-hg.sh file
  • a /usr/src/u-boot-hg.flash.bin file
  • a /usr/src/u-boot-hg.ram.bin file
  • a /boot/kuroboxHG.dtb file

Otherwise a normal Kurobox owner should have:

  • a /usr/src/u-boot-load-hd.sh file
  • a /usr/src/u-boot-hd.flash.bin file
  • a /usr/src/u-boot-hd.ram.bin file

Now that you have all of these things, let's see if U-Boot runs correctly on your device. If you have a standard Kurobox, replace "u-boot-load-hg" with "u-boot-load-hd". Note: If you end up getting an error you're probably trying this using your 2.6 kernel. If so, skip down to the next section.

$ cd /usr/src
$ su
# sh u-boot-load-hg.sh

You've just logged out of the device, which should now be rebooting. After 10 to 20 seconds the green power LED should turn off, and then begin pulsing slowly. After a few more seconds you should see some text come up in the netconsole window:

U-Boot 1.1.6-g9be12153-dirty (Dec 28 2006 - 22:39:43) LinkStation HG / KuroBox HG
stdin :   nc
stdout:   nc
stderr:   nc
IDE:   Bus 0: OK
  Device 0: Model: WDC WD3200JB-00KFA0 Firm: 08.05J08 Ser#: WD-WCAMR3683645
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
Boot in 10 seconds ('s' to stop)...

Press "s" and hit "enter", to get to a U-Boot prompt.

Boot in 10 seconds ('s' to stop)...s

=>

Before we continue we need to make sure it can boot your existing 2.4.x kernel. This is done with the "run flboot" command and needs to be done to ensure you don't end up with a brick:

=> run flboot
run flboot
## Booting image at ffc00000 ...

******* Product Information *******
----------------------------------
Product Name: KURO-BOX/HG(IESHIGE)
         VER: 1.00
        Date: 2004/10/19 17:18:54
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x07C58000, end 0x07E6E615 ... OK
Booting the kernel 

After 2 to 4 minutes you should be able to ping and ssh back into your Kurobox.

If *anything* goes wrong with this step, you need to troubleshoot it before proceeding to the next step. Some possible pitfalls:

  • If you don't get any netconsole output: make sure the PC/Apple Mac and kurobox are on the same ethernet network. Check the IP addresses of both units. Check the IP addresses in the uboot source's linkstation.h, for the CONFIG_IPADDR_LS and CONFIG_SERVERIP_LS values, and for the CONFIG_BOOTARGS line. Check the IP in the command line when you ran nc on your PC/Apple Mac. Make sure you're using good ethernet cables, try a different port on your hub/switch, make sure the proper link lights are on for both the switch and Kurobox.
  • If U-Boot gives you error messages over netconsole, or if the old linux kernel fails to load, something is seriously wrong. Do not flash this version of U-Boot into your Kurobox, you will brick your unit. Start over. Note that it does take a few minutes to boot, so be patient and don't throw your kurobox at the nearest wall yet.

If you are not running 2.4.x kernels

This part of the guide applies to those who are running a kernel OTHER than 2.4.17 or 2.4.20. If you ARE under those kernels skip this whole section.

If you are not on a 2.4.x kernel, the previous step will fail because uload won't work. Assuming that you already have a working system with a 2.4-compatible insmod, installed to /dev/hda1, and that you have followed all the previous steps, here are the steps you can follow :

  • Turn the Kurobox on. Just when the power LED stops flashing, press the red button on the back. Wait for a while for the system to boot.
  • Telnet to your computer, login with root / kuroadmin:
$telnet 192.168.x.y
  • You need to ftp the tool to chroot to your OS on /dev/hda1. On your computer:
$wget http://www.kurobox.com/downloads/gentoo/EM_mode_binaries.tar.gz
  • Use your favorite ftp client to put the EM_mode_binaries.tar.gz file on /tmp/. FTP to your Kurobox IP and use the same username/password, port 21, them uncompress the files:
# cd / 
# tar xvzf /tmp/EM_mode_binaries.tar.gz 
  • You need to mount the partition that has your operating system
# mkdir /mnt/sda1
# mount -t ext2 /dev/hda1 /mnt/sda1
  • Now let's load U-Boot :
# chroot /mnt/sda1 /bin/sh
# mount /proc
# mount / -o remount,ro
# cd /usr/src
  • Note that the next line will change according to your kernel, or if you have a standard Kurobox or a Kurobox HG.
# insmod -f uloader.o uboot=/usr/src/u-boot-hg.ram.bin laddr=0x07f00000
# exit
# init 6
  • At this point the information should appear on your netconsole.

Install U-Boot into FLASH

At this point your Kurobox should be back up and running your old 2.4.x kernel again. We will now use the RAM version of U-Boot to load the flash version:

$ cd /usr/src
$ su
# sh u-boot-load-hg.sh

Wait for the box to reboot and for netconsole to come back up...

U-Boot 1.1.6-g9be12153-dirty (Dec 28 2006 - 22:39:43) LinkStation HG / KuroBox HG
stdin :   nc
stdout:   nc
stderr:   nc
IDE:   Bus 0: OK
  Device 0: Model: WDC WD3200JB-00KFA0 Firm: 08.05J08 Ser#: WD-WCAMR3683645
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
Boot in 10 seconds ('s' to stop)...s

=>

Now issue the "run upgrade" command to erase and replace your old bootloader with U-Boot. THIS VOIDS YOUR WARRANTY. IF IT DOESN'T WORK, YOU WILL HAVE A NICE BLACK PAPERWEIGHT.

=> run upgrade
run upgrade
Loading 0:1:usr/src/u-boot-hg.flash.bin

178944 bytes read
Un-Protected 3 sectors

Flash erase: first = 48 @ 0xfff00000
             last  = 50 @ 0xfff20000
Flash erase: Done
Erased 3 sectors
Copy to Flash... done
Total of 178944 bytes were the same
=> 

Finally, boot the old linux kernel again:

=> run flboot
run flboot
## Booting image at ffc00000 ...

******* Product Information *******
----------------------------------
Product Name: KURO-BOX/HG(IESHIGE)
         VER: 1.00
        Date: 2004/10/19 17:18:54
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x07C58000, end 0x07E6E615 ... OK
Booting the kernel

Try out the new kernel

Next you need to make sure your new kernel will boot. Follow the instructions on your distro's website to make sure you will have the right software installed to use version 2.6. Here is the link for Gentoo. Mostly you just have to have udev and module-init-tools installed.

Your new kernel will have one big problem: we've switched from IDE to PATA drivers. This means hda1 becomes sda1, hda2 becomes sda2, etc. Due to this you will have to change your /etc/fstab entries, but you should do that last because it will affect your ability to boot the old kernel. You need to make sure everything else works first.

So, reboot. Note the old kernels don't always reboot properly in my experience, or maybe I'm just impatient. I typed reboot, and 5 minutes later I got impatient and pulled the power plug out of the back, plugged it back in and pressed the power switch.

Watch the netconsole this time. Don't interrupt it, let it try to boot the new kernel. It probably won't boot fully. But you need to ensure 3 things:

  • That the network works (e.g. you get some text on your netconsole from the new kernel)
  • That it detects the hard drive properly
  • That it mounts the root filesystem properly

I'll include a log of what mine says, below. But first, here are the lines we care about:

SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
[...]
VFS: Mounted root (ext3 filesystem) readonly.


Here's the full log of what mine says:

Boot in 01 seconds ('s' to stop)...
Loading 0:1:boot/vmlinux.UBoot

1624609 bytes read

2373 bytes read
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.20-rc2-kuroboxHG
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1624545 Bytes =  1.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
   Booting using flat device tree at 0x7f0000
ATA: abnormal status 0x7F on port 0xBFFEE7
scsi 0:0:0:0: Direct-Access     ATA      WDC WD3200JB-00K 08.0 PQ: 0 ANSI: 5
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: Attached scsi disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0
physmap platform flash device: 00400000 at ffc00000
physmap-flash.0: Found 1 x16 devices at 0x0 in 8-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: Swapping erase regions for broken CFI table.
 number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 6 MTD partitions on "physmap-flash.0":
0x00000000-0x00300000 : "mtd_firmimg"
0x00300000-0x00370000 : "mtd_bootcode"
0x00370000-0x00380000 : "mtd_status"
0x00380000-0x00400000 : "mtd_conf"
0x00000000-0x00400000 : "mtd_allflash"
0x00310000-0x00400000 : "mtd_data"
usbmon: debugfs is not available
ehci_hcd 0000:00:0e.2: EHCI Host Controller
ehci_hcd 0000:00:0e.2: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:0e.2: irq 21, io mem 0xbfffcf00
ehci_hcd 0000:00:0e.2: 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: 5 ports detected
ohci_hcd 0000:00:0e.0: OHCI Host Controller
ohci_hcd 0000:00:0e.0: new USB bus registered, assigned bus number 2
ohci_hcd 0000:00:0e.0: irq 21, io mem 0xbfffe000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
ohci_hcd 0000:00:0e.1: OHCI Host Controller
ohci_hcd 0000:00:0e.1: new USB bus registered, assigned bus number 3
ohci_hcd 0000:00:0e.1: irq 21, io mem 0xbfffd000
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
rs5c372 0-0032: chip found, driver version 0.3
rs5c372 0-0032: rtc core: registered rs5c372 as rtc0
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
linkstation: disarming the AVR watchdog:
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 140k init
Synchronizing SCSI cache for disk sda:
Restarting system.

My Gentoo system rebooted itself because the entries in /etc/fstab were incorrect. Other distributions could have the same, or different results.

If you have any issues (for instance, kernel panics, lack of netconsole output, lack of disk detection, VFS complaining about NFS servers, etc), "you need to solve those first". Otherwise keep reading.

Reboot your Kurobox, and then boot the old kernel from flash again.

Boot in 10 seconds ('s' to stop)...s

=> run flboot
run flboot
## Booting image at ffc00000 ...

******* Product Information *******
----------------------------------
Product Name: KURO-BOX/HG(IESHIGE)
         VER: 1.00
        Date: 2004/10/19 17:18:54
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x07C58000, end 0x07E6E615 ... OK
Booting the kernel

Wait a couple minutes, ssh in when the system comes up. Log in as root. Edit your /etc/fstab.

$ su
# ne /etc/fstab

Replace all the "hda" devices with "sda" devices. Here's mine before editing:

/dev/hda1       /               ext3            defaults                0 1
/dev/hda2       none            swap            sw                      0 1
/dev/hda3       /var            ext3            defaults                0 2
/dev/hda4       /media          reiserfs        defaults                0 1

And after:

/dev/sda1       /               ext3            defaults                0 1
/dev/sda2       none            swap            sw                      0 1
/dev/sda3       /var            ext3            defaults                0 2
/dev/sda4       /media          reiserfs        defaults                0 1

Also you'll need to edit your /etc/inittab file and change any getty processes from ttyS0 to ttyS1, because the AVR device is now on /dev/ttyS0. You don't want a getty process talking to the AVR as it can confuse the AVR and cause your system to reboot after 5 minutes by the watchdog.

# ne /etc/inittab
(change getty processes on ttyS0 to ttyS1)

Ok, now reboot. Everything should work because you checked everything else before changing your fstab, right?

# reboot
# exit
$ exit

And wait. Once again, maybe try pulling the power cable out if it can't reboot on its own.

Loading 0:1:boot/vmlinux.UBoot

1624609 bytes read

2373 bytes read
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.20-rc2-kuroboxHG
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1624545 Bytes =  1.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
   Booting using flat device tree at 0x7f0000
ATA: abnormal status 0x7F on port 0xBFFEE7
scsi 0:0:0:0: Direct-Access     ATA      WDC WD3200JB-00K 08.0 PQ: 0 ANSI: 5
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: Attached scsi disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0
physmap platform flash device: 00400000 at ffc00000
physmap-flash.0: Found 1 x16 devices at 0x0 in 8-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 6 MTD partitions on "physmap-flash.0":
0x00000000-0x00300000 : "mtd_firmimg"
0x00300000-0x00370000 : "mtd_bootcode"
0x00370000-0x00380000 : "mtd_status"
0x00380000-0x00400000 : "mtd_conf"
0x00000000-0x00400000 : "mtd_allflash"
0x00310000-0x00400000 : "mtd_data"
usbmon: debugfs is not available
ehci_hcd 0000:00:0e.2: EHCI Host Controller
ehci_hcd 0000:00:0e.2: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:0e.2: irq 21, io mem 0xbfffcf00
ehci_hcd 0000:00:0e.2: 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: 5 ports detected
ohci_hcd 0000:00:0e.0: OHCI Host Controller
ohci_hcd 0000:00:0e.0: new USB bus registered, assigned bus number 2
ohci_hcd 0000:00:0e.0: irq 21, io mem 0xbfffe000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
ohci_hcd 0000:00:0e.1: OHCI Host Controller
ohci_hcd 0000:00:0e.1: new USB bus registered, assigned bus number 3
ohci_hcd 0000:00:0e.1: irq 21, io mem 0xbfffd000
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registeredal Device
usbcore: registered new interface driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converte
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
rs5c372 0-0032: chip found, driver version 0.3
rs5c372 0-0032: rtc core: registered rs5c372 as rtc0
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rs5c372 0-0032: setting the system clock to 2006-12-30 00:04:2
linkstation: disarming the AVR watchdog:
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 140k init
EXT3 FS on sda1, internal journal
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda3, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
Adding 506036k swap on /dev/sda2.  Priority:-1 extents:1 across:506036k
 sent 383, rcvd 29660

And everything works perfectly. At least it did for me. If you can't get to a prompt at this point you will probably have to use em-mode to rescue it. This is done with the "run emboot" command at the U-Boot prompt.

If it was successful it's now recommended that you install the 2.4.33 em-mode update[1], or the foonas-em update[2], to complete your Kurobox upgrade.

References

Rough edges

  • Kernel and U-Boot are not yet tested with any device other than the Kurobox HG.
  • Kernel does not yet have *.dts files for anything other than the Kurobox HG. This is a showstopper for standard Kurobox owners.
  • I made a lot of changes to the u-boot config header. Paths and partition ids are very specific to the partition layout of your kurobox's linux installation.
  • If your /boot directory is on its own partition, you will have to change the u-boot config before it will find your kernel image.
  • Having to use the PATA driver is kind of a pain in the ass. Having to adapt your /etc/fstab to get the new kernel booting is dangerous; if the new kernel doesn't boot for some other reason, then the old kernel won't know where to find its partitions either, and you have to use EM mode or a USB caddy plugged into your PC to rescue your kurobox.
  • You will not be able to enter EM mode directly by running "run emboot" from within U-boot with stock 2.4.17 or 2.4.20 kernel due to the check for NGNG. A possible solution would be to flash with one of the telnet-enabled (linkstation) firmwares which mindbender has made. You can attempt this after you have flashed U-boot correctly. (I had a Kurobox/HGWR with stock 2.4.17_mvl21 and successfully flashed 2.4.33 v3 kernel within 2.6.21.1 U-boot kernel)
  • Following successful testing of your U-Boot RAM build, you'll find that once you've flashed the Kurobox boot-loader you can no longer use the command 'run flboot' to boot to your old system. This is a known issue but the reason it occurs remains unexplained. It's now highly recommended that you install the new 2.4.33 Uboot firmimg.bin as stated above, or foonas-EM, to complete your Kurobox upgrade.

Footnotes

  1. FYI: compilation of a 2.6.23.9 vanilla kernel took approximately 1hr 45min. on a Kurobox HG
 $ time make uImage modules
 ...
 real    106m24.377s
 user    101m19.704s
 sys     4m59.304s