1.在 sys_partition.fex 文件里添加分区表信息
device/config/chips/r818/configs/evb1/linux/sys_partition.fex
# sys_partition.fex其中添加
[partition]
name = oem
size = 512
downloadfile = "oem_s.fex"
user_type = 0x8000
2.在 fstab 里添加挂载配置信息
target/allwinner/r818-evb1/base-files/etc/config/fstab
# fstab相应添加 , 自动挂载
config 'mount'
option target '/oem'
option device '/dev/by-name/oem'
option options 'rw,async'
option enabled '1'
3.在启动脚本里添加检测操作, 没有挂载的话就格式化再挂载
package/base-files/files/lib/preinit/79_format_partition
# 在启动脚本里添加检测操作, 没有挂载的话就格式化再挂载
# 79_format_partition 在方法do_format_filesystem()中添加
do_format_filesystem()
{
....
+ do_check_format /dev/by-name/oem
do_check_format /dev/by-name/UDISK
do_check_format /dev/by-name/rootfs_data
[ -h /dev/by-name/sec_storage ] && do_check_format /dev/by-name/sec_storage
}
4.在Makefile中添加对应的节点
package/base-files/Makefile
# 在Makefile中添加注册
mkdir -p $(1)/tmp
+ mkdir -p $(1)/oem
mkdir -p $(1)/robotdata
mkdir -p $(1)/usr/lib
5.在 script 目录下的 pack_img.sh 脚本里添加制作需要 download 的文件系统的脚本:
scripts/pack_img.sh
function make_oem_res() {
mkdir ${PACK_TOPDIR}/out/${TARGET_BOARD}/compile_dir/target/oem
cd ${ROOT_DIR}/image
local DATA_PART_NAME=oem
cp $1 sys_partition_tmp_oem.fex
sed -i '/^[ \t]*downloadfile/d' sys_partition_tmp_oem.fex
/bin/busybox unix2dos sys_partition_tmp_oem.fex
script sys_partition_tmp_oem.fex > /dev/null
update_mbr sys_partition_tmp_oem.bin 1 sunxi_mbr_tmp_oem.fex > /dev/null
local DATA_PART_DOWNLOAD_FILE=oem.fex
local DATA_PART_DOWNLOAD_FILE_SPARSE=oem_s.fex
local DATA_PART_FILE_PATH=${PACK_TOPDIR}/out/${TARGET_BOARD}/compile_dir/target/oem
local DATA_PART_SIZE_IN_SECTOR=$(parser_mbr sunxi_mbr_tmp_oem.fex get_size_by_name ${DATA_PART_NAME})
# local DATA_PART_SIZE_IN_SECTOR=`parser_mbr sunxi_mbr_tmp_oem.fex get_size_by_name ${DATA_PART_NAME}`
echo "DATA_PART_SIZE_IN_SECTOR = ${DATA_PART_SIZE_IN_SECTOR}"
if [ x${DATA_PART_DOWNLOAD_FILE} != x'' -a x${DATA_PART_SIZE_IN_SECTOR} != x'0' ]; then
let DATA_PART_SIZE_IN_K=$DATA_PART_SIZE_IN_SECTOR/2
#let DATA_PART_SIZE_IN_K=$DATA_PART_SIZE_IN_SECTOR*2
echo "PACK_TOPDIR = ${PACK_TOPDIR}"
rm -f ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE}
rm -f ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE_SPARSE}
${PACK_TOPDIR}/out/host/bin/make_ext4fs -l ${DATA_PART_SIZE_IN_K}k -b 1024 -m 0 -j 1024 ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE} ${DATA_PART_FILE_PATH}
echo "DATA_PART_SIZE_IN_K = ${DATA_PART_SIZE_IN_K}"
echo "ROOT_DIR = ${ROOT_DIR}"
echo "DATA_PART_DOWNLOAD_FILE = ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE}"
echo "DATA_PART_FILE_PATH = ${DATA_PART_FILE_PATH}"
sparse_ext4 ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE} ${ROOT_DIR}/image/${DATA_PART_DOWNLOAD_FILE_SPARSE}
else
printf "no oem resource partitions\n"
fi
cd - > /dev/null
}
# 函数写完,在下面仿照 make_data_res 添加到
make_swu_res ${ROOT_DIR}/image/sys_partition_nor.fex
make_oem_res ${ROOT_DIR}/image/sys_partition.fex
image.png
网友评论