m (Category: -Software (non-openmoko), -Kernel, +Distributions)
(→Running NetBSD under Qemu)
|Line 241:||Line 241:|
This in comparance to the [http://wiki.openmoko.org/wiki/Wishlist
This in comparance to the [http://wiki.openmoko.org/wiki/WishlistNeo1973_P0_Review#System_information Linux dmesg]
Page thanks to and inspired by the [[FreeBSD]] page
Page thanks to and inspired by the [[FreeBSD]] page
Revision as of 18:53, 4 June 2009
Running NetBSD on Neo1973
The NetBSD/evbarm Neo1973 kernel is only ready for kernel developers. Still, it's derived from the longstanding SMDK2410 kernel, given the Neo1973 is Armzone QT2410, so SMDK2410, based.
If you build the kernel yourself, you will need mkimage from u-boot.
You'll need to download some kernel files.
pick Attachment: "NetBSD/evbarm 3.1 NEO1973 syssrc 20071017"
(or "NetBSD/evbarm 4.0 NEO1973 kernel 20080413 (netboot)" for NetBSD 4.0)
Save Link As... syssrc-neo1973-20071017.tar.gz
and extract it over the NetBSD src tree:
tar xfz syssrc-neo1973-20071017.tar.gz -C /
From the NetBSD src tree run:
cd /usr/src ./build.sh -m evbarm tools ./build.sh -u -m evbarm kernel=NEO1973 mkimage -A arm -O netbsd -T kernel -C none -a 30008000 -e 30008110 -n "Kernel Image" -d /usr/obj/sys/arch/evbarm/compile/NEO1973/netbsd /usr/obj/sys/arch/evbarm/compile/NEO1973/netbsd.boot
You'll now have a copy of the NetBSD kernel, called netbsd.boot, that's able to be loaded by u-boot.
You'll need to download a kernel.
pick Attachment: "NetBSD/evbarm 3.1 NEO1973 kernel 20071017 (netboot)"
Save Link As... netbsd-NEO1973-20071017.gz
extract and move this kernel into place:
gzip -d netbsd-NEO1973-20071017.gz mkdir -f /usr/obj/sys/arch/evbarm/compile/NEO1973 mv netbsd-NEO1973-20071017 /usr/obj/sys/arch/evbarm/compile/NEO1973/netbsd.boot
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:
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:
GTA01Bv4 # mtdparts del kernel GTA01Bv4 # mtdparts del splash GTA01Bv4 # mtdparts del rootfs
and then to add the new ones:
GTA01Bv4 # mtdparts add nand0 0x300000 kernel GTA01Bv4 # mtdparts add nand0 0x0a0000 splash GTA01Bv4 # mtdparts add nand0 0x3a1c000 rootfs
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:
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>
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:
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.)
This will fetch the required parts and create an image to run. They require you to have bash installed.
Finally run qemu with
cd /usr/pkg/qemu-neo1973; qemu-neo1973 -M neo -m 130 -mtdblock openmoko/openmoko-flash.image -kernel openmoko/openmoko-kernel.bin -usb -show-cursor -serial telnet:localhost:1200,server
And from another xterm
telnet localhost 1200
and qemu will go on with the startup process.
In Qemu running u-boot,
press Space to select option "Boot".
In telnet to the serial port you should see:
host007# telnet localhost 1200 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. U-Boot 1.2.0-moko9_r0 (Aug 19 2007 - 19:17:12) DRAM: 128 MB NAND: 64 MiB Found Environment offset in OOB.. Video: 640x480x8 31kHz 59Hz NAND read: device 0 offset 0x25c000, size 0x5000 Reading data from 0x260e00 -- 100% complete. 20480 bytes read: OK USB: S3C2410 USB Deviced In: serial Out: serial Err: serial GTA01Bv4 # Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 The NetBSD Foundation, Inc. All rights reserved. Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. NetBSD 3.1 (NEO1973) #0: Tue Oct 9 23:08:38 CEST 2007 email@example.com:/usr/obj/sys/arch/evbarm/compile/NEO1973 total memory = 128 MB avail memory = 119 MB mainbus0 (root) cpu0 at mainbus0: ARM920T rev 0 (ARM9TDMI core) cpu0: DC enabled IC enabled WB enabled EABT cpu0: 16KB/32B 64-way Instruction cache cpu0: 16KB/32B 64-way write-back-locking-A Data cache ssio0 at mainbus0: fclk 266 MHz hclk 133 MHz pclk 66 MHz ohci0 at ssio0 intr 26 ohci0: OHCI version 1.0 usb0 at ohci0: USB revision 1.0 uhub0 at usb0 uhub0: Samsung OHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 3 ports with 3 removable, self powered sscom0 at ssio0 unit 0: UART0 addr=50000000 sscom0: console (major=104) sscom1 at ssio0 unit 1: UART1 addr=50004000 ssextio0 at ssio0 lcd0 at ssio0 wsdisplay0 at lcd0 kbdmux 1 wsmux1: connecting to wsdisplay0 ssspi0 at ssio0 unit 0 ssspi1 at ssio0 unit 1 sskbd0 at ssspi1 intr 1 wskbd0 at sskbd0 mux 1 wskbd0: connecting to wsdisplay0 clock: hz=100 stathz = 64 PCLK=66500000 prescaler=2 tc=32470 ubt0 at uhub0 port 3 configuration 1 interface 0 ubt0: Cambridge Silicon Radio Bluetooth USB Adapter, rev 2.00/19.58, addr 2 ubt0: has isoc data bthci0 at ubt0 boot device: <unknown> root device:
Here's a screenshot.
I made small progress and now have ramdisk, usb device from qemu and draw_test_pattern to lcd. Here's the screenshot.
Progress again, active in a nfs boot. screenshot.
We have netboot and uname -a. screenshot.
This in comparance to the Linux dmesg
Page thanks to and inspired by the FreeBSD page