Sunday, August 3, 2008

Installing a NetBSD kernel on DNS 323

THIS WILL ERASE YOUR LINUX FIRMWARE AND BRICK YOUR DNS 323.

To install a NetBSD kernel permanently in flash, I create a Linux ramdisk with a load address and entry point identical to that of the linux kernel. Instead of a linux filesystem, this image contains a NetBSD kernel. Here is the mkimage command that I used on my box:

mkimage -A arm -O linux -T ramdisk -C none -a 0x00008000 -e 0x00008000 -n "NetBSD kernel" -d /usr/src/sys/arch/evbarm/compile/obj/DNS323/netbsd.bin dns323.img

The following u-boot command will replace the ramdisk with dns323.img permanently. If you brick your device it is your fault 100% of the time. THIS WILL ERASE YOUR LINUX FIRMWARE AND BRICK YOUR DNS 323.

Marvell>>
Marvell>>
Marvell>> loadb r

You will have to use kermit to upload the dns323.img at this point.

At boot time u-boot loads the linux kernel and then overwrites it with the NetBSD kernel. When u-boot jumps into the entry point, NetBSD is started. I have captured the boot process below.

** LOADER **
** MARVELL BOARD: RD-88F5182-NAS-2 LE

U-Boot 1.1.1 (Oct 12 2007 - 17:19:14) Marvell version: 1.7.3.001

DRAM CS[0] base 0x00000000 size 64MB
DRAM Total size 64MB
[8192kB@ff800000] Flash: 8 MB
Load Address: 00008000
Entry Point: 00008000

Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
*** Warning - bad CRC, using default environment


Soc: MV88F5182 Rev 2
CPU: ARM926 (Rev 0) running @ 500Mhz
SysClock = 166Mhz , TClock = 166Mhz


USB 0: host mode
USB 1: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Hit any key to stop autoboot: 3 ^H^H^H 2 ^H^H^H 1 ^H^H^H 0
## Booting image at ff820000 ...
Image Name: Linux-2.6.12.6-arm1
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1426600 Bytes = 1.4 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
## Loading Ramdisk Image at ff9a0000 ...
Image Name: NetBSD kernel
Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 2690748 Bytes = 2.6 MB
Load Address: 00008000
Entry Point: 00008000

Verifying Checksum ... OK

Starting kernel ...


1 comment:

arnaud said...

Hi,
it's a good job, but I have some questions.

can you tell us :

- where download netbsd kernel source (which release ?)
- How can we make the netbsd.bin, must we cross-compile ?

Thanks