View source for Flashing the Neo FreeRunner/zh cn

From Openmoko

Jump to: navigation, search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Administrators.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page:

Templates used on this page:

Return to Flashing the Neo FreeRunner/zh cn.

Personal tools

OpenMoko会不断发布最新的根文件系统(root file system)、内核(kernel)和[[Bootloader(called U-Boot) 的二进制映像(binary image)文件。这些文件可以被烧写到Neo FreeRunner的Flash memory (NAND) 中,从而达到更新系统套件的目的。你可以通过一根USB线,连接FreeRunner到电脑上,通过OpenMoko提供的烧写工具来更新系统。

3类软件组件and 2种存储器


  • bootloader: 这是FreeRunner启动或者重启时执行的第一段小程序,它再启动其他软件系统。
  • kernel: FreeRunner采用的Linux内核。
  • root filesystem: 包括所有的应用程序和命令文件。


FreeRunner有两种程序存储器:NOR flash与NAND flash。在PC机上,如果你想重装操作系统,你一般会使用一个光盘来启动系统,然后将操作系统从光盘拷贝安装到硬盘上。FreeRunner并没有光驱,但系统文件必须安装进内部的存储器(NAND flash)当中去。当然,一种可能的方式是从microSD卡来启动。

NOR flash是一个很小的程序存储器,里面存放着一段启动代码。当你需要重新安装系统,也就是需要重写NAND flash的时候,你可以从NOR flash启动来进行操作。一般来说,NOR flash是很少需要更新;如果需要,你可以从这里找到更新方法:Flashing NOR.。

NAND flash 就像PC机中的硬盘,它被分为三个分区,分别存放bootloader, kernel, 和rootfs。这三个分区分别可以独立的进行擦写更新。譬如,如果你想更新一个修改过的kernel,你只需要按照更新kernel的步骤进行操作就可以了。


另一种方式: 将系统安装运行在 microSD 卡上

你可以将软件系统安装在microSD卡上,这样你可以从microSD卡启动并运行系统 boot from microSD card。这样可以同时保留在NAND flash上的系统,从而达到在FreeRunner上安装双系统的目的。(譬如,假如你的FreeRunner当前已经安装了2007.2的OM系统,你想在不擦除当前系统的前提下测试2008.08的OM系统,这种在microSD卡上的方式就是一个很好的选择了)

Software you need

#1 Tools for flashing: DFU-util and NeoTool

Command-line. DFU-util, the tool to flash the FreeRunner has to be installed on you laptop or desktop machine. It is available for Linux, MacOS X, and Windows (see links below). DFU-util allows you to connect to the FreeRunner through the USB cable and control its bootloader. That connection uses a special protocol which addresses the bootloader's interface, and differs from USB networking. For more details, see the separate dfu-util page.

GUI. Instead of the command-line-based DFU-util, you can use NeoTool, a graphical tool for flashing the FreeRunner: see the NeoTool page.


Make sure it is executable by setting the permissions with this command: chmod a+x dfu-util

Linux 64-bit: You need 64-bit version of dfu-util, which usually can be found in your distribution repository. If your destribution does not provide 64-bit dfu-util, or it consistently fails with a "-62" error, you have two ways to go:

  1. Seek for 32-bit machine and do flashing form it.
  2. Use 32-bit chroot (on amd64 debian). Worked for me --Bubak 16:54, 4 September 2008 (UTC).
  3. Just try the 32-bit dfu-util. Worked fine on my x86_64 Fedora 10 --pcfe 2009-01-16.
    • I can confirm this (Gentoo multilib x86_64) --Unlotto 14:15, 4 February 2009 (UTC)

MacOS X: MacOS_X#Graphical_Flashing_with_Openmoko_Flasher


See additional driver installation instructions for Windows at Dfu-util-windows

Virtual machines While there has been some limited success reported using dfu-util from within a Virtual Machine (such as VMware), in general it is not possible to use dfu-util in this fashion. You must use dfu-util on an operating system that has direct access to the physical USB device hardware.

#2 需要烧写映像文件


请参考Distributions 来选择你需要的软件系统,然后到Download 下载。

Boot the FreeRunner from NOR Flash

Booting from NOR Flash
  1. Read the other sections of this page first, because you will have 30 seconds to enter the flashing commands, come back here when ready.
  2. Do not connect the USB cable from the PC to your Neo FreeRunner yet (disconnect it).
  3. Boot your Neo FreeRunner into the NOR uBoot menu for flashing.
    1. Press and hold AUX button
    2. Press the Power button until the boot menu comes up
    3. This menu is labelled *** BOOT MENU (NOR) ***
    4. See also Booting the Neo FreeRunner
  4. Stay in NOR uBoot menu, do not select or enter any item in menu. Now you will be able to flash, make backups of your FreeRunner or query the FreeRunner with dfu-util.
  5. The FreeRunner only stays at the NOR boot prompt for about 30 seconds and then shuts off unless you do something.
  6. Connect your Neo to the GNU/Linux or Windows host via a USB cable.
  7. Now you can enter the dfu-util commands on your PC as described below.
  8. If the Neo FreeRunner turns off before you press start flashing (screen goes black), go back to step 2. If you start flashing in time, the phone will not turn off meanwhile.

Note that the dfu-util connection does not use Ethernet over USB - that is, you should not attempt to set up a usb0 network interface on your GNU/Linux host desktop (on Windows, you need a DFU class driver, or you can use the LibUSB-Win32 driver described on the Dfu-util-windows page). The dfu-util utility sets up its own connection to the FreeRunner. In fact, you will not be able to make an Ethernet-over-USB connection to the FreeRunner when it is at the uBoot menu; this type of connection is only available when the FreeRunner has booted fully.

After connecting the FreeRunner to your host via USB cable, you can test whether dfu-util "sees" the FreeRunner by executing:

dfu-util -l

If you get error messages from the dfu-util command then try again. Often it works on the second try.

dfu-util uses the DeviceFirmwareUpgrade protocol, and may list more than one device. If so, try unplugging the other device (e.g. a USB mouse) or using the -d switch to tell dfu-util which device it should talk to, as described at the relevant bug report [1].

Also, please remember to execute the dfu-util command with sufficient privileges (ie. root) -- you will need complete control over the usb bus.



Using dfu-util

dfu-util can be used to read flash memory, write memory, and get information from the device.

This is the general command format to write an image file to a (predefined) "partition name" (referred to as altsetting in dfu-util help/manual) :

dfu-util -a <altsetting> -R -D <file_name>

-a altsetting : Specify the altsetting of the DFU interface by name or by number
-R  : Issue USB Reset signalling once we're finished
-D file_name : Write firmware from file_name into device

On Linux, you run dfu-util from a command shell prompt. If you have not put it somewhere on your command path you probably need to prefix it with a "./" like this ./dfu-util. On some systems you need to be root before this will work and on Ubuntu you must preface the command with "sudo" or you will get the following error: "Cannot claim interface: could not claim interface 2: Operation not permitted"

On Windows, you need to open a command window and run from a command line. Use Start-Run Program and type "cmd" to open a Window.

More detailed manual for dfu-util is available here : Dfu-util

GUI frontend for dfu-util (and more): NeoTool

烧写更新 Kernel

提示: 本操作需要在u-boot的启动菜单界面下进行,在按电源键启动手机时同时按住选择键便可以进入启动菜单。


dfu-util -a kernel -R -D /path/to/uImage


status(0) = No error condition is present


烧写根文件系统 rootfs



dfu-util -a rootfs -R -D rootfs_filename.jffs2

rootfs_filename.jffs2 是根文件系统映像文件的文件名。 一个70M的影响文件的烧写时间大约是15分钟,注意保证你的FreeRunner的电池有充足的电量。


status(0) = No error condition is present




dfu-util -a u-boot -R -D uboot.bin

uboot.bin 是bootloader映像文件的文件名.

提示: 要更新bootloader,你需要从NOR flash启动boot from NOR first. 更新完成后,再从NAND flash启动。



注意:如果你同时也更新了bootloader,那么更新后一定要从NAND flash启动, in particular if you upgraded the boot-loader (方法: 1. 按住电源键 ,然后 2. 按选择键)

会出现启动菜单 *** BOOT MENU (NAND) *** (see booting from NAND for more detailed instructions).

A command line script to simplify dfu-util

DFUScript developed to assist users who have multiple devices in using dfu-util via the command line. Information on where to download and use DFUScript can be found on DFUScript

Alternative: using nandwrite

This approach involves writing the rootfs into nand directly on the phone from a system already running on it, not necessarily via usb from a computer.

If you have a system running from a different partition that you intend to flash (for example sd card), you can use nandwrite to do the work, which is much faster (it takes about 30s to write a 59MB jffs2 image).

Make sure you have nandwrite installed (on gentoo, it's in sys-fs/mtd-utils package)

Also make sure that the host system has received correct partition list, for example for my stock Neo Freerunner partition list:

#cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00010000 "physmap-flash.0"
mtd1: 00040000 00020000 "u-boot"
mtd2: 00040000 00020000 "u-boot_env"
mtd3: 00800000 00020000 "kernel"
mtd4: 000a0000 00020000 "splash"
mtd5: 00040000 00020000 "factory"
mtd6: 0f6a0000 00020000 "rootfs"

In this case, we're looking for 'rootfs' which according to above is mtd6. If you have it somewhere else, substitute mtd6 with whatever you have in the remainder of this section.

You can test your nand for bad blocks by issuing nandtest /dev/mtd6 (this is a destructive test !)

First, put your .jffs2 file somewhere the phone system can read it

Second, write the desired image into the nand this way:

flash_eraseall /dev/mtd6
nandwrite -p /dev/mtd6 /path/to/image.jffs2

You're all done !



  • 你可能把软件的image文件烧写错了位置,譬如你可能把kernel文件当作rootfs来烧写了。内核image文件名一般为uImage.bin,bootloader的image文件名为u-boot.bin。解决办法是重新烧写一次。
  • 另一种可能就是你下载image文件事出错了。重新下载一次,并用MD5检查文件的完整性。

See also

  • Qi 不同于uboot的另一个bootloader