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

м
FuzzyBot переименовал страницу Сборка образа для загрузки в режиме USB Mass-Storage/en в Wiren Board 5: Build an image to download in USB Mass-Storage mode/en без оставления перенаправления: Часть переводимой страницы Сборка образа для загрузки в режиме USB Mass-Storage.
(Новая страница: «Build an image for booting in USB Mass-Storage mode»)
 
м (FuzzyBot переименовал страницу Сборка образа для загрузки в режиме USB Mass-Storage/en в Wiren Board 5: Build an image to download in USB Mass-Storage mode/en без оставления перенаправления: Часть переводимой страницы Сборка образа для загрузки в режиме USB Mass-Storage.)
 
(не показано 11 промежуточных версий 1 участника)
Строка 1: Строка 1:
<languages/>
<languages/>
Эта инструкция описывает, как собрать bootstream для загрузки Linux с USB Mass Storage Gadget. При этом содержимое SD-карты становится доступно по USB как обычная флешка.
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 in the config


[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 Download bootstream]  




== Сборка Linux ==
== Building Linux ==


* Получить исходники ядра из git,''
* To get the kernel sources from git,''
  <nowiki>
  <nowiki>
$ git clone https://github.com/contactless/linux.git
$ git clone https://github.com/contactless/linux.git
$ cd linux
$ cd linux
$ git checkout dev/v4.1.15 </nowiki>
$ git checkout dev/v4.1.15 </nowiki>
* Скачать initramfs из [https://github.com/contactless/wirenboard/tree/master/initramfs_usbgadget репозитория] и распаковать
* Download initramfs from [https://github.com/contactless/wirenboard/tree/master/initramfs_usbgadget repository] and unzip
  <nowiki>
  <nowiki>
$ unzip initramfs_usbgadget.zip
$ unzip initramfs_usbgadget.zip
$ sudo tar xvf initramfs_usbgadget.tar</nowiki>
$ sudo tar xvf initramfs_usbgadget.tar</nowiki>
* Инициализировать окружение для сборки ядра. При необходимости, изменить в этом файле переменные ''DT'' и ''CROSS_COMPILE''
* Initialize the environment to build the kernel. If necessary, change the ''DT'' and ''CROSS_COMPILE'' variables in this file
  <nowiki>
  <nowiki>
$ . ./scripts/kbuild-env.sh
$ . ./scripts/kbuild-env.sh
$ set +e</nowiki>
$ set +e</nowiki>
* Задать конфиг ядра
* Set the config of the kernel
  <nowiki>$ make mxs_usbgadget_defconfig</nowiki>
  <nowiki>$ make mxs_usbgadget_defconfig</nowiki>
* Собрать ядро и модули, установив их в распакованную initramfs
* Build the kernel and modules by installing them in unpacked initramfs
  <nowiki>$ INSTALL_MOD_PATH=./initramfs_usbgadget/ ./scripts/kbuild.sh</nowiki>
  <nowiki>$ INSTALL_MOD_PATH=./initramfs_usbgadget/ ./scripts/kbuild.sh</nowiki>
* Собрать ядро с appended DTB и initramfs
* Build kernel with appended DTB and initramfs
  <nowiki>$ ./scripts/kbuild-dtb.sh</nowiki>
  <nowiki>$ ./scripts/kbuild-dtb.sh</nowiki>




== Сборка U-Boot ==
== Building U-Boot ==


* Получить исходники U-Boot из git. Нужна ветка ''wb_v2015.07''
* Get u-Boot sources from git. You need a ''wb_v2015.07'' branch
  <nowiki>
  <nowiki>
$ cd ..
$ cd ..
Строка 44: Строка 44:
$ cd u-boot
$ cd u-boot
$ git checkout wb_v2015.07</nowiki>
$ git checkout wb_v2015.07</nowiki>
* Задать конфиг U-Boot
* Set u-Boot config
  <nowiki>$ make mx28_wirenboard5_usbgadget_defconfig</nowiki>
  <nowiki>$ make mx28_wirenboard5_usbgadget_defconfig</nowiki>
* Скопировать ранее собранный образ '''[[Special:MyLanguage/kernel+initramfs]+DTB]''' в директорию U-Boot
* Copy a previously collected image of '''[[kernel+initramfs]+DTB]''' to the U-Boot folder
  $ cp ../linux/zImage-imx28-evk ./zImage
  $ cp ../linux/zImage-imx28-evk ./zImage
* Собрать совмещенный образ '''[U-Boot+[[kernel+initramfs]+DTB|kernel+initramfs]+DTB]''' в директорию U-Boot
* Build a combined image '''[U-Boot+[[kernel+initramfs]+DTB|kernel+initramfs]+DTB]''' into U-Boot folder
  $ cp ../linux/zImage-imx28-evk ./zImage
  $ cp ../linux/zImage-imx28-evk ./zImage
* Собрать совмещенный образ '''[U-Boot+[[kernel+initramfs]+DTB]]''', пригодный для загрузки по USB (bootstream)
* Build a combined '''[U-Boot+[[kernel+initramfs]+DTB]]''' image suitable for booting to USB (bootstream)
  <nowiki>$ CROSS_COMPILE='arm-linux-gnueabi-' make -j4 u-boot.sb</nowiki>
  <nowiki>$ CROSS_COMPILE='arm-linux-gnueabi-' make -j4 u-boot.sb</nowiki>




== Сборка mxsldr ==
== Assembling mxsldr ==


Эта утилита нужна для загрузки полученного образа по USB.
This utility is needed to download the resulting image via USB. Requires ''libusb-1.0'' library installed (<nowiki>apt-get install libusb-1.0-0-dev</nowiki>)
Требуется установленная библиотека ''libusb-1.0'' (<nowiki>apt-get install libusb-1.0-0-dev</nowiki>)


  <nowiki>
  <nowiki>
Строка 66: Строка 65:




== Загрузка собранного образа с помощью mxsldr ==
== Loading a built image using mxsldr ==


  <nowiki>$ ./mxsldr ../u-boot/u-boot.sb</nowiki>
  <nowiki>$ ./mxsldr ../u-boot/u-boot.sb</nowiki>
wb_editors
14 355

правок