![]() |
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
The bootloader used on the smartphones is called U-Boot. It takes care of device functionality until Openmoko is booted. This includes USB DFU for flashing Openmoko, a splash screen, a boot menu, a console for bootloader commands, configuration via bootloader environment, and loading a kernel.
There are various bootloader versions available.
All versions of the OM smartphone use the u-boot bootloader.
More information on u-boot can be found at
Additions to the vanilla u-boot already implemented include:
However, u-boot still doesn't support many of the features that GTA01 needs, such as
HaraldWelte is working on those issues, and in fact most of them have already been implemented.
The current bootloader source can be found at http://git.openmoko.org/?p=u-boot.git;a=shortlog;h=stable .
To get u-boot by git:
git clone git://git.openmoko.org/git/u-boot.git openmoko/u-boot
To build u-boot:
The latest bootloader binary builds can be found under http://downloads.openmoko.org/daily/ .
All versions of the GTA02 (Neo FreeRunner) that have been sold to the public are version 5 hardware, so look for a file with "gta02" and "v5" in the name, for example: uboot-gta02v5-latest.bin
The file should be written to the NAND flash address 0x00000000 (size 0x30000) (the first partition).
If you want to do bootloader development on the QT2410, it's easier to work with a bootloader image that can be downloaded via USB into RAM instead of flashing.
To do so, you need to edit the u-boot/include/configs/qt2410.h file, and change the "if 0" in Line 32 into a "if 1", then recompile with "make".
The resulting "u-boot.bin" is _NOT SUITABLE_ for NAND flash, but only for direct execution from within ram, e.g. by using the s3c2410_boot_usb program.
Doing bootloader development on the Neo 1973 is a bit more tricky. first, we don't have any NOR flash. Second, there is no other way to boot _but_ from NAND. Therefore, we also don't have a USB downloader like the QT2410.
The main problem is: The S3C2410 Steppingstone unconditionally copies the first 4k of flash into its internal SRAM. That SRAM segment stays unconditionally mapped at physical address zero. How do we get around this
So how can we boot from RAM? We use JTAG / OpenOCD to
> reset halt target halted in ARM state due to debug request, current mode: Supervisor cpsr: 0x400000d3 pc: 0x00000000 MMU: disabled, D-Cache: disabled, I-Cache: disabled
> load_binary /space/misc/gta01/u-boot.git/board/gta01/lowlevel_foo.bin 0 downloaded 332 byte in 0s 21899us
> bp 0x33f80000 4 hw breakpoint added at address 0x33f80000
> resume Target 0 resumed > Target 0 halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x600000d3 pc: 0x33f80000 MMU: disabled, D-Cache: disabled, I-Cache: enabled
> load_binary /space/misc/gta01/u-boot.git/u-boot.bin 0x33f80000 downloaded 135692 byte in 6s 567264us
> resume Target 0 resumed
At this point, the display backlight gets bright and we see the following familiar prompt on the serial console:
U-Boot 1.1.6 (Jan 13 2007 - 23:44:23) DRAM: 128 MB NAND: 64 MiB *** Warning - bad CRC or NAND, using default environment In: serial Out: serial Err: serial Hit any key to stop autoboot: 0 GTA01Bv2 #
u-boot needs bootable images (such as kernels, but also initrd and others) in form of a so-called uImage. In order to create a uImage from e.g. a vmlinux kernel image, you can proceed as follows:
objcopy -O binary -R .note -R .comment -S vmlinux linux.bin gzip -9 linux.bin u-boot/tools/mkimage -A arm -O linux -T kernel -C gzip -a 30008000 -e 30008000 -n "Kernel Image QT2410" -d linux.bin.gz uImage
As of the Phase-0 release, our u-boot version now features an on-screen boot menu. The items are defined by menu entries in the environment.
You can access the boot menu by pressing and holding the Neo1973 AUX Button together with the power button while switching the phone on.
By pressing the Neo1973 AUX Button you can cycle through the menu items. Use the POWER button to select one item.
The bootloader prompt is available either on the serial console (via Debug Board), or as virtual USB Serial device (USB CDC_ACM). Whether the serial port or usb is used depends on the u-boot environment variables stdin, stdout and stderr.
Whether or not you use usbtty, the first couple of messages will always be displayed on the serial console.
The bootloader is currently configured to wait for three seconds. If a key press on the stdin is received within those three seconds, auto-boot is aborted.
Just by connecting the phone in u-boot mode to your Linux pc should make it detect a CDC ACM device, and you should get a new tty device called /dev/ttyACM0. If not, enable the CONFIG_USB_ACM (Device Drivers -> USB support -> USB Modem (CDC ACM) support). (Instructions for MacOS users are here)
Use your favourite terminal emulator (minicom, cu, zc, screen ...) to access it like any other serial port. If you don't have a favorite, try just: (cu is in the taylor-uucp package, use "apt-get install cu" if it is not yet installed)
cu -l /dev/ttyACM0
You might need to
chown uucp.uucp /dev/ttyACM0
to get the necessary rights (even as root).
A nice alternative for cu is Werner Almesberger's neocon.
First, you should try to check whether the USB device shows up in 'lsusb' while you're running in u-boot mode:
# lsusb -d 1457:5119 Bus 005 Device 079: ID 1457:5119
Second, let's see some more details about the available endpoints and configurations:
# lsusb -v -d 1457:5119 Bus 005 Device 079: ID 1457:5119 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 2 Communications bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 16 idVendor 0x1457 idProduct 0x5119 bcdDevice 0.00 iManufacturer 1 Openmoko, Inc iProduct 2 Neo1973 Bootloader U-Boot 1.2.0-g6c7cac8c-dirty-moko3 iSerial 3 0000000 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 85 bNumInterfaces 3 bConfigurationValue 1 iConfiguration 4 TTY via USB bmAttributes 0xc0 Self Powered MaxPower 0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 2 Communications bInterfaceSubClass 2 Abstract (modem) bInterfaceProtocol 1 AT-commands (v.25ter) iInterface 6 Control Interface CDC Header: bcdCDC 0.6e CDC Call Management: bmCapabilities 0x00 bDataInterface 1 CDC ACM: bmCapabilities 0x00 CDC Union: bMasterInterface 0 bSlaveInterface 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 255 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 10 CDC Data bInterfaceSubClass 0 Unused bInterfaceProtocol 0 iInterface 5 Bulk Data Interface Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 255 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 255 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 254 Application Specific Interface bInterfaceSubClass 1 Device Firmware Update bInterfaceProtocol 1 iInterface 7 USB Device Firmware Upgrade Device Status: 0x0001 Self Powered
Next, you can access it using your favourite terminal program.
Then, if the environment is not set correctly, you will need to use the current console (e.g. serial console) to change the console entries in the environment:
GTA01Bv2 # setenv stderr usbtty GTA01Bv2 # setenv stdout usbtty GTA01Bv2 # setenv stdin usbtty
U-Boot 1.2.0-moko1 (Feb 16 2007 - 00:36:13) DRAM: 128 MB NAND: 64 MiB Found Environment offset in OOB.. Video: 640x480x8 31kHz 59Hz USB: S3C2410 USB Deviced In: serial Out: serial Err: serial Hit any key to stop autoboot: 0 GTA01Bv3 #
Found a solution here: [[1]]
It works the following way:
svn co http://svn.openmoko.org/trunk/src/host/devirginator cd devirginator
dfu-util -a u-boot_env -R -U env.in
wget http://svn.openmoko.org/trunk/src/host/devirginator/environment.in
./envedit.pl -D GTA02 -i env.in -f environment.in -o env.out
warning: environment is 262144 bytes, expected 16384 CRC error: expected 0xc33e35fc, got 0x93097bfb
./envedit.pl -s 262144 -D GTA02 -i env.in -f environment.in -o env.out
dfu-util -a u-boot_env -R -D env.out
Our version of u-boot also implements USB DFU. This can be useful to load files and kernel for quick testing.
To find out whether your version of u-boot supports this, use the output of
$ lsusb -v -d 1457:5119
while the phone is in u-boot mode.
If it supports DFU, you should see the following snippet towards the end of the output:
Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 254 Application Specific Interface bInterfaceSubClass 1 Device Firmware Update bInterfaceProtocol 1 iInterface 0
For information on how to do firmware upgrades, please see dfu-util. For neo 1973 you may see Flashing_Openmoko#Actually_flashing_things_into_the_device, and for the FreeRunner : Flashing the Neo FreeRunner.
To load a file at memory address 0x32000000:
dfu-util -a 0 -D fileToLoad -R
After that, send 'bootm 0x32000000' to u-boot or 'bootelf 0x32000000' if its an elf file.
Simple python script that can boot an ELF image - avoiding a ACM bug that breaks on large packets.
#!/usr/bin/python import sys import os import time cmd1 = "neo backlight off\n" cmd2 = "bootelf 0x32000000\n" def output(tty, str): for x in str: tty.write(x) tty.flush() if len(sys.argv) == 2: print "Loading %s..." % sys.argv[1] loadfile = "dfu-util -a 0 -D %s -R" % sys.argv[1] os.system(loadfile) time.sleep(3) tty = open("/dev/ttyACM0", "a") output(tty, cmd1) output(tty, cmd2) tty.close() else: print "Usage: %s elffile" % sys.argv[0] print "" sys.exit(2)
I once got errors like this (in dmesg or /var/log/messages) on the host side while connecting the neo in u-boot:
usb 2-1: device descriptor read/64, error -110 usb usb2: Controller not stopped yet!
or
hub 4-0:1.0: port 1 disabled by hub (EMI?), re-enabling... usb 4-1: USB disconnect, address 2
A possible solution is given below. Please note that if you have a usb keyboard or mouse then the command might cause trouble.
rmmod uhci_hcd ; modprobe uhci_hcd
Another option is to plug the FR into a different USB port on the host, preferably one on the Motherboard not the hub.
Disconnecting the Neo's USB while powering up may prevent this problem in the future.
See Flashing the Neo 1973 and Flashing the Neo FreeRunner for instructions on using dfu-util to install a new bootloader in your phone.