Template:ROM-Maker-lite Introduce

From FriendlyELEC WiKi
Revision as of 08:46, 22 July 2019 by Yftan (Talk | contribs)

Jump to: navigation, search

If you have a customized U-boot, Linux kernel and file system and want to use them to make a Linux image file(we call it "ROM" in the following sections) you can use the "dd" command the copy all the data and files in your SD card with a Linux ROM. 、文件系统,并且想基于自己定制的文件制作Linux系统映像文件 (以下简称为ROM文件),你可以选择用dd命令将带有你的应用程序和配置的SD卡的数据完整地拷贝出来,这种方法简单粗暴,但是效率不高。另外,你也可以使用FriendlyElec 提供的rom-maker-lite工具。

rom-maker-lite是一套通用的制作映像文件的脚本工具,目前支持为 H3/H5 系列的开发板制作Linux平台的sd/eflasher ROM文件(尚未支持Android)。

  • 执行./mkimage.sh查看帮助信息:
$ ./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 the 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 用于指定制作ROM时需要的partmap文件。
partmap文件用于指定ROM Image的组成文件和分区的大小,不同的板子或者是同一板子不同版本的BSP使用的partmap文件是不一样的。

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

-d 用于指定系统文件所在的目录,每个路径之间用“;”分割,对于H3/H5系列的开发板:
<misc dir>: 用于指定bootloader所在的目录路径;
<partition1 dir>: 用于指定boot分区的目录路径;
<partition2 dir>: 用于指定rootfs分区的目录路径;
最后的...表示就还可以接收更多的目录路径。当制作eflasher ROM时,就需要添加friendlyarm分区的目录路径;

  • 准备工作

经测试过PC机 Ubuntu版本包括:
1) ubuntu-16.04.5-desktop-amd64.iso
2) ubuntu-18.04.1-desktop-amd64.iso
如果你当前PC机使用的Ubuntu系统无法成功执行出系统映像,请尝试切换到上面这两个版本的Ubuntu系统。

在开始制作系统映像前,必须先安装下列软件包:

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

由于制作系统映像需要root权限,请先切换到root用户:

$ su root