Difference between revisions of "How to make your own SD-bootable ROM"

From FriendlyARM WiKi
Jump to: navigation, search
(updated by API)
Line 13: Line 13:
 
{{ROM-Maker-lite_Introduce |h3}}
 
{{ROM-Maker-lite_Introduce |h3}}
  
* <b>Make an SD card bootable image based on Uboot-2017 + Linux-4.14 for H3, e.g. FriendlyCore/Debian/OpenWrt...</b>
+
===制作sd ROM===
FriendlyElec's BSP based on Uboot-2017 + Linux-4.14 applies to all FriendlyElec's H3 boards. Therefore the steps to make an image for all H3 boards are the same.
+
====Linux-4.14====
Here are the steps to make an SD card image of FriendlyCore. The steps to make an SD card image of Debian or OpenWrt are similar.<br><br>
+
事实上,对于Linux-4.14 BSP,相同rootfs的所有H3 板子的sd ROM文件都是同一个。所以对于这个版本的BSP,所有H3 的板子的sd ROM 的制作命令是一样的。<br>
Suppose you already have an SD card with a FriendlyCore system. The SD card has applications and configuration files in the "rootfs" directory. Insert this card to a host PC and mount its rootfs directory(in our test the directory was "rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/"). Run the following command to generate an image file.:
+
这里以制作FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM文件的制作方法是一样的。<br>
 +
 
 +
* <b>准备FriendlyCore的rootfs目录</b>
 +
有2种方式可以准备FriendlyCore的rootfs目录:<br>
 +
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区; <br>
 +
2) 解压网盘里/rootfs/rootfs_friendlycore_4.14_YYYYMMDD.tgz<br>
 +
 
 +
<br>
 +
* <b>假设rootfs目录的路径为./rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/,执行下面的命令可生成sd ROM:</b>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 
$ ./mkimage.sh -c 1 -m partmap/h3_linux-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/friendlycore/rootfs/"
 
$ ./mkimage.sh -c 1 -m partmap/h3_linux-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/friendlycore/rootfs/"
 
</syntaxhighlight>
 
</syntaxhighlight>
You can replace the files under the "misc/uboot-2017_h3" and "part1/boot_linux-4.14_h3" directories with your wanted files too. FriendlyElec will release the latest files when necessary. You can command "tree" to check all the available files:
+
- 对于所有使用Linux-4.14 BSP的H3板子,使用的都是同一个partmap文件: partmap/h3_linux-4.14/partmap.txt。<br>
 +
- 如果有需要,你可以将misc/uboot-2017_h3、part1/boot_linux-4.14_h3目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree misc/uboot-2017_h3/ part1/boot_linux-4.14_h3/
 
$ tree misc/uboot-2017_h3/ part1/boot_linux-4.14_h3/
Line 38: Line 48:
 
└── zImage
 
└── zImage
 
</syntaxhighlight>
 
</syntaxhighlight>
For all FriendlyElec's H3 based boards that support Linux-4.14 BSP they use the same partmap file "partmap/h3_linux-4.14/partmap.txt".<br>
+
 
After mkimage.sh is executed successfully an "out/SD-bootable-1" directory and the following files will be generated:
+
<br>
 +
mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
Line 51: Line 62:
 
│      └── u-boot-sunxi-with-spl.bin
 
│      └── u-boot-sunxi-with-spl.bin
 
├── SD-bootable-1.img
 
├── SD-bootable-1.img
 
 
</syntaxhighlight>
 
</syntaxhighlight>
The "part1/boot_linux-4.14_h3/" directory will be converted to a boot.img. The "part2/h3/4.14/friendlycore/rootfs/" will be converted to a rootfs.img. The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-[h3]_sd_friendlycore-xenial_4.14_armhf_YYYYMMDD.img.zip image file is an SD card ROM image. You can use the win32diskimager utility or the "dd" command to flash the SD-bootable-1.img to an SD card.
+
- part1/boot_linux-4.14_h3/目录被制作成了boot.img;<br>
 +
- part2/h3/4.14/friendlycore/rootfs/目录被制作成了rootfs.img;<br>
 +
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h3]_sd_friendlycore-xenial_4.14_armhf_YYYYMMDD.img;
 +
 
 
<!--
 
<!--
另外,你可以通过如下命令快速地将系统烧写到SD卡中以进行测试:
+
下面的命令可以快速地将系统烧写到SD卡中:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-1/your_company/partmap.txt
 
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-1/your_company/partmap.txt
Line 61: Line 74:
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
-->
 
-->
 +
 +
 +
====Linux-3.4====
 +
- 与Linux-4.14 sd ROM不同,相同rootfs的不同的H3板子的Linux-3.4 sd ROM是不同的。<br>
 +
- 这里以制作NanoPi M1的Linux-3.4 FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM的制作方法是一样的。<br><br>
 +
 +
* <b>准备FriendlyCore的rootfs目录</b>
 +
有1种方式可以准备FriendlyCore的rootfs目录:<br>
 +
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区; <br>
  
 
<br>
 
<br>
* <b>Make an SD card bootable image based on Uboot-2011 + Linux-3.4 for H3, e.g. FriendlyCore/Debian/OpenWrt...</b>
+
* <b>假设rootfs目录的路径为./rom-maker-lite/part2/m1/3.4/friendlycore/rootfs/,执行下面的命令可以生成sd ROM:</b>
The basic steps to make an image for all FriendlyElec's H3 based boards are very similar. We take the NanoPi M1 as an example to show how to make an SD card FriendlyCore image. The steps apply to Debian and OpenWrt too.<br><br>
+
Run the following command:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1/;part1/boot_linux-3.4_m1/;part2/m1/3.4/friendlycore/rootfs"
 
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1/;part1/boot_linux-3.4_m1/;part2/m1/3.4/friendlycore/rootfs"
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-m1_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img.zip image file is an SD card ROM image.You can replace the corresponding files with your wanted files.For all FriendlyElec's H3 based boards that support Linux-3.4 BSP they use the same partmap file "partmap/h3_linux-3.4/partmap.txt".<br>
+
- 对于所有使用Linux-3.4 BSP的H3板子,使用的都是同一个partmap文件: partmap/h3_linux-3.4/partmap.txt。<br>
To make an SD card image for the NanoPi M1 Plus you can run the following command:
+
- 如果有需要,你可以将misc/uboot-2011_m1、part1/boot_linux-3.4_m1目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1-plus/;part1/boot_linux-3.4_m1-plus/;part2/m1-plus/3.4/friendlycore/rootfs"
+
$ tree misc/uboot-2011_m1 part1/boot_linux-3.4_m1
 +
misc/uboot-2011_m1
 +
├── boot0_sdcard.fex
 +
└── u-boot.fex
 +
part1/boot_linux-3.4_m1
 +
├── boot.img
 +
└── bootlogo.bmp
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-m1-plus_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img.zip image file is an SD card ROM image.This applies to the NanoPi NEO and the NanoPi NEO Air.
 
  
 
<br>
 
<br>
* <b>Make an eflasher image based on Uboot-2017 + Linux-4.14 for H3 based boards</b>
+
mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:
To make an eflasher ROM image you need to have an SD card image ready.We take a FriendlyCore system based on Uboot-2017 + Linux-4.14 as an example:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
Line 84: Line 109:
 
├── SD-bootable-1
 
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 +
│      ├── boot0_sdcard.fex
 
│      ├── boot.img
 
│      ├── boot.img
 
│      ├── info.conf
 
│      ├── info.conf
 
│      ├── partmap.txt
 
│      ├── partmap.txt
 
│      ├── rootfs.img
 
│      ├── rootfs.img
│      └── u-boot-sunxi-with-spl.bin
+
│      └── u-boot.fex
 +
├── SD-bootable-1.img
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
- part1/boot_linux-3.4_m1目录被制作成了boot.img;<br>
 +
- part2/h3/3.14/friendlycore/rootfs/目录被制作成了rootfs.img;<br>
 +
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-m1_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img;
  
If you have an SD card with an eflasher image insert this card to a host PC, mount its rootfs directory(in our test the directory was "part2/h3/4.14/eflasher/rootfs") and run the following command to generate an eflasher ROM image:
+
<br>
 +
* <b>以此类推,NanoPi M1 Plus 的sd ROM 制作命令如下:</b>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh -c 2 -m partmap/h3_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/eflasher/rootfs;out/SD-bootable-1/"
+
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1-plus/;part1/boot_linux-3.4_m1-plus/;part2/m1-plus/3.4/friendlycore/rootfs"
 
</syntaxhighlight>
 
</syntaxhighlight>
After mkimage.sh is executed an "out/SD-bootable-2" directory and the following files will be generated:
+
生成的SD-bootable-1.img等效于FriendlyElec 发布的nanopi-m1-plus_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img。NanoPi NEO / NanoPi NEO Air也是同样的道理,这样不再赘述。
 +
 
 +
 
 +
===制作eflasher ROM===
 +
制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件。<br>
 +
例如想制作用于烧写“Linux-4.14的FriendlyCore”的eflasher ROM,先要有"Linux-4.14的FriendlyCore"的sd ROM原材料,即:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
Line 106: Line 142:
 
│      ├── rootfs.img
 
│      ├── rootfs.img
 
│      └── u-boot-sunxi-with-spl.bin
 
│      └── u-boot-sunxi-with-spl.bin
├── SD-bootable-1.img
+
</syntaxhighlight>
 +
 
 +
<br>
 +
* <b>准备eflasher的rootfs目录</b>
 +
有2种方式可以准备eflasher的rootfs目录:<br>
 +
1) 制作一张带eflasher 系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区; <br>
 +
2) 解压网盘里/rootfs/rootfs_eflasher_4.14_YYYYMMDD.tgz<br>
 +
 
 +
<br>
 +
* <b>假设eflasher rootfs目录的路径为./rom-maker-lite/part2/h3/4.14/eflasher/rootfs/,执行下面的命令可生成eflasher ROM:</b>
 +
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 +
$ ./mkimage.sh -c 2 -m partmap/h3_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/eflasher/rootfs;out/SD-bootable-1/"
 +
</syntaxhighlight>
 +
mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:
 +
<syntaxhighlight lang="bash">
 +
$ tree out/
 +
out/SD-bootable-2
 
├── SD-bootable-2
 
├── SD-bootable-2
 
│   └── your_company
 
│   └── your_company
Line 117: Line 170:
 
└── SD-bootable-2.img
 
└── SD-bootable-2.img
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-2.img will be an eflasher image. For example FriendlyElec's nanopi-[h3]_eflasher_friendlycore-xenial_4.14_armhf_YYYYMMDD.img.zip image file is an SD card ROM image.The image contained in the "out/SD-bootable-1/" directory will be the image to be flashed to eMMC. You can use the win32diskimager utility or the "dd" command to flash the SD-bootable-2.img image to an SD card.
+
- part1/boot_linux-4.14_h3/目录被制作成了boot.img;<br>
<!--
+
- part2/h3/4.14/eflasher/rootfs/目录被制作成了rootfs.img;<br>
另外,通过如下命令快速地将eflasher系统烧写到SD卡中以进行测试:
+
- out/SD-bootable-1/目录被制作成了friendlyarm.img;<br>
 +
- SD-bootable-2.img则为最终的eflasher ROM文件,它是由SD-bootable-2目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h3]_eflasher_friendlycore-xenial_4.14_armhf_YYYYMMDD.img;<br>
 +
事实上,FriendlyElec发布的所有H3板子的nanopi-[h3]_eflasher_friendlycore-xenial_4.14_armhf_YYYYMMDD.img都是同一个文件。
 +
 
 +
 
 +
===仅制作boot.img/rootfs.img===
 +
{{ROM-Maker-lite_mk-fsimg |h3}}
 +
 
 +
====Linux-4.14====
 +
为Linux-4.14 sd ROM生成boot.img和rootfs.img的命令如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-2/your_company/partmap.txt
+
$ cd rom-maker-lite
 +
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-4.14_h3/ 40 boot
 +
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h3/4.14/friendlycore/rootfs/ 2048 rootfs
 
</syntaxhighlight>
 
</syntaxhighlight>
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
+
上述命令适用于所有H3的板子。
-->
+
  
==Make Image Files for H5==
+
====Linux-3.4====
 +
为NanoPi M1 Linux-3.14 sd ROM生成boot.img和rootfs.img的命令如下:
 +
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 +
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-3.4_m1/ 40 boot
 +
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h3/3.4/friendlycore/rootfs/ 2048 rootfs
 +
</syntaxhighlight>
 +
上述命令仅适用于NanoPi M1,其他H3的板子的命令也是类似的.
 +
 
 +
 
 +
==制作H5 平台的系统映像==
 
{{ROM-Maker-lite_Introduce |h5}}
 
{{ROM-Maker-lite_Introduce |h5}}
* <b>Make an SD card bootable image based on Uboot-2017 + Linux-4.14 for H5, e.g. FriendlyCore/Debian/OpenWrt...</b>
+
 
The basic steps to make an image for all FriendlyElec's H5 based boards are very similar. We show how to make an SD card FriendlyCore image. The steps apply to Debian and OpenWrt too.<br><br>
+
===制作sd ROM===
Suppose you already have an SD card with a FriendlyCore system. The SD card has applications and configuration files in the "rootfs" directory. Insert this card to a host PC and mount its rootfs directory(in our test the directory was "/part2/h5/4.14/friendlycore/rootfs/"). Run the following command to generate an image file:
+
====Linux-4.14====
 +
事实上,对于Linux-4.14 BSP,相同rootfs的所有H5 板子的sd ROM文件都是同一个,所以对于这个版本的BSP,所有H5 的板子的sd ROM 的制作命令是一样的。<br>
 +
这里以制作FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM文件的制作方法是一样的。<br>
 +
 
 +
* <b>准备FriendlyCore的rootfs目录</b>
 +
有2种方式可以准备FriendlyCore的rootfs目录:<br>
 +
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区; <br>
 +
2) 解压网盘里的/rootfs/rootfs_friendlycore_4.14_YYYYMMDD.tgz<br>
 +
 
 +
<br>
 +
* <b>假设rootfs目录的路径为./rom-maker-lite/part2/h5/4.14/friendlycore/rootfs/,执行下面的命令可生成sd ROM:</b>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 
$ ./mkimage.sh -c 1 -m partmap/h5_linux-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/friendlycore/rootfs/"
 
$ ./mkimage.sh -c 1 -m partmap/h5_linux-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/friendlycore/rootfs/"
 
</syntaxhighlight>
 
</syntaxhighlight>
You can replace the files under the "misc/uboot-2017_h5" and "part1/boot_linux-4.14_h5" directories with your wanted files too. FriendlyElec will release the latest files when necessary. You can command "tree" to check all the available files:
+
- 对于所有使用Linux-4.14 BSP的H5板子,使用的都是同一个partmap文件: partmap/h5_linux-4.14/partmap.txt。<br>
 +
- 如果有需要,你可以将misc/uboot-2017_h5、part1/boot_linux-4.14_h5目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree misc/uboot-2017_h5/ part1/boot_linux-4.14_h5/
 
$ tree misc/uboot-2017_h5/ part1/boot_linux-4.14_h5/
Line 153: Line 238:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For all FriendlyElec's H5 based boards that support Linux-4.14 BSP they use the same partmap file "partmap/h5_linux-4.14/partmap.txt".<br>
+
<br>
After mkimage.sh is executed successfully an "out/SD-bootable-1" directory and the following files will be generated:
+
mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
Line 167: Line 252:
 
│      └── u-boot.itb
 
│      └── u-boot.itb
 
├── SD-bootable-1.img
 
├── SD-bootable-1.img
 
 
</syntaxhighlight>
 
</syntaxhighlight>
The "part1/boot_linux-4.14_h5/" directory will be converted to a boot.img. The "part2/h5/4.14/friendlycore/rootfs/" will be converted to a rootfs.img. The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-[h5]_sd_friendlycore-xenial_4.14_arm64_YYYYMMDD.img.zip image file is an SD card ROM image. You can use the win32diskimager utility or the "dd" command to flash the SD-bootable-1.img to an SD card.
+
- part1/boot_linux-4.14_h5/目录被制作成了boot.img;<br>
<!--
+
- part2/h5/4.14/friendlycore/rootfs/目录被制作成了rootfs.img;<br>
另外,你可以通过如下命令快速地将系统烧写到SD卡中以进行测试:
+
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h5]_sd_friendlycore-xenial_4.14_arm64_YYYYMMDD.img;
<syntaxhighlight lang="bash">
+
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-1/your_company/partmap.txt
+
</syntaxhighlight>
+
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
+
-->
+
  
<br>
 
* <b>Make an SD card bootable image based on Uboot-2014 + Linux-3.10 for H5, e.g. FriendlyCore/Debian/OpenWrt...</b>
 
The basic steps to make an image for all FriendlyElec's H5 based boards are very similar. We take the NanoPi NEO2 as an example to show how to make an SD card FriendlyCore image. The steps apply to Debian and OpenWrt too.<br><br>
 
Run the following command:
 
<syntaxhighlight lang="bash">
 
$ ./mkimage.sh -c 1 -m partmap/h5_linux-3.10/partmap.txt -d "misc/uboot-2014_neo2/;part1/boot_linux-3.10_neo2/;part2/neo2/3.10/friendlycore/rootfs"
 
</syntaxhighlight>
 
The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-neo2_sd_friendlycore-xenial_3.10_arm64_YYYYMMDD.img.zip image file is an SD card ROM image.You can replace the corresponding files with your wanted files.For all FriendlyElec's H5 based boards that support Linux-3.10 BSP they use the same partmap file "partmap/h5_linux-3.10/partmap.txt".<br>
 
To make an SD card image for the NanoPi NEO Plus2 you can run the following command:
 
<syntaxhighlight lang="bash">
 
$ ./mkimage.sh -c 1 -m partmap/h5_linux-3.10/partmap.txt -d "misc/uboot-2014_neo-plus2/;part1/boot_linux-3.10_neo-plus2/;part2/neo-plus2/3.10/friendlycore/rootfs"
 
</syntaxhighlight>
 
The SD-bootable-1.img will be an SD card ROM image. For example FriendlyElec's nanopi-neo-plus2_sd_friendlycore-xenial_3.10_arm64_YYYYMMDD.img.zip image file is an SD card ROM image.
 
  
<br>
+
 
* <b>Make an eflasher image based on Uboot-2017 + Linux-4.14 for H5 based boards</b>
+
===制作eflasher ROM===
To make an eflasher ROM image you need to have an SD card image ready.We take a FriendlyCore system based on Uboot-2017 + Linux-4.14 as an example:
+
制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件。<br>
 +
例如想制作用于烧写“Linux-4.14的FriendlyCore”的eflasher ROM,先要有"Linux-4.14的FriendlyCore"的sd ROM原材料,即:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
Line 208: Line 275:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If you have an SD card with an eflasher image insert this card to a host PC, mount its rootfs directory(in our test the directory was "part2/h5/4.14/eflasher/rootfs") and run the following command to generate an eflasher ROM image:
+
* <b>准备eflasher的rootfs目录</b>
 +
有2种方式可以准备eflasher的rootfs目录:<br>
 +
1) 制作一张带eflasher 系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区; <br>
 +
2) 解压网盘里的/rootfs/rootfs_eflasher_4.14_YYYYMMDD.tgz<br>
 +
 
 +
* <b>假设eflasher rootfs目录的路径为./rom-maker-lite/part2/h5/4.14/eflasher/rootfs/,执行下面的命令可生成eflasher ROM:</b>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 
$ ./mkimage.sh -c 2 -m partmap/h5_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/eflasher/rootfs;out/SD-bootable-1"
 
$ ./mkimage.sh -c 2 -m partmap/h5_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/eflasher/rootfs;out/SD-bootable-1"
 
</syntaxhighlight>
 
</syntaxhighlight>
After mkimage.sh is executed successfully an "out/SD-bootable-2" directory and the following files will be generated:
+
mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ tree out/
+
$ tree out/SD-bootable-2
out/
+
out/SD-bootable-2
├── SD-bootable-1
+
│   └── your_company
+
│      ├── boot.img
+
│      ├── info.conf
+
│      ├── partmap.txt
+
│      ├── rootfs.img
+
│      ├── sunxi-spl.bin
+
│      └── u-boot.itb
+
├── SD-bootable-1.img
+
 
├── SD-bootable-2
 
├── SD-bootable-2
 
│   └── your_company
 
│   └── your_company
Line 236: Line 300:
 
└── SD-bootable-2.img
 
└── SD-bootable-2.img
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-2.img will be an eflasher image. For example FriendlyElec's nanopi-[h5]_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img.zip image file is an SD card ROM image.The image contained in the "out/SD-bootable-1/" directory will be the image to be flashed to eMMC. You can use the win32diskimager utility or the "dd" command to flash the SD-bootable-2.img image to an SD card.
+
- part1/boot_linux-4.14_h5/目录被制作成了boot.img;<br>
<!--
+
- part2/h5/4.14/eflasher/rootfs/目录被制作成了rootfs.img;<br>
另外,通过如下命令快速地将eflasher系统烧写到SD卡中以进行测试:
+
- out/SD-bootable-1/目录被制作成了friendlyarm.img;<br>
<syntaxhighlight lang="bash">
+
- SD-bootable-2.img则为最终的eflasher ROM文件,它是由SD-bootable-2目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h5]_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img;<br>
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-2/your_company/partmap.txt
+
事实上,FriendlyElec发布的所有H5板子的nanopi-[h5]_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img都是同一个文件。
</syntaxhighlight>
+
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
+
-->
+
  
==Update Log==
 
===Sep-14-2017===
 
* Released English Version
 
  
===Jan-30-2018===
+
===仅制作boot.img/rootfs.img===
* Updated Section 3
+
{{ROM-Maker-lite_mk-fsimg |h5}}
  
===Feb-2-2019===
+
====Linux-4.14====
* Updated Section 3 and Section 5
+
为Linux-4.14 sd ROM生成boot.img和rootfs.img的命令如下:
 +
<syntaxhighlight lang="bash">
 +
$ cd rom-maker-lite
 +
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-4.14_h5/ 40 boot
 +
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h5/4.14/friendlycore/rootfs/ 2048 rootfs
 +
</syntaxhighlight>
 +
上述命令适用于所有H5的板子。

Revision as of 09:49, 18 July 2019

查看中文

1 Make Image Files for RK3399

Refer to this repo: https://github.com/friendlyarm/sd-fuse_rk3399

2 Make Image Files for S5P4418

Refer to this repo: https://github.com/friendlyarm/sd-fuse_s5p4418

3 Make Image Files for S5P6818

Refer to this repo: https://github.com/friendlyarm/sd-fuse_s5p6818

4 Make Image Files for H3

If you have a customized U-boot, Linux kernel and file system and want to use them to make a customized Linux image file(we call it "ROM" in the following sections) you can do it this way: use the "dd" command to copy all the data and files from an existing SD card with a Linux ROM, replace the U-boot, kernel or file system with your customzied files and use the "dd" command again to combine these files to a ROM. However this is inefficient. We suggest you use our rom-maker-lite utility to do it, which can be downloaded at rom-maker-lite.

The rom-maker-lite utility is a general tool to make a ROM. It currently supports making a Linux based sd/eflasher ROM for FriendlyElec's H3/H5 boards .Making an Android image is not supported yet.

  • Run ./mkimage.sh to check usage info:
$ ./mkimage.sh 
Usage:
    $ apt-get install tree exfat-utils dosfstools python3-tk
    $ ./mkimage.sh -c <filesystem type> -m <partmap> -d "<misc dir>;<partition1 dir>;<partition2 dir>;..."
        -c <filesystem type>: 
            1: misc(bootloader) + fat32 boot.img + ext4 rootfs.img
            2: misc(bootloader) + fat32 boot.img + ext4 rootfs.img + exfat friendlyarm.img
            3: misc(bootloader) + ext4 boot.img + ext4 rootfs.img
Parameter Comment
-c <filesystem type>

-c specifies file systems' formats for the partitions in a ROM Image. Specifically for an H3/H5 based board:
-c 1 stands for "misc(bootloader) + fat32 boot.img + ext4 rootfs.img" and this applies to an sd ROM of FriendlyCore/Ubuntu/Debian/OpenWrt;
-c 2 stands for "misc(bootloader) + fat32 boot.img + ext4 rootfs.img + exfat friendlyarm.img" and this applies to an eflasher ROM.

-m <partmap>

-m specifies a partmap file for making a ROM.
A partmap file is used to specify the files and their sizes included in a ROM. ROMs made for different boards or BSPs may need different partmap files.

-d "<misc dir>;<partition1 dir>;<partition2 dir>;..."

-d specifies file system's path and each path is separated by a ";". Specifically for an H3/H5 based board:
<misc dir>: specifies the bootloader's path;
<partition1 dir>: specifies the boot partition's path;
<partition2 dir>: specifies the rootfs partition's path;
"..." means more paths can be defined. When you make an eflasher ROM you need to include the friendlyarm partition's path;

  • Preparations

We tested the following Ubuntu versions that worked with a PC host:
1) ubuntu-16.04.5-desktop-amd64.iso
2) ubuntu-18.04.1-desktop-amd64.iso
If you cannot make a ROM under a Linux system with your PC host you'd better use either one of the above two systems we tested.

Before proceed make sure you have installed the following packages:

$ apt-get install tree exfat-utils dosfstools python3-tk

You need the root access right to make a ROM:

$ su root

4.1 制作sd ROM

4.1.1 Linux-4.14

事实上,对于Linux-4.14 BSP,相同rootfs的所有H3 板子的sd ROM文件都是同一个。所以对于这个版本的BSP,所有H3 的板子的sd ROM 的制作命令是一样的。
这里以制作FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM文件的制作方法是一样的。

  • 准备FriendlyCore的rootfs目录

有2种方式可以准备FriendlyCore的rootfs目录:
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区;
2) 解压网盘里/rootfs/rootfs_friendlycore_4.14_YYYYMMDD.tgz


  • 假设rootfs目录的路径为./rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/,执行下面的命令可生成sd ROM:
$ cd rom-maker-lite
$ ./mkimage.sh -c 1 -m partmap/h3_linux-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/friendlycore/rootfs/"

- 对于所有使用Linux-4.14 BSP的H3板子,使用的都是同一个partmap文件: partmap/h3_linux-4.14/partmap.txt。
- 如果有需要,你可以将misc/uboot-2017_h3、part1/boot_linux-4.14_h3目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:

$ tree misc/uboot-2017_h3/ part1/boot_linux-4.14_h3/
misc/uboot-2017_h3/
└── u-boot-sunxi-with-spl.bin
part1/boot_linux-4.14_h3/
├── boot.cmd
├── boot.scr
├── rootfs.cpio.gz
├── sun8i-h2-plus-nanopi-duo.dtb
├── sun8i-h3-nanopi-duo2.dtb
├── sun8i-h3-nanopi-m1.dtb
├── sun8i-h3-nanopi-m1-plus.dtb
├── sun8i-h3-nanopi-neo-air.dtb
├── sun8i-h3-nanopi-neo-core.dtb
├── sun8i-h3-nanopi-neo.dtb
└── zImage


mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:

$ tree out/
out/
├── SD-bootable-1
│   └── your_company
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       └── u-boot-sunxi-with-spl.bin
├── SD-bootable-1.img

- part1/boot_linux-4.14_h3/目录被制作成了boot.img;
- part2/h3/4.14/friendlycore/rootfs/目录被制作成了rootfs.img;
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h3]_sd_friendlycore-xenial_4.14_armhf_YYYYMMDD.img;


4.1.2 Linux-3.4

- 与Linux-4.14 sd ROM不同,相同rootfs的不同的H3板子的Linux-3.4 sd ROM是不同的。
- 这里以制作NanoPi M1的Linux-3.4 FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM的制作方法是一样的。

  • 准备FriendlyCore的rootfs目录

有1种方式可以准备FriendlyCore的rootfs目录:
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区;


  • 假设rootfs目录的路径为./rom-maker-lite/part2/m1/3.4/friendlycore/rootfs/,执行下面的命令可以生成sd ROM:
$ cd rom-maker-lite
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1/;part1/boot_linux-3.4_m1/;part2/m1/3.4/friendlycore/rootfs"

- 对于所有使用Linux-3.4 BSP的H3板子,使用的都是同一个partmap文件: partmap/h3_linux-3.4/partmap.txt。
- 如果有需要,你可以将misc/uboot-2011_m1、part1/boot_linux-3.4_m1目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:

$ tree misc/uboot-2011_m1 part1/boot_linux-3.4_m1
misc/uboot-2011_m1
├── boot0_sdcard.fex
└── u-boot.fex
part1/boot_linux-3.4_m1
├── boot.img
└── bootlogo.bmp


mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:

$ tree out/
out/
├── SD-bootable-1
│   └── your_company
│       ├── boot0_sdcard.fex
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       └── u-boot.fex
├── SD-bootable-1.img

- part1/boot_linux-3.4_m1目录被制作成了boot.img;
- part2/h3/3.14/friendlycore/rootfs/目录被制作成了rootfs.img;
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-m1_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img;


  • 以此类推,NanoPi M1 Plus 的sd ROM 制作命令如下:
$ ./mkimage.sh -c 1 -m partmap/h3_linux-3.4/partmap.txt -d "misc/uboot-2011_m1-plus/;part1/boot_linux-3.4_m1-plus/;part2/m1-plus/3.4/friendlycore/rootfs"

生成的SD-bootable-1.img等效于FriendlyElec 发布的nanopi-m1-plus_sd_friendlycore-xenial_3.4_armhf_YYYYMMDD.img。NanoPi NEO / NanoPi NEO Air也是同样的道理,这样不再赘述。


4.2 制作eflasher ROM

制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件。
例如想制作用于烧写“Linux-4.14的FriendlyCore”的eflasher ROM,先要有"Linux-4.14的FriendlyCore"的sd ROM原材料,即:

$ tree out/
out/
├── SD-bootable-1
│   └── your_company
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       └── u-boot-sunxi-with-spl.bin


  • 准备eflasher的rootfs目录

有2种方式可以准备eflasher的rootfs目录:
1) 制作一张带eflasher 系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区;
2) 解压网盘里/rootfs/rootfs_eflasher_4.14_YYYYMMDD.tgz


  • 假设eflasher rootfs目录的路径为./rom-maker-lite/part2/h3/4.14/eflasher/rootfs/,执行下面的命令可生成eflasher ROM:
$ cd rom-maker-lite
$ ./mkimage.sh -c 2 -m partmap/h3_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h3/;part1/boot_linux-4.14_h3/;part2/h3/4.14/eflasher/rootfs;out/SD-bootable-1/"

mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:

$ tree out/
out/SD-bootable-2
├── SD-bootable-2
│   └── your_company
│       ├── boot.img
│       ├── friendlyarm.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       └── u-boot-sunxi-with-spl.bin
└── SD-bootable-2.img

- part1/boot_linux-4.14_h3/目录被制作成了boot.img;
- part2/h3/4.14/eflasher/rootfs/目录被制作成了rootfs.img;
- out/SD-bootable-1/目录被制作成了friendlyarm.img;
- SD-bootable-2.img则为最终的eflasher ROM文件,它是由SD-bootable-2目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h3]_eflasher_friendlycore-xenial_4.14_armhf_YYYYMMDD.img;
事实上,FriendlyElec发布的所有H3板子的nanopi-[h3]_eflasher_friendlycore-xenial_4.14_armhf_YYYYMMDD.img都是同一个文件。


4.3 仅制作boot.img/rootfs.img

Actually the rom-maker-lite utility calls the "./tools/mk_fsimg.sh" script to generate a boot.img and rootfs.img. Here are the popular parameters the "mk_fsimg.sh" script usually takes:

Parameter Comment
Parameter1

Specifies a partition format. It currently supports vfat/ext4/exfat

Parameter 2

Specifies an output file;

Parameter 3

Specifies an input directory;

Parameter 4

Specifies an output file's size and the unit is MByte. This size should be greater than the input directory's size and less than the corresponding size specified(in "length") in the partmap.txt file;
Since some file system information needs to be included in an image file this size will be greater than the input directory's size;

Parameter 5

Specifies a partition's tag;

4.3.1 Linux-4.14

为Linux-4.14 sd ROM生成boot.img和rootfs.img的命令如下:

$ cd rom-maker-lite
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-4.14_h3/ 40 boot
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h3/4.14/friendlycore/rootfs/ 2048 rootfs

上述命令适用于所有H3的板子。

4.3.2 Linux-3.4

为NanoPi M1 Linux-3.14 sd ROM生成boot.img和rootfs.img的命令如下:

$ cd rom-maker-lite
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-3.4_m1/ 40 boot
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h3/3.4/friendlycore/rootfs/ 2048 rootfs

上述命令仅适用于NanoPi M1,其他H3的板子的命令也是类似的.


5 制作H5 平台的系统映像

If you have a customized U-boot, Linux kernel and file system and want to use them to make a customized Linux image file(we call it "ROM" in the following sections) you can do it this way: use the "dd" command to copy all the data and files from an existing SD card with a Linux ROM, replace the U-boot, kernel or file system with your customzied files and use the "dd" command again to combine these files to a ROM. However this is inefficient. We suggest you use our rom-maker-lite utility to do it, which can be downloaded at rom-maker-lite.

The rom-maker-lite utility is a general tool to make a ROM. It currently supports making a Linux based sd/eflasher ROM for FriendlyElec's H3/H5 boards .Making an Android image is not supported yet.

  • Run ./mkimage.sh to check usage info:
$ ./mkimage.sh 
Usage:
    $ apt-get install tree exfat-utils dosfstools python3-tk
    $ ./mkimage.sh -c <filesystem type> -m <partmap> -d "<misc dir>;<partition1 dir>;<partition2 dir>;..."
        -c <filesystem type>: 
            1: misc(bootloader) + fat32 boot.img + ext4 rootfs.img
            2: misc(bootloader) + fat32 boot.img + ext4 rootfs.img + exfat friendlyarm.img
            3: misc(bootloader) + ext4 boot.img + ext4 rootfs.img
Parameter Comment
-c <filesystem type>

-c specifies file systems' formats for the partitions in a ROM Image. Specifically for an H3/H5 based board:
-c 1 stands for "misc(bootloader) + fat32 boot.img + ext4 rootfs.img" and this applies to an sd ROM of FriendlyCore/Ubuntu/Debian/OpenWrt;
-c 2 stands for "misc(bootloader) + fat32 boot.img + ext4 rootfs.img + exfat friendlyarm.img" and this applies to an eflasher ROM.

-m <partmap>

-m specifies a partmap file for making a ROM.
A partmap file is used to specify the files and their sizes included in a ROM. ROMs made for different boards or BSPs may need different partmap files.

-d "<misc dir>;<partition1 dir>;<partition2 dir>;..."

-d specifies file system's path and each path is separated by a ";". Specifically for an H3/H5 based board:
<misc dir>: specifies the bootloader's path;
<partition1 dir>: specifies the boot partition's path;
<partition2 dir>: specifies the rootfs partition's path;
"..." means more paths can be defined. When you make an eflasher ROM you need to include the friendlyarm partition's path;

  • Preparations

We tested the following Ubuntu versions that worked with a PC host:
1) ubuntu-16.04.5-desktop-amd64.iso
2) ubuntu-18.04.1-desktop-amd64.iso
If you cannot make a ROM under a Linux system with your PC host you'd better use either one of the above two systems we tested.

Before proceed make sure you have installed the following packages:

$ apt-get install tree exfat-utils dosfstools python3-tk

You need the root access right to make a ROM:

$ su root

5.1 制作sd ROM

5.1.1 Linux-4.14

事实上,对于Linux-4.14 BSP,相同rootfs的所有H5 板子的sd ROM文件都是同一个,所以对于这个版本的BSP,所有H5 的板子的sd ROM 的制作命令是一样的。
这里以制作FriendlyCore sd ROM为例进行讲解,Ubuntu、Debian、OpenWrt等sd ROM文件的制作方法是一样的。

  • 准备FriendlyCore的rootfs目录

有2种方式可以准备FriendlyCore的rootfs目录:
1) 制作一张带FriendlyCore系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区;
2) 解压网盘里的/rootfs/rootfs_friendlycore_4.14_YYYYMMDD.tgz


  • 假设rootfs目录的路径为./rom-maker-lite/part2/h5/4.14/friendlycore/rootfs/,执行下面的命令可生成sd ROM:
$ cd rom-maker-lite
$ ./mkimage.sh -c 1 -m partmap/h5_linux-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/friendlycore/rootfs/"

- 对于所有使用Linux-4.14 BSP的H5板子,使用的都是同一个partmap文件: partmap/h5_linux-4.14/partmap.txt。
- 如果有需要,你可以将misc/uboot-2017_h5、part1/boot_linux-4.14_h5目录下的文件替换为你自己定制编译的文件,通过tree命令可查看有哪些可替换的文件:

$ tree misc/uboot-2017_h5/ part1/boot_linux-4.14_h5/
misc/uboot-2017_h5/
├── sunxi-spl.bin
└── u-boot.itb
part1/boot_linux-4.14_h5/
├── boot.cmd
├── boot.scr
├── Image
├── overlays
│   └── sun50i-h5-gpio-dvfs-overlay.dtb
├── rootfs.cpio.gz
├── sun50i-h5-nanopi-k1-plus.dtb
├── sun50i-h5-nanopi-neo2.dtb
├── sun50i-h5-nanopi-neo-core2.dtb
└── sun50i-h5-nanopi-neo-plus2.dtb


mkimage.sh执行成功后,会生成out/SD-bootable-1目录(这里的"1"对应参数“-c 1”),,其内容如下:

$ tree out/
out/
├── SD-bootable-1
│   └── your_company
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       ├── sunxi-spl.bin
│       └── u-boot.itb
├── SD-bootable-1.img

- part1/boot_linux-4.14_h5/目录被制作成了boot.img;
- part2/h5/4.14/friendlycore/rootfs/目录被制作成了rootfs.img;
- SD-bootable-1.img则为最终的sd ROM文件,它是由SD-bootable-1目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h5]_sd_friendlycore-xenial_4.14_arm64_YYYYMMDD.img;


5.2 制作eflasher ROM

制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件。
例如想制作用于烧写“Linux-4.14的FriendlyCore”的eflasher ROM,先要有"Linux-4.14的FriendlyCore"的sd ROM原材料,即:

$ tree out/
out/
├── SD-bootable-1
│   └── your_company
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       ├── sunxi-spl.bin
│       └── u-boot.itb
  • 准备eflasher的rootfs目录

有2种方式可以准备eflasher的rootfs目录:
1) 制作一张带eflasher 系统的SD卡,然后基于该SD卡进行定制开发,当开发完毕后,在PC机上挂载该SD卡的rootfs分区;
2) 解压网盘里的/rootfs/rootfs_eflasher_4.14_YYYYMMDD.tgz

  • 假设eflasher rootfs目录的路径为./rom-maker-lite/part2/h5/4.14/eflasher/rootfs/,执行下面的命令可生成eflasher ROM:
$ cd rom-maker-lite
$ ./mkimage.sh -c 2 -m partmap/h5_eflasher-4.14/partmap.txt -d "misc/uboot-2017_h5/;part1/boot_linux-4.14_h5/;part2/h5/4.14/eflasher/rootfs;out/SD-bootable-1"

mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:

$ tree out/SD-bootable-2
out/SD-bootable-2
├── SD-bootable-2
│   └── your_company
│       ├── boot.img
│       ├── friendlyarm.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       ├── sunxi-spl.bin
│       └── u-boot.itb
└── SD-bootable-2.img

- part1/boot_linux-4.14_h5/目录被制作成了boot.img;
- part2/h5/4.14/eflasher/rootfs/目录被制作成了rootfs.img;
- out/SD-bootable-1/目录被制作成了friendlyarm.img;
- SD-bootable-2.img则为最终的eflasher ROM文件,它是由SD-bootable-2目录下的所有文件组装而来的,等效于FriendlyElec 发布的nanopi-[h5]_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img;
事实上,FriendlyElec发布的所有H5板子的nanopi-[h5]_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img都是同一个文件。


5.3 仅制作boot.img/rootfs.img

Actually the rom-maker-lite utility calls the "./tools/mk_fsimg.sh" script to generate a boot.img and rootfs.img. Here are the popular parameters the "mk_fsimg.sh" script usually takes:

Parameter Comment
Parameter1

Specifies a partition format. It currently supports vfat/ext4/exfat

Parameter 2

Specifies an output file;

Parameter 3

Specifies an input directory;

Parameter 4

Specifies an output file's size and the unit is MByte. This size should be greater than the input directory's size and less than the corresponding size specified(in "length") in the partmap.txt file;
Since some file system information needs to be included in an image file this size will be greater than the input directory's size;

Parameter 5

Specifies a partition's tag;

5.3.1 Linux-4.14

为Linux-4.14 sd ROM生成boot.img和rootfs.img的命令如下:

$ cd rom-maker-lite
$ ./tools/mk_fsimg.sh vfat boot.img ./part1/boot_linux-4.14_h5/ 40 boot
$ ./tools/mk_fsimg.sh ext4 rootfs.img ./part2/h5/4.14/friendlycore/rootfs/ 2048 rootfs

上述命令适用于所有H5的板子。