Flashing the Neo FreeRunner/ru

From Openmoko

Revision as of 10:30, 18 December 2008 by Kayo (Talk | contribs)

Jump to: navigation, search

Openmoko регулярно выпускает обновлённые версии Openmoko корневой файловой системы, kernel, и U-Boot в двоичных образах. Всё это может быть записано во Flash память(NAND) Neo FreeRunner. Для этого, вы можете использовать USB кабель и другой компьютер чтобы прошить Neo FreeRunner "через" USB.

Contents

Обзор

Все компоненты программного обеспечения FreeRunner объединяются в месте в двоичные образы.

В настольном компьютере когда Вы хотите заменить операционную систему (OS), вы должны загрузиться с привода CD-ROM, затем скопировать файлы OS с CD на жесткий диск. FreeRunner не имеет привода CD-ROM и файлы должны быть перезаписаны/прошиты непосредственно на внутренний накопитель (NAND flash). Так же возможно записать все файлы OS на внешнюю карту памяти microSD и загружаться с неё.


FreeRunner имеет два внутренних накопителя: NOR flash и NAND flash. NOR flash небольшая и хранит только специальную загрузочную программу, используемую когда вам нужно перезаписать или прочитать содержимое на NAND flash. NAND flash работает как накопитель, типа жесткого диска.

The NAND Flash разбит на три раздела, для загрузчика (bootloader), ядра (kernel) и корневой файловой системы (root filesystem) - все эти компоненты могут быть перезаписаны по отдельности. Например если вы хотите установить модифицированное ядро, вам нужно сделать только один шаг, прошить образ ядра.

  • загрузчик (bootloader): это небольшая программа которая загружается первой и запускается при включении или reset FreeRunner(в зависимости какую загрузку выбрали, версию для NOR или NAND загрузчика).
  • ядро (kernel): Основной компонент операционной системы Linux.
  • корневая ФС (root filesystem): содержит все файлы, образующие команды и приложения, которые вы можете запустить.

Прежде чем начинать: Очистка root filesystem или прошивка uboot это радикальные меры. Подумайте о необходимости таких действий. Иногда проблемы могут быть устранены обновлением только ядра.

Альтернатива : запуск с карточки microSD

Вы можете установить дистрибутив на карте microSD, для того, чтобы загружаться с microSD карты. Это позволит вам, сохранить другой дистрибутив установленный в NAND (например, чтобы тестировать 2008.08 и иметь 2007.2 для загрузки по умолчанию).

Соберите то что вам нужно

Скачивание программы DFU-util

Установите эту программу на ваш компьютер. Это позволит вам подключать FreeRunner по кабелю USB и управлять загрузчиком. Это соединение использует специальный протокол который обращается к интерфейсу загрузчика и отличается от связи(организации сети) по USB. Есть отдельная страница с более подробным описанием: dfu-util.


MacOS X: MacOS_X#Graphical_Flashing_with_Openmoko_Flasher

Linux: http://downloads.openmoko.org/releases/Om2008.8-update/dfu-util

Убедитесь, что dfu-util имеет права на выполнение, установите их командой: chmod a+x dfu-util

Важно: Кажется, на 64-bit версии Linux утилита dfu-util падает с ошибкой "-62". Если у вас в распоряжении есть 32-bit машина, лучше используйте ее! Есть некоторые пакеты в ubuntu64 interpid, которые работают хорошо также и в hardy. Поэтому можете попробовать на свой собственный риск: [1].

Использование 32-bit chroot (на amd64 debian) у меня работало --Bubak 16:54, 4 September 2008 (UTC).

Windows: http://projects.openmoko.org/frs/?group_id=166&release_id=162

Смотрите дополнительные инструкции по установке драйверов для Windows в Dfu-util-windows

Скачивание образа который вам нужен

То, какие точно файлы вам нужны, зависит от того, что вы пытаетесь установить. В большинстве случаев вам потребуется установить ядро (uImage) и корневую файловую систему (rootfs). В редких случаях, когда вы хотите исправить некоторые ошибки, вам потребуется также установить новый загрузчик.

Пожалуйста, прочтите страницу Дистрибутивы для выбора дистрибутива, который соответствует вашим потребностям, затем обратитесь к странице Загрузка для загрузки.

Загрузка FreeRunner с 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.

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

Резервное копирование

Если у вас есть рабочий образ, который вам нравится, вероятно, вы должны сделать Pre-Flash Backup.

Использование 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

where:
-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 gfu-util is available here : Dfu-util

Прошивка ядра

Note: The phone needs to be in the U-boot bootup menu for this to work. Get there by holding down the aux button while powering up the device.

The command format is

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

When flashing succeeds the following will be shown:

status(0) = No error condition is present Done!

Flashing may fail with an error -110. This indicates that the kernel is too big for the default kernel partition. uboot can be used to change the size of the default partitions on the device. It may also mean that you are trying to put the wrong thing in the kernel space.

Прошивка основной файловой системы

The root filesystem has to be an image in jffs2 format. If the file you downloaded is zipped or compressed (has a .gz, bz2, .zip, tar, tar.gz or .tgz extension) you have to uncompress it first.

The command format is

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

where rootfs_filename.jffs2 is the name of the file containing the root filesystem.

When flashing succeeds the following will be shown:

status(0) = No error condition is present Done!

Прошивка загрузчика в NAND

The boot loader (U-boot) file should have a .bin extension. As with the root filesystem, if the file you downloaded is zipped or compressed (has a .gz or .zip extension) you have to uncompress it first.

The command format is

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

where uboot.bin is the name of the boot loader binary image file.

Reminder: You should have boot from NOR first, in order to flash the boot-loader in NAND. After flashing succesfully, make sure you reboot from NAND's newly flashed boot loader, to benefit from the updates.

(Optional) After an upgrade, you may wish to check that the u-boot version matches the one you have just flashed. You can use 'grep Bootloader /dev/mtdblock1' from a shell on the FreeRunner (and possibly the 1973 as well) to get the NAND u-boot version, like this: root@om-gta02:~# grep Bootloader /dev/mtdblock1 Neo1973 Bootloader U-Boot 1.3.2+gitr18+64eb10cab8055084ae25ea4e73b66dd03cc1a0cb

You can grep for the same string in /dev/mtdblock0 to retrieve the NOR u-boot version: root@om-gta02:~# grep Bootloader /dev/mtdblock0 Neo1973 Bootloader U-Boot 1.3.2-moko12


Перезагрузка FreeRunner с NAND

You should now be able to boot into the new images.

Pay attention to booting from the NAND flash this time, in particular if you upgraded the boot-loader (in short: 1. press and hold power button down, and then 2. press aux button)

The boot menu should be labelled *** BOOT MENU (NAND) *** this time (see booting from NAND for more detailed instructions).

Скрипт который все это делает GUI...

... в разработке, смотри this thread и that update. Скачать http://users.on.net/~antisol/frutil

Personal tools

Openmoko регулярно выпускает обновлённые версии Openmoko корневой файловой системы, kernel, и U-Boot в двоичных образах. Всё это может быть записано во Flash память(NAND) Neo FreeRunner. Для этого, вы можете использовать USB кабель и другой компьютер чтобы прошить Neo FreeRunner "через" USB.

Обзор

Все компоненты программного обеспечения FreeRunner объединяются в месте в двоичные образы.

В настольном компьютере когда Вы хотите заменить операционную систему (OS), вы должны загрузиться с привода CD-ROM, затем скопировать файлы OS с CD на жесткий диск. FreeRunner не имеет привода CD-ROM и файлы должны быть перезаписаны/прошиты непосредственно на внутренний накопитель (NAND flash). Так же возможно записать все файлы OS на внешнюю карту памяти microSD и загружаться с неё.


FreeRunner имеет два внутренних накопителя: NOR flash и NAND flash. NOR flash небольшая и хранит только специальную загрузочную программу, используемую когда вам нужно перезаписать или прочитать содержимое на NAND flash. NAND flash работает как накопитель, типа жесткого диска.

The NAND Flash разбит на три раздела, для загрузчика (bootloader), ядра (kernel) и корневой файловой системы (root filesystem) - все эти компоненты могут быть перезаписаны по отдельности. Например если вы хотите установить модифицированное ядро, вам нужно сделать только один шаг, прошить образ ядра.

  • загрузчик (bootloader): это небольшая программа которая загружается первой и запускается при включении или reset FreeRunner(в зависимости какую загрузку выбрали, версию для NOR или NAND загрузчика).
  • ядро (kernel): Основной компонент операционной системы Linux.
  • корневая ФС (root filesystem): содержит все файлы, образующие команды и приложения, которые вы можете запустить.

Прежде чем начинать: Очистка root filesystem или прошивка uboot это радикальные меры. Подумайте о необходимости таких действий. Иногда проблемы могут быть устранены обновлением только ядра.

Альтернатива : запуск с карточки microSD

Вы можете установить дистрибутив на карте microSD, для того, чтобы загружаться с microSD карты. Это позволит вам, сохранить другой дистрибутив установленный в NAND (например, чтобы тестировать 2008.08 и иметь 2007.2 для загрузки по умолчанию).

Соберите то что вам нужно

Скачивание программы DFU-util

Установите эту программу на ваш компьютер. Это позволит вам подключать FreeRunner по кабелю USB и управлять загрузчиком. Это соединение использует специальный протокол который обращается к интерфейсу загрузчика и отличается от связи(организации сети) по USB. Есть отдельная страница с более подробным описанием: dfu-util.


MacOS X: MacOS_X#Graphical_Flashing_with_Openmoko_Flasher

Linux: http://downloads.openmoko.org/releases/Om2008.8-update/dfu-util

Убедитесь, что dfu-util имеет права на выполнение, установите их командой: chmod a+x dfu-util

Важно: Кажется, на 64-bit версии Linux утилита dfu-util падает с ошибкой "-62". Если у вас в распоряжении есть 32-bit машина, лучше используйте ее! Есть некоторые пакеты в ubuntu64 interpid, которые работают хорошо также и в hardy. Поэтому можете попробовать на свой собственный риск: [1].

Использование 32-bit chroot (на amd64 debian) у меня работало --Bubak 16:54, 4 September 2008 (UTC).

Windows: http://projects.openmoko.org/frs/?group_id=166&release_id=162

Смотрите дополнительные инструкции по установке драйверов для Windows в Dfu-util-windows

Скачивание образа который вам нужен

То, какие точно файлы вам нужны, зависит от того, что вы пытаетесь установить. В большинстве случаев вам потребуется установить ядро (uImage) и корневую файловую систему (rootfs). В редких случаях, когда вы хотите исправить некоторые ошибки, вам потребуется также установить новый загрузчик.

Пожалуйста, прочтите страницу Дистрибутивы для выбора дистрибутива, который соответствует вашим потребностям, затем обратитесь к странице Загрузка для загрузки.

Загрузка FreeRunner с 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.

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

Резервное копирование

Если у вас есть рабочий образ, который вам нравится, вероятно, вы должны сделать Pre-Flash Backup.

Использование 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

where:
-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 gfu-util is available here : Dfu-util

Прошивка ядра

Note: The phone needs to be in the U-boot bootup menu for this to work. Get there by holding down the aux button while powering up the device.

The command format is

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

When flashing succeeds the following will be shown:

status(0) = No error condition is present Done!

Flashing may fail with an error -110. This indicates that the kernel is too big for the default kernel partition. uboot can be used to change the size of the default partitions on the device. It may also mean that you are trying to put the wrong thing in the kernel space.

Прошивка основной файловой системы

The root filesystem has to be an image in jffs2 format. If the file you downloaded is zipped or compressed (has a .gz, bz2, .zip, tar, tar.gz or .tgz extension) you have to uncompress it first.

The command format is

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

where rootfs_filename.jffs2 is the name of the file containing the root filesystem.

When flashing succeeds the following will be shown:

status(0) = No error condition is present Done!

Прошивка загрузчика в NAND

The boot loader (U-boot) file should have a .bin extension. As with the root filesystem, if the file you downloaded is zipped or compressed (has a .gz or .zip extension) you have to uncompress it first.

The command format is

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

where uboot.bin is the name of the boot loader binary image file.

Reminder: You should have boot from NOR first, in order to flash the boot-loader in NAND. After flashing succesfully, make sure you reboot from NAND's newly flashed boot loader, to benefit from the updates.

(Optional) After an upgrade, you may wish to check that the u-boot version matches the one you have just flashed. You can use 'grep Bootloader /dev/mtdblock1' from a shell on the FreeRunner (and possibly the 1973 as well) to get the NAND u-boot version, like this: root@om-gta02:~# grep Bootloader /dev/mtdblock1 Neo1973 Bootloader U-Boot 1.3.2+gitr18+64eb10cab8055084ae25ea4e73b66dd03cc1a0cb

You can grep for the same string in /dev/mtdblock0 to retrieve the NOR u-boot version: root@om-gta02:~# grep Bootloader /dev/mtdblock0 Neo1973 Bootloader U-Boot 1.3.2-moko12


Перезагрузка FreeRunner с NAND

You should now be able to boot into the new images.

Pay attention to booting from the NAND flash this time, in particular if you upgraded the boot-loader (in short: 1. press and hold power button down, and then 2. press aux button)

The boot menu should be labelled *** BOOT MENU (NAND) *** this time (see booting from NAND for more detailed instructions).

Скрипт который все это делает GUI...

... в разработке, смотри this thread и that update. Скачать http://users.on.net/~antisol/frutil