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]].

+

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]].

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

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

Line 136:

Line 136:

after the four "most_recent" lines.

after the four "most_recent" lines.

−

(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.)

+

(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.)

Running NetBSD on the Neo

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:

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

Running NetBSD under Qemu

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

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

after the four "most_recent" lines.

(if you do use wip/qemu-neo1973, the line is allready there..and you should only have to uncomment the line.)

Next run

./openmoko/download.sh
./openmoko/flash.sh

This will fetch the required parts and create an image to run. They require you to have bash installed.

Running NetBSD on the Neo

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:

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

Running NetBSD under Qemu

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

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

after the four "most_recent" lines.

(if you do use wip/qemu-neo1973, the line is allready there..and you should only have to uncomment the line.)

Next run

./openmoko/download.sh
./openmoko/flash.sh

This will fetch the required parts and create an image to run. They require you to have bash installed.