Wiren Board 5: Build an image to download in USB Mass-Storage mode/en: различия между версиями

Материал из Wiren Board
(Новая страница: «This manual describes how to build bootstream to boot Linux from USB Mass Storage Gadget. In this case, the contents of the SD-card becomes available via USB as a…»)
(Новая страница: «The structure of the bootstream: * '''U-Boot SPL''' - primary boot loader performs initial initialization * '''U-Boot''' - the boot loader itself, runs Linux * Th…»)
Строка 2: Строка 2:
This manual describes how to build bootstream to boot Linux from USB Mass Storage Gadget. In this case, the contents of the SD-card becomes available via USB as a normal USB flash drive.
This manual describes how to build bootstream to boot Linux from USB Mass Storage Gadget. In this case, the contents of the SD-card becomes available via USB as a normal USB flash drive.


Структура bootstream:
The structure of the bootstream:
* '''U-Boot SPL''' - первичный загрузчик, проводит начальную инициализацию
* '''U-Boot SPL''' - primary boot loader performs initial initialization
* '''U-Boot''' - собственно загрузчик, запускает Linux
* '''U-Boot''' - the boot loader itself, runs Linux
* Образ ядра Linux, состоит из нескольких частей
* The Linux kernel image consists of several parts
** '''zImage''' - cобственно ядро
** '''zImage''' - kernel
** '''initramfs''' - файловая система с модулями для поддержки USB gadget, входит в '''zImage'''
** '''initramfs''' - file system with modules to support USB gadget, is included in '''zImage'''
** '''DTB''' - информация о периферии, необходимая для работы ядра. Дописывается в конец '''zImage''', в конфиге должна быть включена опция ''CONFIG_ARM_APPENDED_DTB''
** '''DTB''' - nformation about the periphery required for the kernel to work. Is appended to the end of the '''zImage''', ''CONFIG_ARM_APPENDED_DTB'' option should be enabled


[https://github.com/contactless/wirenboard/tree/https://github.com/contactless/wirenboard/blob/master/contrib/u-boot/wb5_usbfw.sb Скачать готовый bootstream]  
[https://github.com/contactless/wirenboard/tree/https://github.com/contactless/wirenboard/blob/master/contrib/u-boot/wb5_usbfw.sb Скачать готовый bootstream]  

Версия 19:24, 31 мая 2019

Другие языки:

This manual describes how to build bootstream to boot Linux from USB Mass Storage Gadget. In this case, the contents of the SD-card becomes available via USB as a normal USB flash drive.

The structure of the bootstream:

  • U-Boot SPL - primary boot loader performs initial initialization
  • U-Boot - the boot loader itself, runs Linux
  • The Linux kernel image consists of several parts
    • zImage - kernel
    • initramfs - file system with modules to support USB gadget, is included in zImage
    • DTB - nformation about the periphery required for the kernel to work. Is appended to the end of the zImage, CONFIG_ARM_APPENDED_DTB option should be enabled

Скачать готовый bootstream


Сборка Linux

  • Получить исходники ядра из git,
$ git clone https://github.com/contactless/linux.git
$ cd linux
$ git checkout dev/v4.1.15 
$ unzip initramfs_usbgadget.zip
$ sudo tar xvf initramfs_usbgadget.tar
  • Инициализировать окружение для сборки ядра. При необходимости, изменить в этом файле переменные DT и CROSS_COMPILE
$ . ./scripts/kbuild-env.sh
$ set +e
  • Задать конфиг ядра
$ make mxs_usbgadget_defconfig
  • Собрать ядро и модули, установив их в распакованную initramfs
$ INSTALL_MOD_PATH=./initramfs_usbgadget/ ./scripts/kbuild.sh
  • Собрать ядро с appended DTB и initramfs
$ ./scripts/kbuild-dtb.sh


Сборка U-Boot

  • Получить исходники U-Boot из git. Нужна ветка wb_v2015.07
$ cd ..
$ git clone https://github.com/contactless/u-boot.git
$ cd u-boot
$ git checkout wb_v2015.07
  • Задать конфиг U-Boot
$ make mx28_wirenboard5_usbgadget_defconfig
  • Скопировать ранее собранный образ [[Special:MyLanguage/kernel+initramfs]+DTB] в директорию U-Boot
$ cp ../linux/zImage-imx28-evk ./zImage
  • Собрать совмещенный образ [U-Boot+[[kernel+initramfs]+DTB|kernel+initramfs]+DTB] в директорию U-Boot
$ cp ../linux/zImage-imx28-evk ./zImage
  • Собрать совмещенный образ [U-Boot+[[kernel+initramfs]+DTB]], пригодный для загрузки по USB (bootstream)
$ CROSS_COMPILE='arm-linux-gnueabi-' make -j4 u-boot.sb


Сборка mxsldr

Эта утилита нужна для загрузки полученного образа по USB. Требуется установленная библиотека libusb-1.0 (apt-get install libusb-1.0-0-dev)

$ cd ..
$ git clone http://git.denx.de/mxsldr.git
$ cd mxsldr
$ make


Загрузка собранного образа с помощью mxsldr

$ ./mxsldr ../u-boot/u-boot.sb