U-Boot/zh tw

From Openmoko

(Difference between revisions)
Jump to: navigation, search
 
(24 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 +
{{Languages|U-Boot}}
 +
 
[[Image:GTA01-U-Boot.JPG|thumb|300px|u-boot menu on Neo1973]] [[Image:Neo1973 uboot splash closeup.jpg|thumb|300px|u-boot splash screen on Neo1973]]
 
[[Image:GTA01-U-Boot.JPG|thumb|300px|u-boot menu on Neo1973]] [[Image:Neo1973 uboot splash closeup.jpg|thumb|300px|u-boot splash screen on Neo1973]]
  
[[Neo1973]]上的bootloader-- '''U-Boot''' ,負責硬體裝置的功能運作,直到 [[Openmoko]]被啟動載入裝置為止。這包括用來[[flashing Openmoko|更新Openmok]]的 [[USB DFU]]、螢幕顯示、啟動選單、[[bootloader commands|bootloader 指令列]]控制台、透過 [[bootloader environment|bootloader 環境]]設定及載入[[kernel]]等。
+
[[Neo1973]]上的bootloader '''U-Boot''',負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。這包括用來[[Flashing the Neo Freerunner/zh tw|更新Openmok]]的 [[USB DFU]]、螢幕顯示、啟動選單、[[bootloader commands|bootloader 指令列]] 控制台。透過 [[bootloader environment|bootloader 環境]]設定及載入[[kernel]]等。
 +
 
 +
有不同的[[bootloader versions|bootloader版本]]可供使用,最近版本的是[[Qi]]:
  
有不同的[[bootloader versions|bootloader版本]]可供使用:
 
  
 
== Phase0 快速啟動==
 
== Phase0 快速啟動==
* 請確認你的電話是目前是裝好電池,並且USB接線至少移開30秒以上。
+
* 請確認你的手機是否已經裝好電池,並且將USB接線移開至少30秒以上。
* 利用USB接線,連接Neo (ie 並不是偵錯板) 到Linux主機。
+
* 利用USB接線,將Neo (並不是偵錯板) 連接到Linux主機。
* 在啟動電源時,按住AUX 按鈕以存取選單。
+
* 在啟動電源時,按住AUX按鈕以存取選單。
* 將控制台設定為USB
+
* 將控制台設定為USB。
* 在Linux主機上利用「終端機」連接到/dev/ttyACM0 (你可能會用到chown uucp.uucp /dev/ttyACM0 )
+
* 在Linux主機上利用「終端機」連接到/dev/ttyACM0 (你可能會用到chown uucp.uucp /dev/ttyACM0 )
 
* 請注意cdc_acm /dev/ttyACM0 存取會連同Neo boots一起消失,它會被cdc_ether usb0網路存取取代。
 
* 請注意cdc_acm /dev/ttyACM0 存取會連同Neo boots一起消失,它會被cdc_ether usb0網路存取取代。
 
* 你現在會進入bootloader 提示指令下。
 
* 你現在會進入bootloader 提示指令下。
 
*如果你希望在每次啟動時都停留在bootloader,將bootdelay uboot 環境變數設定為-1 。
 
*如果你希望在每次啟動時都停留在bootloader,將bootdelay uboot 環境變數設定為-1 。
 +
{{Bootloader}}
  
 
== 一般 ==
 
== 一般 ==
 
GTA01 使用[http://u-boot.sourceforge.net/ u-boot] bootloader.
 
GTA01 使用[http://u-boot.sourceforge.net/ u-boot] bootloader.
  
關於u-boot的更多資訊,可以參考下列網址:  
+
關於u-boot的更多資訊,可以參考下列網址:
 
* http://www.denx.de/wiki/DULG
 
* http://www.denx.de/wiki/DULG
 
* http://www.gumstix.org/tikiwiki/tiki-index.php?page=U-Boot
 
* http://www.gumstix.org/tikiwiki/tiki-index.php?page=U-Boot
 
* http://linuxdevices.com/articles/AT5085702347.html
 
* http://linuxdevices.com/articles/AT5085702347.html
  
您也可以參考下面的內容,得到其它u-boot的資訊:  
+
您也可以參考下面的內容,得到其它u-boot的資訊:
 
* 使用[[S3C2410 Steppingstone]]支援從NAND 中啟動
 
* 使用[[S3C2410 Steppingstone]]支援從NAND 中啟動
* 支援S3C2410 NAND flash
+
* 支援S3C2410 NAND 記憶體
 
* 支援透過S3C2410 USB 裝置控制器下載程式
 
* 支援透過S3C2410 USB 裝置控制器下載程式
* 支援在S3C2410 Framebuffer中顯示啟動logo / 狀態  
+
* 支援在S3C2410 Framebuffer中顯示啟動logo / 狀態
 
+
 
然而,u-boot並不會支援GTA01所需要的功能,如
 
然而,u-boot並不會支援GTA01所需要的功能,如
*支援從SD/Transflash讀取kernel/initrd  
+
*支援從SD/Transflash讀取kernel/initrd
  
 
[[User:HaraldWelte|HaraldWelte]]目前正在進行這項工作,事實上,已完成大部份的工作。
 
[[User:HaraldWelte|HaraldWelte]]目前正在進行這項工作,事實上,已完成大部份的工作。
  
 
== Bootloader 源碼==
 
== Bootloader 源碼==
目前的bootloader patches 可以在下面的位置取得: http://svn.openmoko.org/trunk/src/target/u-boot/patches/.  
+
目前的bootloader patche 可以在[http://svn.openmoko.org/trunk/src/target/u-boot/patches/| http://svn.openmoko.org/trunk/src/target/u-boot/patches/這個位置]]下位置取得。.
  
將源碼解壓縮縮,套用到patch,執行"make gta01bv3_config" (或gta01bv2_config, 或你擁有的任何硬體版本),執行"make"。你將會得到"u-boot.bin" 映像檔,你可以在NAND中直接更新(也可以使用現有的bootloader 或 [[sjf2410-linux]])。
+
將源碼解壓縮縮,套用到patch,執行"make gta01bv3_config" (或gta01bv2_config, 或你擁有的任何硬體版本),執行"make"。你將會得到"u-boot.bin" 映像檔,你可以在NAND中直接更新 (也可以使用現有的bootloader 或 [[sjf2410-linux]])。
  
  
 
== Bootloader 二進位檔==
 
== Bootloader 二進位檔==
  
最新的bootloader 二進位檔可以在以下的位置中找到under http://buildhost.openmoko.org/snapshots in the subdirectory 200X.XX/images/。它應該被寫入NAND 0x00000000的位置 (大小為0x30000) (第一個分割區[[partition]]).
+
最新的bootloader 二進位檔可以在以下的位置中找到under http://buildhost.openmoko.org/snapshots in the subdirectory 200X.XX/images/。它應該被寫入NAND 0x00000000的位置 (大小為0x30000) (第一個 [[Partitions|分割區]]).
  
 
== 開發Bootloader ==
 
== 開發Bootloader ==
Line 56: Line 59:
 
在GTA01上開發bootloader是很辣手的一件事情,首先,我們並不會有任何的NOR記憶體。第二,並沒有其它的方法可以不從NAND中啟動。然而,我們也不會有一個像QT2410一樣的USB下載器。
 
在GTA01上開發bootloader是很辣手的一件事情,首先,我們並不會有任何的NOR記憶體。第二,並沒有其它的方法可以不從NAND中啟動。然而,我們也不會有一個像QT2410一樣的USB下載器。
  
最主要的問題是: [[S3C2410 Steppingstone]]內部的SRAM的前4K並沒有被限制。SRAM 分割並非絕對性的對應到實體0的位置。我們要如何因應呢?
+
最主要的問題是:[[S3C2410 Steppingstone]]內部的SRAM的前4K並沒有被限制。SRAM 分割並非絕對性的對應到實體0的位置。我們要如何因應呢?
  
 
==== 使用JTAG 自RAM中啟動====
 
==== 使用JTAG 自RAM中啟動====
Line 69: Line 72:
 
</pre>
 
</pre>
  
* 針對低階SDRAM啟動下載程式片段(做為4k的sram的踏腳石)
+
* 針對低階SDRAM啟動下載程式片段 (做為4k的sram踏腳石)
 
<pre>
 
<pre>
> load_binary /space/misc/gta01/u-boot.git/board/gta01/lowlevel_foo.bin 0          
+
> load_binary /space/misc/gta01/u-boot.git/board/gta01/lowlevel_foo.bin 0
 
downloaded 332 byte in 0s 21899us
 
downloaded 332 byte in 0s 21899us
 
</pre>
 
</pre>
Line 78: Line 81:
 
<pre>
 
<pre>
 
> bp 0x33f80000 4 hw
 
> bp 0x33f80000 4 hw
breakpoint added at address 0x33f80000
+
在0x33f80000 中加入中斷點
 
</pre>
 
</pre>
  
Line 84: Line 87:
 
<pre>
 
<pre>
 
> resume
 
> resume
Target 0 resumed
+
Target 0 重新開始
 
> Target 0 halted
 
> Target 0 halted
target halted in ARM state due to breakpoint, current mode: Supervisor
+
因中斷點的關係,目標暫停,目前的模式為:Supervisor
 
cpsr: 0x600000d3 pc: 0x33f80000
 
cpsr: 0x600000d3 pc: 0x33f80000
 
MMU: disabled, D-Cache: disabled, I-Cache: enabled
 
MMU: disabled, D-Cache: disabled, I-Cache: enabled
Line 100: Line 103:
 
<pre>
 
<pre>
 
> resume
 
> resume
Target 0 resumed
+
Target 0 重新開始
 
</pre>
 
</pre>
  
Line 114: Line 117:
 
Out:  serial
 
Out:  serial
 
Err:  serial
 
Err:  serial
Hit any key to stop autoboot:  0  
+
Hit any key to stop autoboot:  0
GTA01Bv2 #  
+
GTA01Bv2 #
 
</pre>
 
</pre>
  
Line 153: Line 156:
  
 
使用你熟悉的模擬器 (minicom, cu, zc, screen ...) 像使用任何序列埠般存取。如果你並沒有熟悉的模擬器,可以試試看: (位於taylor-uucp 中的cu,使用"apt-get 安裝 cu" 如果它還未安裝話。
 
使用你熟悉的模擬器 (minicom, cu, zc, screen ...) 像使用任何序列埠般存取。如果你並沒有熟悉的模擬器,可以試試看: (位於taylor-uucp 中的cu,使用"apt-get 安裝 cu" 如果它還未安裝話。
cu -l /dev/ttyACM0
+
cu -l /dev/ttyACM0
  
你會需要用到  
+
你會需要用到
chown uucp.uucp /dev/ttyACM0
+
chown uucp.uucp /dev/ttyACM0
  
 
取得必要的權限(甚至是root)
 
取得必要的權限(甚至是root)
  
A nice alternative for cu is Werner Almesberger's [[NeoCon|neocon]].
+
可以用來取代cu的另一個方法是 Werner Almesberger的 [[NeoCon|neocon]]
  
First, you should try to check whether the USB device shows up in 'lsusb' while you're running in u-boot mode:
+
首先,你必須試著去查看在你執行u-boot模式時,USB裝置是否出現了'lsusb'
  
# lsusb -d 1457:5119
+
# lsusb -d 1457:5119
Bus 005 Device 079: ID 1457:5119
+
Bus 005 Device 079: ID 1457:5119
  
Second, lets see some more details about the available endpoints and configurations:
+
接著,讓我們來查看更多可用的endpoint及設定:
  
 
<pre>
 
<pre>
 
# lsusb -v -d 1457:5119
 
# lsusb -v -d 1457:5119
Bus 005 Device 079: ID 1457:5119
+
Bus 005 Device 079: ID 1457:5119
 
Device Descriptor:
 
Device Descriptor:
  bLength                18
+
bLength                18
  bDescriptorType        1
+
bDescriptorType        1
  bcdUSB              1.10
+
bcdUSB              1.10
  bDeviceClass            2 Communications
+
bDeviceClass            2 Communications
  bDeviceSubClass        0  
+
bDeviceSubClass        0
  bDeviceProtocol        0  
+
bDeviceProtocol        0
  bMaxPacketSize0        16
+
bMaxPacketSize0        16
  idVendor          0x1457  
+
idVendor          0x1457
  idProduct          0x5119  
+
idProduct          0x5119
  bcdDevice            0.00
+
bcdDevice            0.00
  iManufacturer          1 OpenMoko, Inc
+
iManufacturer          1 Openmoko, Inc
  iProduct                2 Neo1973 Bootloader U-Boot 1.2.0-g6c7cac8c-dirty-moko3
+
iProduct                2 Neo1973 Bootloader U-Boot 1.2.0-g6c7cac8c-dirty-moko3
  iSerial                3 0000000
+
iSerial                3 0000000
  bNumConfigurations      1
+
bNumConfigurations      1
  Configuration Descriptor:
+
Configuration Descriptor:
    bLength                9
+
bLength                9
    bDescriptorType        2
+
bDescriptorType        2
    wTotalLength          85
+
wTotalLength          85
    bNumInterfaces          3
+
bNumInterfaces          3
    bConfigurationValue    1
+
bConfigurationValue    1
    iConfiguration          4 TTY via USB
+
iConfiguration          4 TTY via USB
    bmAttributes        0xc0
+
bmAttributes        0xc0
      Self Powered
+
Self Powered
    MaxPower                0mA
+
MaxPower                0mA
    Interface Descriptor:
+
Interface Descriptor:
      bLength                9
+
bLength                9
      bDescriptorType        4
+
bDescriptorType        4
      bInterfaceNumber        0
+
bInterfaceNumber        0
      bAlternateSetting      0
+
bAlternateSetting      0
      bNumEndpoints          1
+
bNumEndpoints          1
      bInterfaceClass        2 Communications
+
bInterfaceClass        2 Communications
      bInterfaceSubClass      2 Abstract (modem)
+
bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
+
bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              6 Control Interface
+
iInterface              6 Control Interface
      CDC Header:
+
CDC Header:
        bcdCDC              0.6e
+
bcdCDC              0.6e
      CDC Call Management:
+
CDC Call Management:
        bmCapabilities      0x00
+
bmCapabilities      0x00
        bDataInterface          1
+
bDataInterface          1
      CDC ACM:
+
CDC ACM:
        bmCapabilities      0x00
+
bmCapabilities      0x00
      CDC Union:
+
CDC Union:
        bMasterInterface        0
+
bMasterInterface        0
        bSlaveInterface        1  
+
bSlaveInterface        1
      Endpoint Descriptor:
+
Endpoint Descriptor:
        bLength                7
+
bLength                7
        bDescriptorType        5
+
bDescriptorType        5
        bEndpointAddress    0x81  EP 1 IN
+
bEndpointAddress    0x81  EP 1 IN
        bmAttributes            3
+
bmAttributes            3
          Transfer Type            Interrupt
+
Transfer Type            Interrupt
          Synch Type              None
+
Synch Type              None
          Usage Type              Data
+
Usage Type              Data
        wMaxPacketSize    0x0010  1x 16 bytes
+
wMaxPacketSize    0x0010  1x 16 bytes
        bInterval            255
+
bInterval            255
    Interface Descriptor:
+
Interface Descriptor:
      bLength                9
+
bLength                9
      bDescriptorType        4
+
bDescriptorType        4
      bInterfaceNumber        1
+
bInterfaceNumber        1
      bAlternateSetting      0
+
bAlternateSetting      0
      bNumEndpoints          2
+
bNumEndpoints          2
      bInterfaceClass        10 CDC Data
+
bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
+
bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0  
+
bInterfaceProtocol      0
      iInterface              5 Bulk Data Interface
+
iInterface              5 Bulk Data Interface
      Endpoint Descriptor:
+
Endpoint Descriptor:
        bLength                7
+
bLength                7
        bDescriptorType        5
+
bDescriptorType        5
        bEndpointAddress    0x02  EP 2 OUT
+
bEndpointAddress    0x02  EP 2 OUT
        bmAttributes            2
+
bmAttributes            2
          Transfer Type            Bulk
+
Transfer Type            Bulk
          Synch Type              None
+
Synch Type              None
          Usage Type              Data
+
Usage Type              Data
        wMaxPacketSize    0x0010  1x 16 bytes
+
wMaxPacketSize    0x0010  1x 16 bytes
        bInterval            255
+
bInterval            255
      Endpoint Descriptor:
+
Endpoint Descriptor:
        bLength                7
+
bLength                7
        bDescriptorType        5
+
bDescriptorType        5
        bEndpointAddress    0x83  EP 3 IN
+
bEndpointAddress    0x83  EP 3 IN
        bmAttributes            2
+
bmAttributes            2
          Transfer Type            Bulk
+
Transfer Type            Bulk
          Synch Type              None
+
Synch Type              None
          Usage Type              Data
+
Usage Type              Data
        wMaxPacketSize    0x0010  1x 16 bytes
+
wMaxPacketSize    0x0010  1x 16 bytes
        bInterval            255
+
bInterval            255
    Interface Descriptor:
+
Interface Descriptor:
      bLength                9
+
bLength                9
      bDescriptorType        4
+
bDescriptorType        4
      bInterfaceNumber        2
+
bInterfaceNumber        2
      bAlternateSetting      0
+
bAlternateSetting      0
      bNumEndpoints          0
+
bNumEndpoints          0
      bInterfaceClass      254 Application Specific Interface
+
bInterfaceClass      254 Application Specific Interface
      bInterfaceSubClass      1 Device Firmware Update
+
bInterfaceSubClass      1 Device Firmware Update
      bInterfaceProtocol      1  
+
bInterfaceProtocol      1
      iInterface              7 USB Device Firmware Upgrade
+
iInterface              7 USB Device Firmware Upgrade
 
Device Status:    0x0001
 
Device Status:    0x0001
  Self Powered
+
Self Powered
 
</pre>
 
</pre>
  
Next, you can access it using your favourite terminal program.
+
接下來,你可以使用你最喜歡的終端機程式存取它。之後,若環境仍然不正確的話,你必須使用目前的控制台(如序列控制台(serial console)) 來變更[[bootloader environment#console|控制台環境下的輸入選項]]
 
+
Then, if the environment is not set correctly, you will need to use the current console (e.g. serial console) to change the [[bootloader environment#console|console entries in the environment]]:
+
 
<pre>
 
<pre>
 
GTA01Bv2 # setenv stderr usbtty
 
GTA01Bv2 # setenv stderr usbtty
Line 280: Line 281:
 
</pre>
 
</pre>
  
==== Typical u-boot prompt ====
+
==== 典型的u-boot提示字元====
  
 
<pre>
 
<pre>
Line 293: Line 294:
 
Out:  serial
 
Out:  serial
 
Err:  serial
 
Err:  serial
Hit any key to stop autoboot:  0  
+
Hit any key to stop autoboot:  0
 
GTA01Bv3 #
 
GTA01Bv3 #
 
</pre>
 
</pre>
  
=== Commands on the bootloader prompt ===
+
=== bootloader 提示字元下的指令===
 
+
:''See [[bootloader commands]].''
+
  
 +
'請參考[[bootloader commands|bootloader 指令集]].''
  
== Device Firmware Upgrade ==
 
  
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
+
u-boot也可以使用[[USB DFU]]做為更新工具。對於快速測試下的載入檔案及kernel而言,是很有效的一個方法。
$ lsusb -v -d 1457:5119
+
要找出你的u-boot版本是否支援這個USB DFU,請使用下面的方法:
while the phone is in u-boot mode.
+
$ lsusb -v -d 1457:5119
 +
當裝置目前使用的是u-boot模式。
  
If it supports DFU, you should see the following snippet towards the end of the output:
+
如果它支援DFU,你可以在輸出的訊息後面看到以下的內容:
 
<pre>
 
<pre>
    Interface Descriptor:
+
Interface Descriptor:
      bLength                9
+
bLength                9
      bDescriptorType        4
+
bDescriptorType        4
      bInterfaceNumber        2
+
bInterfaceNumber        2
      bAlternateSetting      0
+
bAlternateSetting      0
      bNumEndpoints          0
+
bNumEndpoints          0
      bInterfaceClass      254 Application Specific Interface
+
bInterfaceClass      254 Application Specific Interface
      bInterfaceSubClass      1 Device Firmware Update
+
bInterfaceSubClass      1 Device Firmware Update
      bInterfaceProtocol      1  
+
bInterfaceProtocol      1
      iInterface              0  
+
iInterface              0
 
</pre>
 
</pre>
  
For information on how to do firmware upgrades, please see [[dfu-util]].
+
要查看韌體如何更新,請參考[[dfu-util]]
  
=== Booting files over DFU ===
+
=== 透過DFU置入檔案 ===
  
To load a file at memory address 0x32000000:
+
要將檔案載入記憶體位置0x32000000:
 
<pre>
 
<pre>
 
dfu-util -a 0 -D fileToLoad -R
 
dfu-util -a 0 -D fileToLoad -R
 
</pre>
 
</pre>
  
After that, send 'bootm 0x32000000' to u-boot or 'bootelf 0x32000000' if
+
之後,傳送'bootm 0x32000000' 到u-boot或者 'bootelf 0x32000000',如果它是一個elf檔案。
its an elf file.
+
  
Simple python script that can boot an ELF image - avoiding a ACM bug that breaks on large packets.
+
簡單的python script可以啟動ELF映像檔—以防止ACM bug破壞較大的封包。
  
 
<pre>
 
<pre>
Line 349: Line 347:
  
 
def output(tty, str):
 
def output(tty, str):
    for x in str:
+
for x in str:
        tty.write(x)
+
tty.write(x)
        tty.flush()
+
tty.flush()
  
 
if len(sys.argv) == 2:
 
if len(sys.argv) == 2:
    print "Loading %s..." % sys.argv[1]
+
print "Loading %s..." % sys.argv[1]
  
    loadfile = "dfu-util -a 0 -D %s -R" % sys.argv[1]
+
loadfile = "dfu-util -a 0 -D %s -R" % sys.argv[1]
  
    os.system(loadfile)
+
os.system(loadfile)
  
    time.sleep(3)
+
time.sleep(3)
  
    tty = open("/dev/ttyACM0", "a")
+
tty = open("/dev/ttyACM0", "a")
  
    output(tty, cmd1)
+
output(tty, cmd1)
    output(tty, cmd2)
+
output(tty, cmd2)
  
    tty.close()
+
tty.close()
 
else:
 
else:
    print "Usage: %s elffile" % sys.argv[0]
+
print "Usage: %s elffile" % sys.argv[0]
    print ""
+
print ""
    sys.exit(2)
+
sys.exit(2)
 
</pre>
 
</pre>
  
== Troubleshooting ==
+
== 問題排除 ==
  
=== USB connectivity problems ===
+
=== USB連接問題 ===
  
I once got errors like this (in dmesg or /var/log/messages) on the host side while connecting the neo in u-boot:
+
在連接Neo時,位於u-boot下,在Linux主機上,我曾經遇到如下的問題 (dmesg or /var/log/messages) o。
  
usb 2-1: device descriptor read/64, error -110
+
usb 2-1: device descriptor read/64, error -110
usb usb2: Controller not stopped yet!
+
usb usb2: Controller not stopped yet!
  
The problem disappeared at least for me by the command below on the host side. Please note that if you have usb keyboard or mouse then the command might cause trouble.. I only have PS/2 so I couldn't test it.
+
利用下面的指令,我解決掉上述的問題。請注意,如果你沒有USB鍵盤或者是滑鼠,用這些指令可能會造成問題。 我只有PS/2界面的裝置,所以,並無法測試這個問題。
  
rmmod uhci_hcd ; modprobe uhci_hcd
+
rmmod uhci_hcd ; modprobe uhci_hcd
  
[[Category:Software]]
+
[[Category:System Developers/zh tw]]
[[Category:Kernel]]
+
[[Category:Guides]]
+

Latest revision as of 14:37, 1 February 2010


u-boot menu on Neo1973
u-boot splash screen on Neo1973

Neo1973上的bootloader U-Boot,負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。這包括用來更新OpenmokUSB DFU、螢幕顯示、啟動選單、bootloader 指令列 控制台。透過 bootloader 環境設定及載入kernel等。

有不同的bootloader版本可供使用,最近版本的是Qi


Contents

[edit] Phase0 快速啟動

  • 請確認你的手機是否已經裝好電池,並且將USB接線移開至少30秒以上。
  • 利用USB接線,將Neo (並不是偵錯板) 連接到Linux主機。
  • 在啟動電源時,按住AUX按鈕以存取選單。
  • 將控制台設定為USB。
  • 在Linux主機上利用「終端機」連接到/dev/ttyACM0 (你可能會用到chown uucp.uucp /dev/ttyACM0 )。
  • 請注意cdc_acm /dev/ttyACM0 存取會連同Neo boots一起消失,它會被cdc_ether usb0網路存取取代。
  • 你現在會進入bootloader 提示指令下。
  • 如果你希望在每次啟動時都停留在bootloader,將bootdelay uboot 環境變數設定為-1 。
Bootloaders

[edit] 一般

GTA01 使用u-boot bootloader.

關於u-boot的更多資訊,可以參考下列網址:

您也可以參考下面的內容,得到其它u-boot的資訊:

  • 使用S3C2410 Steppingstone支援從NAND 中啟動
  • 支援S3C2410 NAND 記憶體
  • 支援透過S3C2410 USB 裝置控制器下載程式
  • 支援在S3C2410 Framebuffer中顯示啟動logo / 狀態

然而,u-boot並不會支援GTA01所需要的功能,如

  • 支援從SD/Transflash讀取kernel/initrd

HaraldWelte目前正在進行這項工作,事實上,已完成大部份的工作。

[edit] Bootloader 源碼

目前的bootloader patche 可以在http://svn.openmoko.org/trunk/src/target/u-boot/patches/這個位置]下位置取得。.

將源碼解壓縮縮,套用到patch,執行"make gta01bv3_config" (或gta01bv2_config, 或你擁有的任何硬體版本),執行"make"。你將會得到"u-boot.bin" 映像檔,你可以在NAND中直接更新 (也可以使用現有的bootloader 或 sjf2410-linux)。


[edit] Bootloader 二進位檔

最新的bootloader 二進位檔可以在以下的位置中找到under http://buildhost.openmoko.org/snapshots in the subdirectory 200X.XX/images/。它應該被寫入NAND 0x00000000的位置 (大小為0x30000) (第一個 分割區).

[edit] 開發Bootloader

[edit] QT2410

如果你想要在QT2410上開發bootloader,使用bootloader 映像檔更新會從USB上下載到RAM來的簡單的多。 要進行這項工作,你必須編輯u-boot/include/configs/qt2410.h 檔案,並且將第32行程式中的"if 0"變更為 "if 1",之後再使用"make"重新編譯。

產生的"u-boot.bin" 檔案對於NAND記憶體並不穩定,但卻可以直接或在RAM中執行,如透過使用s3c2410_boot_usb 程式。

[edit] GTA01

在GTA01上開發bootloader是很辣手的一件事情,首先,我們並不會有任何的NOR記憶體。第二,並沒有其它的方法可以不從NAND中啟動。然而,我們也不會有一個像QT2410一樣的USB下載器。

最主要的問題是:S3C2410 Steppingstone內部的SRAM的前4K並沒有被限制。SRAM 分割並非絕對性的對應到實體0的位置。我們要如何因應呢?

[edit] 使用JTAG 自RAM中啟動

那我們要如何自RAM啟動?我們使用JTAG / OpenOCD 進行:

  • 在PC=0的時候重設及暫停CPU
> 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
  • 針對低階SDRAM啟動下載程式片段 (做為4k的sram踏腳石)
> load_binary /space/misc/gta01/u-boot.git/board/gta01/lowlevel_foo.bin 0
downloaded 332 byte in 0s 21899us
  • 在0x33f80000插入中斷點 (能指出低階程式已完成)
> bp 0x33f80000 4 hw
在0x33f80000 中加入中斷點
  • 執行程式到中斷點
> resume
Target 0 重新開始
> Target 0 halted
因中斷點的關係,目標暫停,目前的模式為:Supervisor
cpsr: 0x600000d3 pc: 0x33f80000
MMU: disabled, D-Cache: disabled, I-Cache: enabled
  • 下載u-boot RAM映像檔到0x33f80000
> load_binary /space/misc/gta01/u-boot.git/u-boot.bin 0x33f80000
downloaded 135692 byte in 6s 567264us
  • 繼續處理
> resume
Target 0 重新開始

在進行到這裡時,顯示的背光會變明亮,我們會看到下面的指令:

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 #

[edit] 建立可啟動的映像檔

u-boot 需要可啟動的映像檔 (如kernels,也包括 initrd 及其它內容) ,形成所謂的uImage。為了建立uImage,如從vmlinux kernel 映像檔,你可以進行下面的處理:

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

[edit] 啟動選單

u-boot boot menu on Neo1973

從Phase-0 釋出後,我們的u-boot版本現在放在以螢幕顯示的啟動選單中,選單中的項目被定義在環境選單輸入中。

[edit] 存取啟動選單

你可以在啟動電話時,藉由按下Neo1973 AUX Button 及電源按鈕來存取選單。

[edit] 使用啟動選單

藉由按下Neo1973 AUX Button 你可以循環使用選單項目。使用POWER按鈕選取其中的項目。

[edit] Bootloader 命令提示

[edit] 存取bootloader的命令提示

bootloader 命令提示可以在序列控制台上進行 (透過Debug Board) 或者是虛擬USB 序列裝置(USB CDC_ACM)。 不論是序列埠或usb,都依照stdinstdoutstderr u-boot 環境變數而定。

不論你是否使用usbtty,前面的訊息會在序列控制台中顯示。bootloader 目前被設定為三秒鐘的等待時間。如果在 三秒內,stdin中收到鍵入的訊息,自動啟動就會被取消掉。

[edit] 自Linux中使用usbtty

藉由在u-boot模式下連接電話到Linux 主機上,它會讓它偵測到 CDC ACM 裝置,你會擁有一個名為/dev/ttyACM0的新tty裝置。若沒有的話,請啟用CONFIG_USB_ACM (Device Drivers -> USB support -> USB Modem (CDC ACM) support)。 (MacOS 的使用者請參考這裡取得更多資訊)

使用你熟悉的模擬器 (minicom, cu, zc, screen ...) 像使用任何序列埠般存取。如果你並沒有熟悉的模擬器,可以試試看: (位於taylor-uucp 中的cu,使用"apt-get 安裝 cu" 如果它還未安裝話。 cu -l /dev/ttyACM0

你會需要用到 chown uucp.uucp /dev/ttyACM0

取得必要的權限(甚至是root)

可以用來取代cu的另一個方法是 Werner Almesberger的 neocon

首先,你必須試著去查看在你執行u-boot模式時,USB裝置是否出現了'lsusb' 。

  1. lsusb -d 1457:5119

Bus 005 Device 079: ID 1457:5119

接著,讓我們來查看更多可用的endpoint及設定:

# 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

接下來,你可以使用你最喜歡的終端機程式存取它。之後,若環境仍然不正確的話,你必須使用目前的控制台(如序列控制台(serial console)) 來變更控制台環境下的輸入選項

GTA01Bv2 # setenv stderr usbtty
GTA01Bv2 # setenv stdout usbtty
GTA01Bv2 # setenv stdin usbtty

[edit] 典型的u-boot提示字元

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 #

[edit] bootloader 提示字元下的指令

'請參考bootloader 指令集.


[edit] 裝置軔體更新

u-boot也可以使用USB DFU做為更新工具。對於快速測試下的載入檔案及kernel而言,是很有效的一個方法。 要找出你的u-boot版本是否支援這個USB DFU,請使用下面的方法: $ lsusb -v -d 1457:5119 當裝置目前使用的是u-boot模式。

如果它支援DFU,你可以在輸出的訊息後面看到以下的內容:

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

要查看韌體如何更新,請參考dfu-util

[edit] 透過DFU置入檔案

要將檔案載入記憶體位置0x32000000:

dfu-util -a 0 -D fileToLoad -R

之後,傳送'bootm 0x32000000' 到u-boot或者 'bootelf 0x32000000',如果它是一個elf檔案。

簡單的python script可以啟動ELF映像檔—以防止ACM bug破壞較大的封包。

#!/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)

[edit] 問題排除

[edit] USB連接問題

在連接Neo時,位於u-boot下,在Linux主機上,我曾經遇到如下的問題 (在 dmesg or /var/log/messages) o。

usb 2-1: device descriptor read/64, error -110 usb usb2: Controller not stopped yet!

利用下面的指令,我解決掉上述的問題。請注意,如果你沒有USB鍵盤或者是滑鼠,用這些指令可能會造成問題。 我只有PS/2界面的裝置,所以,並無法測試這個問題。

rmmod uhci_hcd ; modprobe uhci_hcd

Personal tools
u-boot menu on Neo1973
u-boot splash screen on Neo1973

Neo1973上的bootloader-- U-Boot ,負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。這包括用來更新OpenmokUSB DFU、螢幕顯示、啟動選單、bootloader 指令列控制台、透過 bootloader 環境設定及載入kernel等。

有不同的bootloader版本可供使用:

Phase0 快速啟動

  • 請確認你的電話是目前是裝好電池,並且USB接線至少移開30秒以上。
  • 利用USB接線,連接Neo (ie 並不是偵錯板) 到Linux主機。
  • 在啟動電源時,按住AUX 按鈕以存取選單。
  • 將控制台設定為USB
  • 在Linux主機上利用「終端機」連接到/dev/ttyACM0 (你可能會用到chown uucp.uucp /dev/ttyACM0 )
  • 請注意cdc_acm /dev/ttyACM0 存取會連同Neo boots一起消失,它會被cdc_ether usb0網路存取取代。
  • 你現在會進入bootloader 提示指令下。
  • 如果你希望在每次啟動時都停留在bootloader,將bootdelay uboot 環境變數設定為-1 。

一般

GTA01 使用u-boot bootloader.

關於u-boot的更多資訊,可以參考下列網址:

您也可以參考下面的內容,得到其它u-boot的資訊:

  • 使用S3C2410 Steppingstone支援從NAND 中啟動
  • 支援S3C2410 NAND flash
  • 支援透過S3C2410 USB 裝置控制器下載程式
  • 支援在S3C2410 Framebuffer中顯示啟動logo / 狀態

然而,u-boot並不會支援GTA01所需要的功能,如

  • 支援從SD/Transflash讀取kernel/initrd

HaraldWelte目前正在進行這項工作,事實上,已完成大部份的工作。

Bootloader 源碼

目前的bootloader patches 可以在下面的位置取得: http://svn.openmoko.org/trunk/src/target/u-boot/patches/.

將源碼解壓縮縮,套用到patch,執行"make gta01bv3_config" (或gta01bv2_config, 或你擁有的任何硬體版本),執行"make"。你將會得到"u-boot.bin" 映像檔,你可以在NAND中直接更新(也可以使用現有的bootloader 或 sjf2410-linux)。


Bootloader 二進位檔

最新的bootloader 二進位檔可以在以下的位置中找到under http://buildhost.openmoko.org/snapshots in the subdirectory 200X.XX/images/。它應該被寫入NAND 0x00000000的位置 (大小為0x30000) (第一個分割區partition).

開發Bootloader

QT2410

如果你想要在QT2410上開發bootloader,使用bootloader 映像檔更新會從USB上下載到RAM來的簡單的多。 要進行這項工作,你必須編輯u-boot/include/configs/qt2410.h 檔案,並且將第32行程式中的"if 0"變更為 "if 1",之後再使用"make"重新編譯。

產生的"u-boot.bin" 檔案對於NAND記憶體並不穩定,但卻可以直接或在RAM中執行,如透過使用s3c2410_boot_usb 程式。

GTA01

在GTA01上開發bootloader是很辣手的一件事情,首先,我們並不會有任何的NOR記憶體。第二,並沒有其它的方法可以不從NAND中啟動。然而,我們也不會有一個像QT2410一樣的USB下載器。

最主要的問題是: S3C2410 Steppingstone內部的SRAM的前4K並沒有被限制。SRAM 分割並非絕對性的對應到實體0的位置。我們要如何因應呢?

使用JTAG 自RAM中啟動

那我們要如何自RAM啟動?我們使用JTAG / OpenOCD 進行:

  • 在PC=0的時候重設及暫停CPU
> 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
  • 針對低階SDRAM啟動下載程式片段(做為4k的sram的踏腳石)
> load_binary /space/misc/gta01/u-boot.git/board/gta01/lowlevel_foo.bin 0            
downloaded 332 byte in 0s 21899us
  • 在0x33f80000插入中斷點 (能指出低階程式已完成)
> 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
  • 下載u-boot RAM映像檔到0x33f80000
> load_binary /space/misc/gta01/u-boot.git/u-boot.bin 0x33f80000
downloaded 135692 byte in 6s 567264us
  • 繼續處理
> resume
Target 0 resumed

在進行到這裡時,顯示的背光會變明亮,我們會看到下面的指令:

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 需要可啟動的映像檔 (如kernels,也包括 initrd 及其它內容) ,形成所謂的uImage。為了建立uImage,如從vmlinux kernel 映像檔,你可以進行下面的處理:

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

啟動選單

u-boot boot menu on Neo1973

從Phase-0 釋出後,我們的u-boot版本現在放在以螢幕顯示的啟動選單中,選單中的項目被定義在環境選單輸入中。

存取啟動選單

你可以在啟動電話時,藉由按下Neo1973 AUX Button 及電源按鈕來存取選單。

使用啟動選單

藉由按下Neo1973 AUX Button 你可以循環使用選單項目。使用POWER按鈕選取其中的項目。

Bootloader 命令提示

存取bootloader的命令提示

bootloader 命令提示可以在序列控制台上進行 (透過Debug Board) 或者是虛擬USB 序列裝置(USB CDC_ACM)。 不論是序列埠或usb,都依照stdinstdoutstderr u-boot 環境變數而定。

不論你是否使用usbtty,前面的訊息會在序列控制台中顯示。bootloader 目前被設定為三秒鐘的等待時間。如果在 三秒內,stdin中收到鍵入的訊息,自動啟動就會被取消掉。

自Linux中使用usbtty

藉由在u-boot模式下連接電話到Linux 主機上,它會讓它偵測到 CDC ACM 裝置,你會擁有一個名為/dev/ttyACM0的新tty裝置。若沒有的話,請啟用CONFIG_USB_ACM (Device Drivers -> USB support -> USB Modem (CDC ACM) support)。 (MacOS 的使用者請參考這裡取得更多資訊)

使用你熟悉的模擬器 (minicom, cu, zc, screen ...) 像使用任何序列埠般存取。如果你並沒有熟悉的模擬器,可以試試看: (位於taylor-uucp 中的cu,使用"apt-get 安裝 cu" 如果它還未安裝話。

cu -l /dev/ttyACM0

你會需要用到

chown uucp.uucp /dev/ttyACM0

取得必要的權限(甚至是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, lets 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

Typical u-boot prompt

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 #

Commands on the bootloader prompt

See bootloader commands.


Device Firmware Upgrade

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.

Booting files over DFU

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)

Troubleshooting

USB connectivity problems

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!

The problem disappeared at least for me by the command below on the host side. Please note that if you have usb keyboard or mouse then the command might cause trouble.. I only have PS/2 so I couldn't test it.

rmmod uhci_hcd ; modprobe uhci_hcd