Add to create custom partitions to live boot system

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I6eb71c5dded45c689400599a799eac8f38cbb0bd
This commit is contained in:
Dongjin Kim
2021-05-07 00:38:05 +09:00
parent ed97976295
commit b2e2313ed0

View File

@@ -217,6 +217,11 @@ do_create_squashfs() {
local boot_blk=$(($(du -s --block-size=512 ${boot_mnt} | cut -f1) * 12 / 10 - 1))
local blocks=$((${boot_pstart} + ${boot_blk}))
if [ -f ${TOPDIR}/custom/${CUSTOMOS}/partitions ]; then
. ${TOPDIR}/custom/${CUSTOMOS}/partitions
blocks=${TOTAL_SECTORS}
fi
echo "I: creating the disk image file '${disk}' ($((${blocks} * 512))KiB)"
dd if=/dev/zero bs=512 count=${blocks} \
| pv -s $((${blocks} * 512 * 1024))k \
@@ -225,6 +230,12 @@ do_create_squashfs() {
[ "${BASH_VERSION}" = "" ] || BACKSLASH_ESCAPE="-e"
echo "I: creating a partition table to '${disk}'"
if [ -f ${TOPDIR}/custom/${CUSTOMOS}/partitions ]; then
echo ${BACKSLASH_ESCAPE} \
$(${TOPDIR}/fdiskcmd.sh ${TOPDIR}/custom/${CUSTOMOS}/partitions) \
| fdisk ${disk} >/dev/null
fi
echo ${BACKSLASH_ESCAPE} \
"n\np\n\n${boot_pstart}\n\n" \
"w\n" | fdisk ${disk} >/dev/null
@@ -236,6 +247,10 @@ do_create_squashfs() {
echo ${LOOPBACK}
fi
if [ -f ${TOPDIR}/custom/${CUSTOMOS}/hooks/partition ]; then
. ${TOPDIR}/custom/${CUSTOMOS}/hooks/partition
fi
UUID_BOOT=$(get_uuid_by_path "/boot")
sudo mkfs.ext2 -F -L BOOT -U ${UUID_BOOT} \