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

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
Line 10: Line 10:
 
Refer to this repo: https://github.com/friendlyarm/sd-fuse_s5p6818
 
Refer to this repo: https://github.com/friendlyarm/sd-fuse_s5p6818
  
==Make Linux ROM for H3==
+
==制作H3 平台的系统映像==
If you have compiled a U-boot, Linux kernel and a file system, and want to make a your own Linux image (ROM) with these files you can refer to the following steps:<br>
+
{{ROM-Maker-lite_Introduce |h3}}
Download a package "rom-maker-lite.tar.gz" : [https://pan.baidu.com/s/1DSd4XYXr1yGyQTdRNQNoOw download link], extract it in host PC running Ubuntu and you will get the following directorie:
+
<syntaxhighlight lang="bash">
+
rom-maker-lite
+
</syntaxhighlight>
+
The "rom-maker-lite" directory has the script utilities which can be used to make a ROM that boots from an SD card.<br><br>
+
  
Currently the script utilities under the "rom-maker-lite" directory can be only used to make Linux ROMs for H3/H5. You can check its usage by running the "./mkimage.sh" script:
+
* <b>为H3 系列的板子制作基于Uboot-2017 + Linux-4.14 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)</b>
<syntaxhighlight lang="bash">
+
事实上,对于Uboot-2017 + Linux-4.14版本的BSP,所有H3 系列的板子的sd ROM文件都是同一个。所以对于这个版本的BSP,所有H3 系列的板子的sd ROM 的制作命令是一样的。
$ ./mkimage.sh
+
这里以制作FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM文件的制作方法是类似的。<br><br>
Usage:
+
假设你已经有一张带有FriendlyCore系统的SD卡,并且该SD卡的rootfs目录下已经包含了你自己的应用程序和设置。请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/, 请注意使用真实路径),使用下面的命令可以生成你自己定制的ROM文件:
    $ apt-get install tree dosfstools
+
    $ ./mkimage.sh <prepare type> <partmap> <misc dir> <partition1 dir> <partition2 dir>
+
        prepare type:
+
            p1: prepare misc(bootloader) + partition1.img(fat32 boot) + partition2.img(ext4 rootfs)
+
            p2: prepare misc(bootloader) + partition1.img(fat32 boot) + partition2.img(ext4 rootfs) + partition3.img(fat32 eflashed material)
+
            p3: prepare misc(bootloader) + partition1.img(ext4 boot) + partition2.img(ext4 rootfs)
+
</syntaxhighlight>
+
 
+
::{| class="wikitable"
+
|-
+
|Parameter||Comment
+
|-
+
|<prepare type>  ||  specifies a ROM type. For H3/H5 p1 means to make a FriendlyCore/Ubuntu/Debian ROM and p2 means to make an Eflasher ROM.
+
|-
+
|<partmap>  ||  specifies a partmap that is needed for making a ROM. A partmap file specifies a ROM Image's partition and components. Different platforms or different BSPs for the same platform use different partmap files.
+
|-
+
|<misc dir>  ||  specifies a bootloader's path for H3/H5.
+
|-
+
|<partition1 dir>  ||  specifies the boot partition's path for H3/H5.
+
|-
+
|<partition2 dir>  ||  specifies the rootfs's path for H3/H5.
+
|-
+
|}
+
 
+
<br>
+
* <b>Make Uboot-2017 + Linux-4.14 ROM for H3</b>
+
All FriendlyElec's H3 boards work with a Uboot-2017 + Linux-4.14 ROM. So the steps to generate a ROM based on a BSP are the same for all FriendlyElec boards.<br>
+
If you have a bootable SD card with FriendlyCore the rootfs directory in the SD card should have all the files you need. Insert this SD card to a host PC, mount the SD card's rootfs directory (in our test it was mounted at /media/SD/rootfs) and make a ROM following the steps below:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p1 partmap/h3_linux-4.14/partmap.txt misc/uboot-2017_h3/ part1/boot_linux-4.14_h3/ /media/SD/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>
Replace the existing files under the directories (misc/uboot-2017_h3, part1/boot_linux-4.14_h3) with your new files. FriendlyElec will periodically update files. You can list all the files by commanding "tree":
+
如果有需要,可以将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 71: Line 38:
 
└── zImage
 
└── zImage
 
</syntaxhighlight>
 
</syntaxhighlight>
For all the FriendlyElec's H3 boards that works with Linux-4.14 BSP they use the same partmap file which is "partmap/h3_linux-4.14/partmap.txt".<br>
+
对于所有使用Linux-4.14 BSP的H3板子,使用的都是同一个partmap文件partmap/h3_linux-4.14/partmap.txt。<br>
After running the mkimage.sh script a "out/SD-bootable-p1" directory will be generated and it will have the following files:
+
mkimage.sh执行成功后,会生成out/SD-bootable-1目录,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 83: Line 50:
 
│      ├── rootfs.img
 
│      ├── rootfs.img
 
│      └── u-boot-sunxi-with-spl.bin
 
│      └── u-boot-sunxi-with-spl.bin
├── SD-bootable-p1.img
+
├── SD-bootable-1.img
  
 
</syntaxhighlight>
 
</syntaxhighlight>
The "part1/boot_linux-4.14_h3/" directory will be made to a boot.img, the "part2/rootfs_demo/" directory will be made to a rootfs.img and the SD-bootable-p1.img will be the new ROM.
+
part1/boot_linux-4.14_h3/目录被制作成了boot.img,part2/h3/4.14/friendlycore/rootfs/被制作成了rootfs.img,SD-bootable-1.img则为最终的sd ROM文件,你可以用win32diskimager或者dd命令将SD-bootable-1.img烧写到SD卡中。
 
<!--
 
<!--
您可以通过如下命令迅速将其烧写到SD卡中以进行测试:
+
另外,你可以通过如下命令快速地将系统烧写到SD卡中以进行测试:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-p1/your_company/partmap.txt
+
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-1/your_company/partmap.txt
 
</syntaxhighlight>
 
</syntaxhighlight>
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
-->
 
-->
You can use the win32diskimager utility under Windows or command "dd" under Linux to flash a SD-bootable-p1.img to an SD card.
 
  
 
<br>
 
<br>
* <b>Make Uboot-2011 + Linux-3.4 ROM for H3</b>
+
* <b>为H3 系列的板子制作基于Uboot-2011 + Linux-3.4 的sd ROM(例如FriendlyCore/Debian/OpenWrt...) </b>
Let's take FriendlyElec's NanoPi M1 as an example, run the following command:
+
无论是基于什么版本的BSP,做rom的原理都是一样的,这里不再赘述。这里以制作NanoPi M1的FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM的制作方法是类似的。<br><br>
 +
执行命令:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p1 partmap/h3_linux-3.4/partmap.txt misc/uboot-2011_m1/ part1/boot_linux-3.4_m1/ part2/rootfs_demo/
+
$ ./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>
Replace the existing files under the directories with your new files.<br>
+
请将对应目录下的文件替换为你自己的定制文件。对于所有使用Linux-3.4 BSP的H3板子,使用的都是同一个partmap文件partmap/h3_linux-3.4/partmap.txt。<br>
For all the FriendlyElec's H3 boards that works with Linux-3.4 BSP they use the same partmap file which is "partmap/h3_linux-3.4/partmap.txt".<br>
+
以此类推,NanoPi M1 Plus 的sd ROM 制作命令如下:
So if you want to make a ROM for a NanoPi M1 Plus you can run the following command:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p1 partmap/h3_linux-3.4/partmap.txt misc/uboot-2011_m1-plus/ part1/boot_linux-3.4_m1-plus/ part2/rootfs_demo/
+
$ ./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>
This applies to the NanoPi NEO / NanoPi NEO Air too.
+
NanoPi NEO / NanoPi NEO Air也是同样的道理,这样不再赘述。
  
 
<br>
 
<br>
* <b>Make Uboot-2017 + Linux-4.14 Eflasher ROM for H3</b>
+
* <b>为H3 系列的板子制作基于Uboot-2017 + Linux-4.14 的eflasher ROM</b>
In order to make an Eflasher ROM you need to have an existing FriendlyCore ROM. A Uboot-2017 + Linux-4.14 FriendlyCore image has the following files:
+
制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件,例如基于Uboot-2017 + Linux-4.14的FriendlyCore系统:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 125: Line 91:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If you have a bootable SD card with Eflasher, insert the SD card to a host PC, mount the SD card's rootfs directory(in our test it was mounted at the "/media/SD/rootfs-eflasher" directory) and run the following command to generate an Eflasher ROM:
+
假设你有一张带有eflasher 系统的SD卡,请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为part2/h3/4.14/eflasher/rootfs, 请注意使用真实路径),然后通过以下命令就可以生成eflasher ROM:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p2 partmap/h3_eflasher-4.14/partmap.txt misc/uboot-2017_h3/ part1/boot_linux-4.14_h3/ /media/SD/rootfs-eflasher out/SD-bootable-p1/
+
$ ./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>
 
</syntaxhighlight>
After running the mkimage.sh script an "out/SD-bootable-p2" directory will be generated and it will have the following files:
+
mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 140: Line 106:
 
│      ├── rootfs.img
 
│      ├── rootfs.img
 
│      └── u-boot-sunxi-with-spl.bin
 
│      └── u-boot-sunxi-with-spl.bin
├── SD-bootable-p1.img
+
├── SD-bootable-1.img
├── SD-bootable-p2
+
├── SD-bootable-2
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 149: Line 115:
 
│      ├── rootfs.img
 
│      ├── rootfs.img
 
│      └── u-boot-sunxi-with-spl.bin
 
│      └── u-boot-sunxi-with-spl.bin
└── SD-bootable-p2.img
+
└── SD-bootable-2.img
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-p2.img file will be the newly generated Eflasher ROM. What OS the "out/SD-bootable-p1/" contains will be the OS in this Eflasher ROM.
+
SD-bootable-2.img即为最终的eflasher ROM文件,该eflasher ROM能烧写什么系统到eMMC完全取决于out/SD-bootable-1/里包含了什么系统,你可以用win32diskimager或者dd命令将SD-bootable-2.img烧写到SD卡中。
 
<!--
 
<!--
通过如下命令迅速将其烧写到SD卡中以进行测试:
+
另外,通过如下命令快速地将eflasher系统烧写到SD卡中以进行测试:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-p2/your_company/partmap.txt
+
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-2/your_company/partmap.txt
 
</syntaxhighlight>
 
</syntaxhighlight>
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
-->
 
-->
You can use the win32diskimager utility under Windows or command "dd" under Linux to flash a SD-bootable-p2.img to an SD card.
 
  
==Make Linux ROM for H5==
+
==制作H5 平台的系统映像==
If you have compiled a U-boot, Linux kernel and a file system, and want to make a your own Linux image (ROM) with these files you can refer to the following steps:<br>
+
{{ROM-Maker-lite_Introduce |h5}}
Download a package "rom-maker-lite.tar.gz" : [https://pan.baidu.com/s/1DSd4XYXr1yGyQTdRNQNoOw download link], extract it in host PC running Ubuntu and you will get the following directorie:
+
<syntaxhighlight lang="bash">
+
rom-maker-lite
+
</syntaxhighlight>
+
The "rom-maker-lite" directory has the script utilities which can be used to make a ROM that boots from an SD card.<br><br>
+
  
Currently the script utilities under the "rom-maker-lite" directory can be only used to make Linux ROMs for H3/H5. You can check its usage by running the "./mkimage.sh" script:
+
* <b>为H5 系列的板子制作基于Uboot-2017 + Linux-4.14 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)</b>
 +
事实上,对于Uboot-2017 + Linux-4.14版本的BSP,所有H5 系列的板子的sd ROM文件都是同一个。所以对于这个版本的BSP,所有H3 系列的板子的sd ROM 的制作命令是一样的。
 +
这里以制作FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM文件的制作方法是类似的。<br><br>
 +
假设你已经有一张带有FriendlyCore系统的SD卡,并且该SD卡的rootfs目录下已经包含了你自己的应用程序和设置。请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/, 请注意使用真实路径),使用下面的命令可以生成你自己定制的ROM文件:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh  
+
$ ./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/"
Usage:
+
    $ apt-get install tree dosfstools
+
    $ ./mkimage.sh <prepare type> <partmap> <misc dir> <partition1 dir> <partition2 dir>
+
        prepare type:
+
            p1: prepare misc(bootloader) + partition1.img(fat32 boot) + partition2.img(ext4 rootfs)
+
            p2: prepare misc(bootloader) + partition1.img(fat32 boot) + partition2.img(ext4 rootfs) + partition3.img(fat32 eflashed material)
+
            p3: prepare misc(bootloader) + partition1.img(ext4 boot) + partition2.img(ext4 rootfs)
+
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
如果有需要,可以将misc/uboot-2017_h5、part1/boot_linux-4.14_h5目录下的文件替换为你自己的定制文件,当然你也可以使用目录里自带的预编译系统文件,我们会不定期更新预编译系统文件,通过tree命令可查看有哪些可替换的系统文件:
::{| class="wikitable"
+
|-
+
|Parameter||Comment
+
|-
+
|<prepare type>  ||  specifies a ROM type. For H3/H5 p1 means to make a FriendlyCore/Ubuntu/Debian ROM and p2 means to make an Eflasher ROM.
+
|-
+
|<partmap>  ||  specifies a partmap that is needed for making a ROM. A partmap file specifies a ROM Image's partition and components. Different platforms or different BSPs for the same platform use different partmap files.
+
|-
+
|<misc dir>  ||  specifies a bootloader's path for H3/H5.
+
|-
+
|<partition1 dir>  ||  specifies the boot partition's path for H3/H5.
+
|-
+
|<partition2 dir>  ||  specifies the rootfs's path for H3/H5.
+
|-
+
|}
+
 
+
<br>
+
* <b>Make Uboot-2017 + Linux-4.14 ROM for H5</b>
+
All FriendlyElec's H5 boards work with a Uboot-2017 + Linux-4.14 ROM. So the steps to generate a ROM based on a BSP are the same for all FriendlyElec boards.
+
If you have a bootable SD card with FriendlyCore the rootfs directory in the SD card should have all the files you need. Insert this SD card to a host PC, mount the SD card's rootfs directory (in our test it was mounted at /media/SD/rootfs) and make a ROM following the steps below
+
<syntaxhighlight lang="bash">
+
$ ./mkimage.sh p1 partmap/h5_linux-4.14/partmap.txt misc/uboot-2017_h5/ part1/boot_linux-4.14_h5/ /media/SD/rootfs
+
</syntaxhighlight>
+
Replace the existing files under the directories (misc/uboot-2017_h5, part1/boot_linux-4.14_h5) with your new files. FriendlyElec will periodically update files. You can list all the files by commanding "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 223: Line 155:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For all the FriendlyElec's H5 boards that works with Linux-4.14 BSP they use the same partmap file which is "partmap/h5_linux-4.14/partmap.txt".<br>
+
对于所有使用Linux-4.14 BSP的H5板子,使用的都是同一个partmap文件partmap/h5_linux-4.14/partmap.txt。<br>
After running the mkimage.sh script a "out/SD-bootable-p1" directory will be generated and it will have the following files:
+
mkimage.sh执行成功后,会生成out/SD-bootable-1目录,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 236: Line 168:
 
│      ├── sunxi-spl.bin
 
│      ├── sunxi-spl.bin
 
│      └── u-boot.itb
 
│      └── u-boot.itb
├── SD-bootable-p1.img
+
├── SD-bootable-1.img
  
 
</syntaxhighlight>
 
</syntaxhighlight>
The "part1/boot_linux-4.14_h5/" directory will be made to a boot.img, the "part2/rootfs_demo/" directory will be made to a rootfs.img and the SD-bootable-p1.img will be the new ROM.  
+
part1/boot_linux-4.14_h5/目录被制作成了boot.img,part2/h5/4.14/friendlycore/rootfs/被制作成了rootfs.img,SD-bootable-1.img则为最终的sd ROM文件,你可以用win32diskimager或者dd命令将SD-bootable-1.img烧写到SD卡中。
 
<!--
 
<!--
您可以通过如下命令迅速将其烧写到SD卡中以进行测试:
+
另外,你可以通过如下命令快速地将系统烧写到SD卡中以进行测试:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-p1/your_company/partmap.txt
+
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-1/your_company/partmap.txt
 
</syntaxhighlight>
 
</syntaxhighlight>
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 
-->
 
-->
You can use the win32diskimager utility under Windows or command "dd" under Linux to flash a SD-bootable-p2.img to an SD card.
 
  
 
<br>
 
<br>
* <b>Make Uboot-2014 + Linux-3.10 ROM for H5</b>
+
* <b>为H5 系列的板子制作基于Uboot-2014 + Linux-3.10 的sd ROM(例如FriendlyCore/Debian/OpenWrt...) </b>
Let's take FriendlyElec's NanoPi NEO2 as an example, run the following command:
+
无论是基于什么版本的BSP,做rom的原理都是一样的,这里不再赘述。这里以制作NanoPi NEO2的FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM的制作方法是类似的。<br><br>
 +
执行命令:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p1 partmap/h5_linux-3.10/partmap.txt misc/uboot-2014_neo2/ part1/boot_linux-3.10_neo2/ part2/rootfs_demo/
+
$ ./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>
 
</syntaxhighlight>
Replace the existing files under the directories with your new files.
+
请将对应目录下的文件替换为你自己的定制文件。对于所有使用Linux-3.10 BSP的H5板子,使用的都是同一个partmap文件partmap/h5_linux-3.10/partmap.txt。<br>
For all the FriendlyElec's H5 boards that works with Linux-3.10 BSP they use the same partmap file which is "partmap/h5_linux-3.10/partmap.txt".
+
以此类推,NanoPi NEO Plus2 的sd ROM 制作命令如下:
 +
<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>
 +
 
 
<br>
 
<br>
* <b>Make Uboot-2017 + Linux-4.14 Eflasher ROM for H5</b>
+
* <b>为H5 系列的板子制作基于Uboot-2017 + Linux-4.14 的eflasher ROM</b>
In order to make an Eflasher ROM you need to have an existing FriendlyCore ROM. A Uboot-2017 + Linux-4.14 FriendlyCore image has the following files:
+
制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件,例如基于Uboot-2017 + Linux-4.14的FriendlyCore系统:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 273: Line 209:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If you have a bootable SD card with Eflasher, insert the SD card to a host PC, mount the SD card's rootfs directory(in our test it was mounted at the "/media/SD/rootfs-eflasher" directory) and run the following command to generate an Eflasher ROM:
+
假设你有一张带有eflasher 系统的SD卡,请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为part2/h5/4.14/eflasher/rootfs, 请注意使用真实路径),然后通过以下命令就可以生成eflasher ROM:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ./mkimage.sh p2 partmap/h5_eflasher-4.14/partmap.txt misc/uboot-2017_h5/ part1/boot_linux-4.14_h5/ /media/SD/rootfs-eflasher out/SD-bootable-p1/
+
$ ./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 running the mkimage.sh script an "out/SD-bootable-p2" directory will be generated and it will have the following files:
+
mkimage.sh执行成功后,会生成out/SD-bootable-2目录,其内容如下:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ tree out/
 
$ tree out/
 
out/
 
out/
├── SD-bootable-p1
+
├── SD-bootable-1
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 289: Line 225:
 
│      ├── sunxi-spl.bin
 
│      ├── sunxi-spl.bin
 
│      └── u-boot.itb
 
│      └── u-boot.itb
├── SD-bootable-p1.img
+
├── SD-bootable-1.img
├── SD-bootable-p2
+
├── SD-bootable-2
 
│   └── your_company
 
│   └── your_company
 
│      ├── boot.img
 
│      ├── boot.img
Line 299: Line 235:
 
│      ├── sunxi-spl.bin
 
│      ├── sunxi-spl.bin
 
│      └── u-boot.itb
 
│      └── u-boot.itb
└── SD-bootable-p2.img
+
└── SD-bootable-2.img
 
</syntaxhighlight>
 
</syntaxhighlight>
The SD-bootable-p2.img file will be the newly generated Eflasher ROM. What OS the "out/SD-bootable-p1/" contains will be the OS in this Eflasher ROM.  
+
SD-bootable-2.img即为最终的eflasher ROM文件,该eflasher ROM能烧写什么系统到eMMC完全取决于out/SD-bootable-1/里包含了什么系统,你可以用win32diskimager或者dd命令将SD-bootable-2.img烧写到SD卡中。
 +
<!--
 +
另外,通过如下命令快速地将eflasher系统烧写到SD卡中以进行测试:
 +
<syntaxhighlight lang="bash">
 +
$ ./tools/sd_update -d /dev/SD -p ./out/SD-bootable-2/your_company/partmap.txt
 +
</syntaxhighlight>
 +
注意: 请将/dev/sdX替换为实际的SD卡设备节点。
 +
-->
  
 
==Update Log==
 
==Update Log==

Revision as of 04:53, 31 January 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 制作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
  • 为H3 系列的板子制作基于Uboot-2017 + Linux-4.14 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)

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

假设你已经有一张带有FriendlyCore系统的SD卡,并且该SD卡的rootfs目录下已经包含了你自己的应用程序和设置。请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/, 请注意使用真实路径),使用下面的命令可以生成你自己定制的ROM文件:

$ ./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/"

如果有需要,可以将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

对于所有使用Linux-4.14 BSP的H3板子,使用的都是同一个partmap文件partmap/h3_linux-4.14/partmap.txt。
mkimage.sh执行成功后,会生成out/SD-bootable-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文件,你可以用win32diskimager或者dd命令将SD-bootable-1.img烧写到SD卡中。


  • 为H3 系列的板子制作基于Uboot-2011 + Linux-3.4 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)

无论是基于什么版本的BSP,做rom的原理都是一样的,这里不再赘述。这里以制作NanoPi M1的FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM的制作方法是类似的。

执行命令:

$ ./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。
以此类推,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"

NanoPi NEO / NanoPi NEO Air也是同样的道理,这样不再赘述。


  • 为H3 系列的板子制作基于Uboot-2017 + Linux-4.14 的eflasher ROM

制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件,例如基于Uboot-2017 + Linux-4.14的FriendlyCore系统:

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

假设你有一张带有eflasher 系统的SD卡,请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为part2/h3/4.14/eflasher/rootfs, 请注意使用真实路径),然后通过以下命令就可以生成eflasher ROM:

$ ./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-1
│   └── your_company
│       ├── boot.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       └── u-boot-sunxi-with-spl.bin
├── SD-bootable-1.img
├── 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

SD-bootable-2.img即为最终的eflasher ROM文件,该eflasher ROM能烧写什么系统到eMMC完全取决于out/SD-bootable-1/里包含了什么系统,你可以用win32diskimager或者dd命令将SD-bootable-2.img烧写到SD卡中。

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
  • 为H5 系列的板子制作基于Uboot-2017 + Linux-4.14 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)

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

假设你已经有一张带有FriendlyCore系统的SD卡,并且该SD卡的rootfs目录下已经包含了你自己的应用程序和设置。请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为rom-maker-lite/part2/h3/4.14/friendlycore/rootfs/, 请注意使用真实路径),使用下面的命令可以生成你自己定制的ROM文件:

$ ./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/"

如果有需要,可以将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

对于所有使用Linux-4.14 BSP的H5板子,使用的都是同一个partmap文件partmap/h5_linux-4.14/partmap.txt。
mkimage.sh执行成功后,会生成out/SD-bootable-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文件,你可以用win32diskimager或者dd命令将SD-bootable-1.img烧写到SD卡中。


  • 为H5 系列的板子制作基于Uboot-2014 + Linux-3.10 的sd ROM(例如FriendlyCore/Debian/OpenWrt...)

无论是基于什么版本的BSP,做rom的原理都是一样的,这里不再赘述。这里以制作NanoPi NEO2的FriendlyCore sd ROM为例进行讲解,Debian、OpenWrt等sd ROM的制作方法是类似的。

执行命令:

$ ./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"

请将对应目录下的文件替换为你自己的定制文件。对于所有使用Linux-3.10 BSP的H5板子,使用的都是同一个partmap文件partmap/h5_linux-3.10/partmap.txt。
以此类推,NanoPi NEO Plus2 的sd ROM 制作命令如下:

$ ./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"


  • 为H5 系列的板子制作基于Uboot-2017 + Linux-4.14 的eflasher ROM

制作eflasher ROM的前提条件是已经成功制作出了FriendlyCore/Debian/OpenWrt等sd ROM,即已经有待烧写到eMMC的原材料文件,例如基于Uboot-2017 + Linux-4.14的FriendlyCore系统:

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

假设你有一张带有eflasher 系统的SD卡,请将该SD卡插入PC机中,然后挂载SD卡的rootfs分区(假设挂载路径为part2/h5/4.14/eflasher/rootfs, 请注意使用真实路径),然后通过以下命令就可以生成eflasher ROM:

$ ./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/
out/
├── 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
│   └── your_company
│       ├── boot.img
│       ├── friendlyarm.img
│       ├── info.conf
│       ├── partmap.txt
│       ├── rootfs.img
│       ├── sunxi-spl.bin
│       └── u-boot.itb
└── SD-bootable-2.img

SD-bootable-2.img即为最终的eflasher ROM文件,该eflasher ROM能烧写什么系统到eMMC完全取决于out/SD-bootable-1/里包含了什么系统,你可以用win32diskimager或者dd命令将SD-bootable-2.img烧写到SD卡中。

6 Update Log

6.1 Sep-14-2017

  • Released English Version

6.2 Jan-30-2018

  • Updated Section 3