test new part
This commit is contained in:
@@ -12,11 +12,9 @@ mkdir -p "${ROOTFS_DIR}"
|
|||||||
BOOT_SIZE="$((512 * 1024 * 1024))"
|
BOOT_SIZE="$((512 * 1024 * 1024))"
|
||||||
ROOT_SIZE=$(du -x --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1)
|
ROOT_SIZE=$(du -x --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1)
|
||||||
|
|
||||||
# All partition sizes and starts will be aligned to this size
|
|
||||||
ALIGN="$((4 * 1024 * 1024))"
|
ALIGN="$((4 * 1024 * 1024))"
|
||||||
ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 400 * 1024 * 1024) / 1" | bc)"
|
ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 400 * 1024 * 1024) / 1" | bc)"
|
||||||
|
|
||||||
# Recovery partition fixed size: 256MB
|
|
||||||
RECOVERY_SIZE="$((256 * 1024 * 1024))"
|
RECOVERY_SIZE="$((256 * 1024 * 1024))"
|
||||||
|
|
||||||
BOOT_PART_START=$((ALIGN))
|
BOOT_PART_START=$((ALIGN))
|
||||||
@@ -69,14 +67,22 @@ mkdosfs -n bootfs -F "$FAT_SIZE" -s 4 -v "$BOOT_DEV" > /dev/null
|
|||||||
mkdosfs -n recovery -F "16" -s 4 -v "$RECOVERY_DEV" > /dev/null
|
mkdosfs -n recovery -F "16" -s 4 -v "$RECOVERY_DEV" > /dev/null
|
||||||
mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null
|
mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null
|
||||||
|
|
||||||
mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4
|
# Create new layout
|
||||||
mkdir -p "${ROOTFS_DIR}/boot/firmware"
|
mkdir -p "${ROOTFS_DIR}/part1"
|
||||||
mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot/firmware" -t vfat
|
mkdir -p "${ROOTFS_DIR}/part2"
|
||||||
mkdir -p "${ROOTFS_DIR}/recovery"
|
|
||||||
mount -v "$RECOVERY_DEV" "${ROOTFS_DIR}/recovery" -t ext4
|
|
||||||
|
|
||||||
rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot/firmware "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
|
mount -v "$BOOT_DEV" "${ROOTFS_DIR}/part1" -t vfat
|
||||||
rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/firmware/" "${ROOTFS_DIR}/boot/firmware/"
|
mount -v "$RECOVERY_DEV" "${ROOTFS_DIR}/part2" -t ext4
|
||||||
#rsync -aHAXx "${EXPORT_ROOTFS_DIR}/recovery/" "${ROOTFS_DIR}/recovery/"
|
|
||||||
|
|
||||||
echo "Image created with boot, rootfs, and 256MB recovery partition."
|
mkdir -p "${ROOTFS_DIR}/part1/bootfs"
|
||||||
|
mkdir -p "${ROOTFS_DIR}/part1/rootfs"
|
||||||
|
mkdir -p "${ROOTFS_DIR}/part2/recovery"
|
||||||
|
|
||||||
|
mount -v "$ROOT_DEV" "${ROOTFS_DIR}/part1/rootfs" -t ext4
|
||||||
|
|
||||||
|
# Copy files
|
||||||
|
rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot/firmware "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/part1/rootfs/"
|
||||||
|
rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/firmware/" "${ROOTFS_DIR}/part1/bootfs/"
|
||||||
|
|
||||||
|
# If you have recovery files to copy, uncomment:
|
||||||
|
# rsync -aHAXx "${EXPORT_ROOTFS_DIR}/recovery/" "${ROOTFS_DIR}/part2/recovery/"
|
Reference in New Issue
Block a user