The NetBSD/evbarm Neo1973 kernel is only ready for kernel developers. Still, it's derived from the longstanding SMDK2410 kernel, given the Neo1973 is [http://wiki.openmoko.org/wiki/QT2410 Armzone QT2410], so SMDK2410, based.

=== Required tools ===

=== Required tools ===

−

You will need Qemu-neo1973.

+

If you don't have a [[Neo1973]], you will need a [[Openmoko under QEMU|Qemu Neo1973 emulator]], for instance the one running on top of [[Talk:Openmoko under QEMU#Qemu_Neo1973_emulator_on_NetBSD|NetBSD]].

−

Hints on building it are avaliable from [[Talk:OpenMoko under QEMU#NetBSD.2Fi386|OpenMoko under QEMU on NetBSD/i386]].

+

If you build the kernel yourself, you will need [[Talk:U-Boot|mkimage from u-boot]].

−

+

−

The package itself is avaliable in

+

−

http://pkgsrc-wip.sourceforge.net under qemu-neo1973.

+

=== Building NetBSD ===

=== Building NetBSD ===

−

You will need mkimage from u-boot. It's available in http://pkgsrc-wip.sourceforge.net under u-boot.

+

You'll need to download some kernel files.

−

You'll need to download some kernel files.

+

In [[http://admin-trac.openmoko.org/trac/ticket/914 download-area]]

−

In [[http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=914 download-area]]

First, please note that NetBSD isn't actually known to work on the Neo, so your mileage here may vary quite a bit. Having said that, if you want to try to boot NetBSD, it's pretty easy.

+

+

First, NetBSD requires a larger kernel partition than Linux. I think this is because NetBSD is a statically-linked kernel, whereas Linux pulls modules out of the jffs partition, but that's just a theory. Also, NetBSD will tend to come with a ramdisk, which is part of the kernel image.

+

+

Anyway, to rearrange the partitions, you will need to get into the u-boot console. How you do this varies depending on the operating system you are running. On NetBSD, you're going to type something like:

+

+

<pre>

+

uma% screen /dev/tty.usbmodem00000001

+

</pre>

+

If you see a prompt like this, you're in business:

+

<pre>GTA01Bv4 #

+

</pre>

+

+

You can dump the current partition table like this:

+

+

<pre>GTA01Bv4 # mtdparts

+

</pre>

+

+

This will print a list of partitions and some other information; it might be a good idea to make a copy if you want to install Linux later and don't want to keep the larger kernel partition size.

+

+

To change the partition table, you're going to have to delete all the partitions from the kernel onward, and then re-add them. When you do this, beware: you're going to wipe out the nice boot splash screen. It has its own partition, which you are going to move. So after you've made this change, you're going to see a dead black splash screen when the phone boots, which you may find alarming. Don't say you weren't warned. Also, please read the full instructions here before proceeding - don't just blindly start typing now.

+

+

Okay, you've gathered your courage and are ready to go for it. Here are the commands you need, first to delete the partitions:

+

<pre>

+

GTA01Bv4 # mtdparts del kernel

+

GTA01Bv4 # mtdparts del splash

+

GTA01Bv4 # mtdparts del rootfs

+

</pre>

+

+

and then to add the new ones:

+

+

<pre>

+

GTA01Bv4 # mtdparts add nand0 0x300000 kernel

+

GTA01Bv4 # mtdparts add nand0 0x0a0000 splash

+

GTA01Bv4 # mtdparts add nand0 0x3a1c000 rootfs

+

</pre>

+

+

As far as I can tell there's no way to get mtdparts to say "use the rest of the flash memory for this partition." Sorry about that. So you just have to do the math. Also, the amount of space a partition consumes changes if there are bad blocks in it. So you may have to fiddle around with the size of the rootfs partition. You can check to see how the partition table came out like this:

+

+

<pre>

+

GTA01Bv4 # mtdparts

+

+

device nand0 <neo1973-nand>, # parts = 5

+

#: name size offset mask_flags

+

0: u-boot 0x00040000 0x00000000 0

+

1: u-boot_env 0x00004000 0x00040000 0

+

2: kernel 0x00214000 0x00044000 0

+

3: splash 0x000a0000 0x00258000 0

+

4: rootfs 0x03a1c000 0x002f8000 0

+

+

active partition: nand0,0 - (u-boot) 0x00040000 @ 0x00000000

+

+

defaults:

+

mtdids : nand0=neo1973-nand

+

mtdparts: <NULL>

+

+

</pre>

+

+

Now, you haven't actually changed anything yet - if you power cycle the phone at this point, the partition table will go back to the way it was. To make it permanent, you have to save it to flash:

+

+

<pre>

+

GTA01Bv4 # saveenv

+

</pre>

+

+

This is obvious, but I'll say it anyway: don't delete the u-boot or u-boot_env partitions. If you do, you'll probably brick your phone. Heck, you'll probably brick your phone anyway. I told you you needed to be brave, didn't I?

+

+

Now, to install the kernel, assuming that you've survived all of these steps, you can use dfu-util:

+

<pre>

+

uma% dfu-util -a kernel -R -D ~/Desktop/netbsd.boot

+

</pre>

+

+

=== Running NetBSD under Qemu ===

+

+

From the qemu directory edit openmoko/flash.sh and add the line:

<code>

<code>

kernel_image="/usr/obj/sys/arch/evbarm/compile/NEO1973/netbsd.boot"

kernel_image="/usr/obj/sys/arch/evbarm/compile/NEO1973/netbsd.boot"

Line 64:

Line 136:

after the four "most_recent" lines.

after the four "most_recent" lines.

−

(if you do use [[Talk:OpenMoko under QEMU#NetBSD.2Fi386|wip/qemu-neo1973]], the line is allready there..and you should only have to uncomment the line.)

+

(if you do use [[Talk:Openmoko under QEMU#Qemu_Neo1973_emulator_on_NetBSD|wip/qemu-neo1973]], the line is allready there..and you should only have to uncomment the line.)

First, please note that NetBSD isn't actually known to work on the Neo, so your mileage here may vary quite a bit. Having said that, if you want to try to boot NetBSD, it's pretty easy.

First, NetBSD requires a larger kernel partition than Linux. I think this is because NetBSD is a statically-linked kernel, whereas Linux pulls modules out of the jffs partition, but that's just a theory. Also, NetBSD will tend to come with a ramdisk, which is part of the kernel image.

Anyway, to rearrange the partitions, you will need to get into the u-boot console. How you do this varies depending on the operating system you are running. On NetBSD, you're going to type something like:

uma% screen /dev/tty.usbmodem00000001

If you see a prompt like this, you're in business:

GTA01Bv4 #

You can dump the current partition table like this:

GTA01Bv4 # mtdparts

This will print a list of partitions and some other information; it might be a good idea to make a copy if you want to install Linux later and don't want to keep the larger kernel partition size.

To change the partition table, you're going to have to delete all the partitions from the kernel onward, and then re-add them. When you do this, beware: you're going to wipe out the nice boot splash screen. It has its own partition, which you are going to move. So after you've made this change, you're going to see a dead black splash screen when the phone boots, which you may find alarming. Don't say you weren't warned. Also, please read the full instructions here before proceeding - don't just blindly start typing now.

Okay, you've gathered your courage and are ready to go for it. Here are the commands you need, first to delete the partitions:

As far as I can tell there's no way to get mtdparts to say "use the rest of the flash memory for this partition." Sorry about that. So you just have to do the math. Also, the amount of space a partition consumes changes if there are bad blocks in it. So you may have to fiddle around with the size of the rootfs partition. You can check to see how the partition table came out like this:

Now, you haven't actually changed anything yet - if you power cycle the phone at this point, the partition table will go back to the way it was. To make it permanent, you have to save it to flash:

GTA01Bv4 # saveenv

This is obvious, but I'll say it anyway: don't delete the u-boot or u-boot_env partitions. If you do, you'll probably brick your phone. Heck, you'll probably brick your phone anyway. I told you you needed to be brave, didn't I?

Now, to install the kernel, assuming that you've survived all of these steps, you can use dfu-util: