rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | CHROME_DIR_IMAGE_SIZE ?= "${MKUBIFS_CHROME_IMAGE_SZ}" |
| 2 | CHROME_EXT4_IMAGE_SIZE ?= "${CHROME_IMAGE_SZ}" |
| 3 | CHROME_DIR_IMAGE_PATH = "${DEPLOY_DIR_IMAGE}/chrome" |
| 4 | CHROME_DIR_CONTENT = "${IMAGE_ROOTFS}/../chrome" |
| 5 | |
| 6 | IMAGE_FSTYPES_NO_WHITESPACE="$(echo "${IMAGE_FSTYPES}" | tr -d '[:space:]')" |
| 7 | CHROME_FS_PARTITION = "chrome_fs.ubi" |
| 8 | CHROME_PARTITION = "chrome.ubi" |
| 9 | CHROME_PARTITION_EXT4 = "chrome.ext4" |
| 10 | |
| 11 | mk_chrome_image() { |
| 12 | |
| 13 | mkdir -p ${CHROME_DIR_CONTENT}/tmp |
| 14 | mkdir -p ${CHROME_DIR_CONTENT}/etc |
| 15 | mkdir -p ${CHROME_DIR_CONTENT}/var |
| 16 | |
| 17 | install -d ${IMAGE_ROOTFS}/chrome |
| 18 | for i in ${CHROME_DIR_CONTENT}; do |
| 19 | CHROME_DIR_FILE_PATH=${CHROME_DIR_IMAGE_PATH}/${i##${CHROME_DIR_CONTENT}} |
| 20 | install -d ${CHROME_DIR_FILE_PATH} |
| 21 | if [ "$(ls -A ${i})" ]; then |
| 22 | cp -a ${i}/* ${CHROME_DIR_FILE_PATH} |
| 23 | else |
| 24 | echo "${i} is empty" |
| 25 | fi |
| 26 | done |
| 27 | |
| 28 | if test "${IMAGE_FSTYPES_NO_WHITESPACE}" = "ubi"; then |
| 29 | echo \[ubifs\] > ubinize.cfg |
| 30 | echo mode=ubi >> ubinize.cfg |
| 31 | echo image=${CHROME_FS_PARTITION} >> ubinize.cfg |
| 32 | echo vol_id=0 >> ubinize.cfg |
| 33 | echo vol_size=${MKUBIFS_CHROME_VOL_SZ} |
| 34 | echo vol_type=dynamic >> ubinize.cfg |
| 35 | echo vol_name=chrome >> ubinize.cfg |
| 36 | echo vol_flags=autoresize >> ubinize.cfg |
| 37 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${CHROME_FS_PARTITION} seek=${CHROME_DIR_IMAGE_SIZE} count=0 bs=1k |
| 38 | mkfs.ubifs -r ${CHROME_DIR_FILE_PATH} ${MKUBIFS_CHROME_ARGS} -o ${CHROME_FS_PARTITION} |
| 39 | #ubinize -o ${CHROME_PARTITION} -m 2048 -p 128KiB -s 2048 ubinize.cfg |
| 40 | ubinize -o ${CHROME_PARTITION} ${UBINIZE_ARGS} ubinize.cfg |
| 41 | cp ${CHROME_PARTITION} ${DEPLOY_DIR_IMAGE}/${CHROME_PARTITION} |
| 42 | elif test "${IMAGE_FSTYPES_NO_WHITESPACE}" = "ext4"; then |
| 43 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${CHROME_PARTITION_EXT4} seek=${CHROME_EXT4_IMAGE_SIZE} count=${CHROME_IMAGE_CNT} bs=1k |
| 44 | mkfs.ext4 -F -i 4096 ${DEPLOY_DIR_IMAGE}/${CHROME_PARTITION_EXT4} -d ${CHROME_DIR_IMAGE_PATH} |
| 45 | else |
| 46 | echo "No method to make ${IMAGE_FSTYPES_NO_WHITESPACE} type state image" |
| 47 | fi |
| 48 | } |
| 49 | |
| 50 | ROOTFS_POSTPROCESS_COMMAND += " mk_chrome_image;" |
| 51 | |
| 52 | |