参考文档
① 使用buildroot完全自定义自己的embedded linux系统(nand)
② Overlay Filesystem
③ How do I use OverlayFS?
分区表
分区表由文件sys_config.fex划分,填充内容由[downloadi]指定。而[downloadi]对应的
文件则由文件image.cfg定义。
- sys_config.fex
;---------------------------------------------------------------------------------------------------------
; 说明: 脚本中的字符串区分大小写,用户可以修改"="后面的数值,但是不要修改前面的字符串
;---------------------------------------------------------------------------------------------------------
[platform]
chip=0x02000000
pid =0x02000000
sid =0x02000100
bid =0x80
eraseflag = 0
jtag = 1
[fex_misc]
restore = 1
;--------------------------------------------------------------------------------------------------
; 固件下载参数配置
;--------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------
; 分区配置管理
;-----------------------------------------------------------------------------------------
;****************************************************
; mbr的大小, 以Kbyte为单位
;****************************************************
[mbr]
size = 1024
;********************************************************************************************************
; 分区配置
; 当前分区的个数,默认有rootfs和userfs0两个分区,最大分区个数为7个.
;
; [part_num]
; num = 2 ; //有2个分区
; part0 = partiton0 ; //part0的信息存放在partiton0里
; parti = partitoni ; //parti的信息存放在partitoni里
;
; partition 定义范例:
; [partition2] ; //第2个分区
; class_name = DISK ; //设备类名, 如:"DISK"。 可参考"..\ePDK\includes\emod\sys_dev.h"
; name = USERFS2 ; //设备节点名. 可参考"..\ePDK\includes\emod\sys_dev.h"
; size_hi = 0 ; //分区大小的高32位, 单位: Kbyte.
; size_lo = 32 ; //分区大小的低32位, 单位: Kbyte.
;
; 注:1、name唯一, 不允许同名
; 2、最大分区号为6
; 3、class_name和name最大12个字符
; 4、size_hi + size_lo = 0, 表示此分区不存在 1048576
;********************************************************************************************************
[part_num]
num = 4
[partition0]
class_name = DISK
name = bootloader
size_hi = 0
size_lo = 65536
user_type = 0
ro = 0
[partition1]
class_name = DISK
name = env
size_hi = 0
size_lo = 2048
user_type = 0
ro = 0
[partition2]
class_name = DISK
name = rootfs
size_hi = 0
size_lo = 475712
user_type = 0
ro = 0
[partition3]
class_name = DISK
name = rootfs2
size_hi = 0
size_lo = 475712
user_type = 0
ro = 0
;********************************************************************************************************************
; 固件包下载位置 : 把某个固件包下载到指定分区, 下载次数最大为7次
;
;[downloadi] //固件包0下载位置
; part_name = SYSDATAFS //分区名
; pkt_name = ROOTFS_000000000 //固件包名称
; verify_file = VERIFY_000000000 //校验文件名称
;
; 注:1、 downloadi 表示第i次下载固件, download 唯一, 请不要随意修改
; 2、 part_num 为分区号, 即固件下载的位置
; 3、 pkt_name 固件包名称. 最大长度为16byte, 且名称固定. 可参考"..\\ePDK\workspace\suni\liveclick\image.cfg"
; 4、 verify_file 为校验文件名称. 可参考"..\\ePDK\workspace\suni\liveclick\image.cfg"
; 5、 pkt_name 内容不填, 表示本次下载取消. verify_file内容不填, 表示不需要校验.
;
; 如:要把固件包zdisk.img, 下载在到SYSDATAFS分区里。其配置为:
; [download0]
; part_name = SYSDATAFS
; pkt_name = ROOTFS_000000000
; verify_file = VERIFY_000000000
;********************************************************************************************************************
[down_num]
down_num = 4
[download0]
part_name = bootloader
pkt_name = BOOTLOADER_00000
encrypt = 0
[download1]
part_name = env
pkt_name = ENVIROMENT_00000
encrypt = 0
[download2]
part_name = rootfs
pkt_name = ROOTFS_000000000
encrypt = 0
[download3]
part_name = rootfs2
pkt_name = ROOTFS_000000000
encrypt = 0
- image.cfg
;/**************************************************************************/
;2010-06-09
;Sam
;image>配置文件内容
;/**************************************************************************/
;主要类型 8字节字符串
[MAIN_TYPE]
ITEM_COMMON = "COMMON "
ITEM_INFO = "INFO "
ITEM_BOOTROM = "BOOTROM "
ITEM_FES = "FES "
ITEM_FET = "FET "
ITEM_FED = "FED "
ITEM_FEX = "FEX "
ITEM_BOOT = "BOOT "
ITEM_ROOTFSFAT12 = "RFSFAT12"
ITEM_ROOTFSFAT16 = "RFSFAT16"
ITEM_ROOTFSFAT32 = "FFSFAT32"
ITEM_USERFSFAT12 = "UFSFAT12"
ITEM_USERFSFAT16 = "UFSFAT16"
ITEM_USERFSFAT32 = "UFSFAT32"
ITEM_PHOENIX_SCRIPT = "PXSCRIPT"
ITEM_PHOENIX_TOOLS = "PXTOOLS "
ITEM_AUDIO_DSP = "AUDIODSP"
ITEM_VIDEO_DSP = "VIDEODSP"
ITEM_FONT = "FONT "
ITEM_FLASH_DRV = "FLASHDRV"
ITEM_OS_CORE = "OS_CORE "
ITEM_DRIVER = "DRIVER "
ITEM_PIC = "PICTURE "
ITEM_AUDIO = "AUDIO "
ITEM_VIDEO = "VIDEO "
ITEM_APPLICATION = "APP "
;子类型格式,供参考,可以另外定义,最大长度必须为16字节
[SUB_TYPE]
SUBTYPEdemo1 = "071228HWSXXXX100"
;-->071228 2007-12-28
;-->HWS hardware scan
;-->XXXX 用户定义
;-->100 version 1.00
;路径定义
[DIR_DEF]
INPUT_DIR=/home/desay/openwrt/allwinner_package/build/a13-olinuxino_livesuit
EFEX_DIR=/home/desay/openwrt/allwinner_package/allwinner-tools/livesuit/a13/eFex
;文件列表
[FILELIST]
;----------------------------------------------------maintype与subtype不可改变----------------------------------------------;
;-------------------------------公共部分---------------------------------------;
;-->固定不变的
{filename = INPUT_DIR .. "sys_config.fex", maintype = ITEM_COMMON, subtype = "SYS_CONFIG000000",},
{filename = INPUT_DIR .. "sys_config1.fex", maintype = ITEM_COMMON, subtype = "SYS_CONFIG100000",},
{filename = INPUT_DIR .. "split_xxxx.fex", maintype = ITEM_COMMON, subtype = "SPLIT_0000000000",},
;-->bootloader, enviroment, kernel, rootfs
{filename = INPUT_DIR .. "bootloader.fex", maintype = ITEM_ROOTFSFAT16, subtype = "BOOTLOADER_00000",},
{filename = INPUT_DIR .. "env.fex", maintype = ITEM_ROOTFSFAT16, subtype = "ENVIROMENT_00000",},
;{filename = INPUT_DIR .. "boot.fex", maintype = ITEM_ROOTFSFAT16, subtype = "KERNEL_000000000",},
{filename = INPUT_DIR .. "rootfs.fex", maintype = ITEM_ROOTFSFAT16, subtype = "ROOTFS_000000000",},
{filename = INPUT_DIR .. "rootfs2.fex", maintype = ITEM_ROOTFSFAT16, subtype = "ROOTFS_000000000",},
;-->boot文件
{filename = INPUT_DIR .. "boot0.bin", maintype = ITEM_BOOT, subtype = "BOOT0_0000000000",},
{filename = INPUT_DIR .. "boot1.bin", maintype = ITEM_BOOT, subtype = "BOOT1_0000000000",},
;-------------------------------usb下载部分-------------------------------------;
;-->tools文件
{filename = EFEX_DIR .. "usb/tools.fex", maintype = ITEM_PHOENIX_TOOLS, subtype = "xxxxxxxxxxxxxxxx",},
;-->fes文件
{filename = EFEX_DIR .. "usb/fes_1-1.fex", maintype = ITEM_FES, subtype = "FES_1-1000000000",},
{filename = EFEX_DIR .. "usb/fes_1-2.fex", maintype = ITEM_FES, subtype = "FES_1-2000000000",},
{filename = EFEX_DIR .. "usb/fes_2.fex", maintype = ITEM_FES, subtype = "FES_200000000000",},
{filename = EFEX_DIR .. "usb/fes.fex", maintype = ITEM_FES, subtype = "FES_000000000000",},
;-->fet文件
{filename = EFEX_DIR .. "usb/HW_scan.axf", maintype = ITEM_FET, subtype = "HW_SCAN_00000000",},
;{filename = EFEX_DIR .. "usb/HW_init.axf", maintype = ITEM_FET, subtype = "HW_INIT_00000000",},
;{filename = EFEX_DIR .. "usb/FW_scan.axf", maintype = ITEM_FET, subtype = "FW_SCAN_00000000",},
{filename = EFEX_DIR .. "usb/update_boot0.axf", maintype = ITEM_FET, subtype = "UPDATE_BOOT0_000",},
{filename = EFEX_DIR .. "usb/update_boot1.axf", maintype = ITEM_FET, subtype = "UPDATE_BOOT1_000",},
{filename = EFEX_DIR .. "usb/fet_restore.axf", maintype = ITEM_FET, subtype = "FET_RESTORE_0000",},
{filename = EFEX_DIR .. "usb/magic_cr_start.fex", maintype = ITEM_FET, subtype = "MAGIC_CRC_START_",},
{filename = EFEX_DIR .. "usb/magic_cr_end.fex", maintype = ITEM_FET, subtype = "MAGIC_CRC_EN_000",},
{filename = EFEX_DIR .. "usb/magic_de_start.fex", maintype = ITEM_FET, subtype = "MAGIC_DE_START_0",},
{filename = EFEX_DIR .. "usb/magic_de_end.fex", maintype = ITEM_FET, subtype = "MAGIC_DE_END_000",},
;-->fed文件
{filename = EFEX_DIR .. "usb/fed_nand.axf", maintype = ITEM_FED, subtype = "FED_NAND_0000000",},
;-------------------------------卡量产部分----------------------------------------;
;-->固定不变的PC使用
{filename = EFEX_DIR .. "card/cardtool.fex", maintype = "12345678", subtype = "1234567890cardtl",},
{filename = EFEX_DIR .. "card/cardscript.fex", maintype = "12345678", subtype = "1234567890script",},
;-->需要烧写到卡上的文件
{filename = INPUT_DIR .. "card_boot0.fex", maintype = "12345678", subtype = "1234567890boot_0",},
{filename = INPUT_DIR .. "card_boot1.fex", maintype = "12345678", subtype = "1234567890boot_1",},
{filename = INPUT_DIR .. "mbr.fex", maintype = "12345678", subtype = "1234567890___mbr",},
{filename = INPUT_DIR .. "dlinfo.fex", maintype = "12345678", subtype = "1234567890dlinfo",},
{filename = EFEX_DIR .. "usb/card_update_boot0.axf", maintype = ITEM_FET, subtype = "CARD_UPDATE_BOT0",},
{filename = EFEX_DIR .. "usb/card_update_boot1.axf", maintype = ITEM_FET, subtype = "CARD_UPDATE_BOT1",},
{filename = EFEX_DIR .. "usb/fed_card.axf", maintype = ITEM_FED, subtype = "CARD_FED_0000000",},
{filename = EFEX_DIR .. "usb/card_HW_scan.axf", maintype = ITEM_FET, subtype = "CARD_HW_SCAN_000",},
{filename = EFEX_DIR .. "usb/aultools.fex", maintype = "UPFLYTLS", subtype = "xxxxxxxxxxxxxxxx",},
{filename = EFEX_DIR .. "usb/aultls32.fex", maintype = "UPFLTL32", subtype = "xxxxxxxxxxxxxxxx",},
;-------------------------------其他----------------------------------------------;
;-------------------------------------------maintype与subtype不可改变-------------------------------------------------------;
;镜像配置信息
[IMAGE_CFG]
version = 0x100234 ;-->Image的版本
pid = 0x00001234 ;-->产品ID
vid = 0x00008743 ;-->供应商ID
hardwareid = 0x100 ;-->硬件ID bootrom
firmwareid = 0x100 ;-->固件ID bootrom
bootromconfig = "bootrom_071203_00001234.cfg"
rootfsconfig = "rootfs.cfg"
imagename=output/a13-olinuxino_livesuit.img
filelist = FILELIST
制作镜像
通过mk_livesuit_img.sh
脚本制作suit镜像。
% scripts/mk_livesuit_img.sh --help
Usage (linux): scripts/mk_livesuit_img.sh -R [rootfs.img] -s [system.img]
Usage (android): scripts/mk_livesuit_img.sh -b [boot.img] -s [system.img] -r [recovery.img]
笔者使用的是linux方案。对于linux,rootfs.img的文件系统格式可以根据需要而定。笔者准备使用squashfs。