Создание microSD-карты с образом/en: различия между версиями

Материал из Wiren Board
Метки: правка с мобильного устройства правка из мобильной версии
 
(не показаны 43 промежуточные версии 2 участников)
Строка 18: Строка 18:
=== For Windows ===
=== For Windows ===


* скачайте программу для записи образов(например, [http://netcologne.dl.sourceforge.net/project/win32diskimager/Archive/Win32DiskImager-0.9.5-install.exe Win32DiskImager])
* download a program to record images(for example, [http://netcologne.dl.sourceforge.net/project/win32diskimager/Archive/Win32DiskImager-0.9.5-install.exe Win32DiskImager])
* вставьте microSD-карту в ридер
* insert the microSD card into the reader
* узнайте букву, под которой она появилась (например "F:")  
* find out the letter under which it appeared (for example "F:")
* проигнорируйте сообщения о необходимости отформатировать диск перед использованием, если такое появится
* ignore messages about the disk format before use, if such appear
* убедитесь, что другие программы не используют флеш-карту
* make sure no other programs are using this card
* в Win32DiskImager выберите распакованный образ карты, выберите букву диска и нажмите кнопку ''Write''
* in Win32DiskImager, select the unpacked map image, select the drive letter, and then click ''Write''




=== Для Linux ===
=== For Linux ===


*вставьте microSD-карту в ридер
*insert the microSD card into the reader
*узнайте название устройства, соответствующего карте. Обычно это /dev/mmcblk0 или /dev/sdX (где X - буква). В этом может помочь команда <pre>dmesg | tail</pre>
*find out the name of the device corresponding to the map. This is usually /dev/mmcblk0 or /dev/sdX (where X is the letter). This command can help  <pre>dmesg | tail</pre>
*:<b> Не перепутайте название устройства! Неправильно указав название устройства, вы навсегда потеряете все данные на вашем компьютере!</b>
*:<b> Do not confuse the device name! Incorrectly specifying the name of the device, you will lose all data on your computer forever!</b>
*отмонтируйте разделы карты, которые Linux примонтировал автоматически:
*unmount the map partitions that Linux mounted automatically:
**если устройство называется /dev/mmcblk0, то разделы называются /dev/mmcblk0p1, /dev/mmcblk0p2 и т.д.
**if the device is called /dev/mmcblk0, the partitions are called /dev/mmcblk0p1, /dev/mmcblk0p2, etc.
**если устройство называется /dev/sdb, то разделы называются /dev/sdb1, /dev/sdb2 и т.д.
**if the device is called /dev/sdb, the partitions are /dev/sdb1, /dev/sdb2, etc.
*:Пример команды:<pre>umount /dev/mmcblk0p1</pre>
*An example of a command:<pre>umount /dev/mmcblk0p1</pre>
*запишите образ на карту:<pre>sudo dd if=sdcard.dd of=/dev/mmcblk0 bs=4M</pre>
*flash the card:<pre>sudo dd if=sdcard.dd of=/dev/mmcblk0 bs=4M</pre>
, где "sdcard.dd" - путь к ранее скачанному распакованному файлу с образом.
, where "sdcard.dd" is path to the previously downloaded unzipped image file.


Пример процесса целиком:
An example of the process:
<pre>
<pre>
wget https://github.com/contactless/wirenboard/releases/download/0.6-20140614/sdcard_20140614.img.zip
wget https://github.com/contactless/wirenboard/releases/download/0.6-20140614/sdcard_20140614.img.zip
Строка 49: Строка 49:




==Создание образа по частям==
==Creating an image in parts==


'''Внимание!''' Это сложный вариант самостоятельной подготовки образа карточки. Лучше воспользуйтесь вариантом, описанным выше.
'''Attention!''' This is a complex version of self-preparation of the image of the card. It is better to use the option described above.


'''Внимание!''' На 6 ноября 2015 инструкция ниже ещё и безнадёжно устарела.
'''Attention!''' On November 6, 2015 instruction below is also hopelessly outdated.


===Сборка вместе===
===Build together===


Согласно [http://eewiki.net/display/linuxonarm/iMX233-OLinuXino]
According to [http://eewiki.net/display/linuxonarm/iMX233-OLinuXino]


* разбить флешку на два раздела
*split the flash drive into two sections
* записать u-boot на первый раздел
*boot u-boot to the first partition
* создать фс на втором разделе
*create a filesystem on the second partition
* скопировать rootfs на второй раздел
*copy the root filesystem to the second partition


Сначала надо выяснить имя устройства с флеш-картой. Воспользуйтесь поиском. Можно, к примеру, попробовать запустить gparted и посмотреть в нём.
First you need to find out the name of the device with the flash card. Use the search. You can, for example, try to run the program GParted and see it. Dev /dev/sdb, and may look like /dev/mmcblk0
Устройство может быть /dev/sdb, а может выглядеть и как /dev/mmcblk0


Найдя устройство создаем переменную чтобы облегчить себе использование нижеследующих комманд
When the device is found, we create a variable to facilitate the use of the following commands
<pre>
<pre>
MYDISK="/dev/sdb"
MYDISK="/dev/sdb"
</pre>
</pre>
Между кавычками пишем название своего устройства с флеш-картой.
Between the quotes write the name of your device with a flash card.




===Таблица разделов===
===Partition table===


Перед запуском убедитесь, что разделы на карточке не примонтированы.
Before starting, make sure that the partitions on the card are not mounted.


Теперь с помощью скрипта создадим разделы на карте.
Now we will create card partitions using the script. [2]
[https://github.com/contactless/wirenboard/blob/master/image/create_partitions.sh]
[https://github.com/contactless/wirenboard/blob/master/image/create_partitions.sh]


Скачиваем скрипт:
Download script:
<pre>
<pre>
wget [https://raw.github.com/contactless/wirenboard/master/image/create_partitions.sh]
wget [https://raw.github.com/contactless/wirenboard/master/image/create_partitions.sh]
</pre>
</pre>


Запускаем скрипт и указываем ему имя устройства с флеш-картой:
Run the script and specify the name of the device with the flash card:
<pre>
<pre>
sudo bash create_partitions.sh $MYDISK
sudo bash create_partitions.sh $MYDISK
Строка 92: Строка 91:




===Загрузчик===
===Bootloader===


См. [[Special:MyLanguage/Сборка U-Boot|Сборка U-Boot]].
See [[Special:MyLanguage/Сборка U-Boot/en|Building U-Boot]].


Готовый образ u-boot для записи в раздел: [https://github.com/contactless/wirenboard/tree/master/contrib/u-boot u-boot]
An image loader to write to the partition: loader[https://github.com/contactless/wirenboard/tree/master/contrib/u-boot u-boot]


Скачиваем образ
Download image
<pre>
<pre>
wget "https://github.com/contactless/wirenboard/blob/master/contrib/u-boot/u-boot.sb.cl25?raw=true" -O u-boot.sb
wget "https://github.com/contactless/wirenboard/blob/master/contrib/u-boot/u-boot.sb.cl25?raw=true" -O u-boot.sb
</pre>
</pre>


Теперь выясняем имена разделов на карте. Скрипт выше отработал и разделил карту на разделы, нам надо узнать название первого из этих разделов.  
Find out the names of the partitions. The script  divided the card into partitions, we need to know the name of the first of them. If the device name for the microSD card was <b>/dev/sdX</b>, the first partition will have the device name <b>/dev/sdX1</b>. If the device was named <b>/dev/mmcblkX</b> , the first section is partition <b>/dev/mmcblkXp1</b> (note the <b>p</b> before the partition number).
Если название устройства microSD-карты имело вид <b>/dev/sdX</b>, то первый раздел будет иметь название <b>/dev/sdX1</b>.  
Если устройство называлось <b>/dev/mmcblkX</b> , то первый раздел - <b>/dev/mmcblkXp1</b> (обратите внимание на <b>p</b> перед номером раздела).


Найдя имя первого раздела укажите его тут:
Finding the name of the first section, enter it here:
<pre>
<pre>
MYDISK1="/dev/sdb1"
MYDISK1="/dev/sdb1"
</pre>
</pre>


Теперь заливаем образ раздела на карту
Now download the partition image to the card
<pre>
<pre>
sudo dd if=u-boot.sb of=$MYDISK1 bs=512 seek=4
sudo dd if=u-boot.sb of=$MYDISK1 bs=512 seek=4
Строка 118: Строка 115:




===Создание фс===
===Creating FS===


Находим название второго раздела на флешке и прописываем его в переменную
Find the name of the second section on the flash drive and write it in a variable
<pre>
<pre>
MYDISK2="/dev/sdb2"
MYDISK2="/dev/sdb2"
</pre>
</pre>


<b>rootfs</b> станет названием этого раздела.
<b>rootfs</b> will become the name of this partition.


<pre>
<pre>
Строка 132: Строка 129:




===Копирование образа на раздел===
===Copy image to partition===


Готовый образ (включая ядро, dtbs, модули и прошивки): [https://github.com/contactless/wirenboard/releases releases]
Released image (including kernel, dtbs, modules and firmware): [https://github.com/contactless/wirenboard/releases releases]




См. также [[Special:MyLanguage/Сборка образа|Сборка образа]]
See also [[Special:MyLanguage/Сборка образа/en|Image Building]]


<pre>
<pre>
Строка 143: Строка 140:
</pre>
</pre>


Теперь надо примонтировать созданную файловую систему созданную нами ранее. ''Как это сделать в терминале?''
Now we need to mount the file system we created earlier.'' How to do it in the terminal?''


По-умолчанию в Ubuntu она монтируется в <b>/media/$USER/rootfs/</b>. Найдите куда система смонтировалась на вашем компьютере.
By default in Ubuntu it is mounted in <b>/media/$USER/rootfs/</b>. Find where the system is mounted on your computer.


Распаковываем образ на раздел:
Unpack the image into a section:
<pre>
<pre>
  sudo tar xfpz rootfs.tar.gz -C /media/$USER/rootfs/
  sudo tar xfpz rootfs.tar.gz -C /media/$USER/rootfs/
Строка 153: Строка 150:




Отмонтируем файловую систему:
Unmount the file system:
<pre>
<pre>
umount /media/user/rootfs
umount /media/user/rootfs
Строка 159: Строка 156:




==Пример==
==Example==


ОС Ubuntu, свежая SD-карта подключенная к встроенному считывателю и определяющаяся как /dev/mmcblk0.
Ubuntu OS, SD card is connected to the built-in reader and defined as /dev/mmcblk0.  
[https://github.com/contactless/wirenboard/ Репозиторий] скачан, мы находимся в его корне.
[https://github.com/contactless/wirenboard/ The repository] is downloaded, we are in its root.


Образ rootfs.tar.gz находится внутри папки rootfs.
Image file rootfs.tar.gz is located inside the rootfs system folder.


<pre>
<pre>
Строка 185: Строка 182:




См. также [[Special:MyLanguage/Стандартный образ ФС|Стандартный образ ФС]].
See [[Special:MyLanguage/Стандартный образ ФС/en|FS standart image]].

Текущая версия на 12:49, 20 сентября 2023

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

Recording the finished image on the card

Selecting the desired image

  • Go to the finished images page in Github and select the desired image:
    • for Wiren Board 4 - name ends as _wb4
    • for Wiren Board Smart Home 3.5 - ends as _wb3
      • if the serial number of your Wiren Board Smart Home 3.5 is more than 300 - use the image with newwifi in the title
    • for WB rev. 2.8 - ends as _wb28
    The image will have an .dd extension, either .DD.gz, or img.zipper .dd, or .dd.gz, or img.zip
  • Unpack the archive
  • Follow the instructions for your operating system


For Windows

  • download a program to record images(for example, Win32DiskImager)
  • insert the microSD card into the reader
  • find out the letter under which it appeared (for example "F:")
  • ignore messages about the disk format before use, if such appear
  • make sure no other programs are using this card
  • in Win32DiskImager, select the unpacked map image, select the drive letter, and then click Write


For Linux

  • insert the microSD card into the reader
  • find out the name of the device corresponding to the map. This is usually /dev/mmcblk0 or /dev/sdX (where X is the letter). This command can help
    dmesg | tail
    Do not confuse the device name! Incorrectly specifying the name of the device, you will lose all data on your computer forever!
  • unmount the map partitions that Linux mounted automatically:
    • if the device is called /dev/mmcblk0, the partitions are called /dev/mmcblk0p1, /dev/mmcblk0p2, etc.
    • if the device is called /dev/sdb, the partitions are /dev/sdb1, /dev/sdb2, etc.
  • An example of a command:
    umount /dev/mmcblk0p1
  • flash the card:
    sudo dd if=sdcard.dd of=/dev/mmcblk0 bs=4M

, where "sdcard.dd" is path to the previously downloaded unzipped image file.

An example of the process:

wget https://github.com/contactless/wirenboard/releases/download/0.6-20140614/sdcard_20140614.img.zip
unzip sdcard_20140614.img.zip
umount /dev/mmcblk0p2
umount /dev/mmcblk0p1
sudo dd if=sdcard_20140614.img of=/dev/mmcblk0 bs=4M conv=fdatasync
sync


Creating an image in parts

Attention! This is a complex version of self-preparation of the image of the card. It is better to use the option described above.

Attention! On November 6, 2015 instruction below is also hopelessly outdated.

Build together

According to [1]

  • split the flash drive into two sections
  • boot u-boot to the first partition
  • create a filesystem on the second partition
  • copy the root filesystem to the second partition

First you need to find out the name of the device with the flash card. Use the search. You can, for example, try to run the program GParted and see it. Dev /dev/sdb, and may look like /dev/mmcblk0

When the device is found, we create a variable to facilitate the use of the following commands

MYDISK="/dev/sdb"

Between the quotes write the name of your device with a flash card.


Partition table

Before starting, make sure that the partitions on the card are not mounted.

Now we will create card partitions using the script. [2] [2]

Download script:

wget [https://raw.github.com/contactless/wirenboard/master/image/create_partitions.sh]

Run the script and specify the name of the device with the flash card:

sudo bash create_partitions.sh $MYDISK


Bootloader

See Building U-Boot.

An image loader to write to the partition: loaderu-boot

Download image

wget "https://github.com/contactless/wirenboard/blob/master/contrib/u-boot/u-boot.sb.cl25?raw=true" -O u-boot.sb

Find out the names of the partitions. The script divided the card into partitions, we need to know the name of the first of them. If the device name for the microSD card was /dev/sdX, the first partition will have the device name /dev/sdX1. If the device was named /dev/mmcblkX , the first section is partition /dev/mmcblkXp1 (note the p before the partition number).

Finding the name of the first section, enter it here:

MYDISK1="/dev/sdb1"

Now download the partition image to the card

sudo dd if=u-boot.sb of=$MYDISK1 bs=512 seek=4


Creating FS

Find the name of the second section on the flash drive and write it in a variable

MYDISK2="/dev/sdb2"

rootfs will become the name of this partition.

sudo mkfs.ext4 $MYDISK2 -L rootfs


Copy image to partition

Released image (including kernel, dtbs, modules and firmware): releases


See also Image Building

wget https://github.com/contactless/wirenboard/releases/download/0.1/rootfs.tar.gz

Now we need to mount the file system we created earlier. How to do it in the terminal?

By default in Ubuntu it is mounted in /media/$USER/rootfs/. Find where the system is mounted on your computer.

Unpack the image into a section:

 sudo tar xfpz rootfs.tar.gz -C /media/$USER/rootfs/


Unmount the file system:

umount /media/user/rootfs


Example

Ubuntu OS, SD card is connected to the built-in reader and defined as /dev/mmcblk0. The repository is downloaded, we are in its root.

Image file rootfs.tar.gz is located inside the rootfs system folder.

cd image
sudo umount /dev/mmcblk0p1
sudo ./create_partitions.sh  /dev/mmcblk0
sudo dd if=../contrib/u-boot/u-boot.sb  of=/dev/mmcblk0p1 bs=512 seek=4
sudo ./create_fs.sh /dev/mmcblk0p2


# Ubuntu automount:
udisksctl mount -b /dev/mmcblk0p2

#extract rootfs
sudo tar xfpz ../rootfs/rootfs.tar.gz -C /media/$USER/rootfs/

umount /dev/mmcblk0p2


See FS standart image.