increased the default boot partition size to 96MB (from 64MB) for multi-partition fs targets

This commit is contained in:
5kft
2019-08-16 21:44:01 -07:00
parent 7ab8d6288d
commit 7a2bf78e10
2 changed files with 18 additions and 8 deletions

View File

@@ -328,30 +328,33 @@ prepare_partitions()
mountopts[btrfs]=',commit=600,compress=lzo'
# mountopts[nfs] is empty
# default BOOTSIZE to use if not specified
DEFAULT_BOOTSIZE=96 # MiB
# stage: determine partition configuration
if [[ -n $BOOTFS_TYPE ]]; then
# 2 partition setup with forced /boot type
local bootfs=$BOOTFS_TYPE
local bootpart=1
local rootpart=2
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=64 # MiB
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
elif [[ $ROOTFS_TYPE != ext4 && $ROOTFS_TYPE != nfs ]]; then
# 2 partition setup for non-ext4 local root
local bootfs=ext4
local bootpart=1
local rootpart=2
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=64 # MiB
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
elif [[ $ROOTFS_TYPE == nfs ]]; then
# single partition ext4 /boot, no root
local bootfs=ext4
local bootpart=1
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=64 # MiB, For cleanup processing only
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE} # For cleanup processing only
elif [[ $CRYPTROOT_ENABLE == yes ]]; then
# 2 partition setup for encrypted /root and non-encrypted /boot
local bootfs=ext4
local bootpart=1
local rootpart=2
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=64 # MiB
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
else
# single partition ext4 root
local rootpart=1

View File

@@ -459,12 +459,19 @@ format_emmc()
if [[ $eMMCFilesystemChoosen == "f2fs" ]]; then
partedFsType=''
fi
# default boot partition size, in MiB
DEFAULT_BOOTSIZE=96
# (convert to sectors for partitioning)
DEFAULT_BOOTSIZE_SECTORS=$(((${DEFAULT_BOOTSIZE} * 1024 * 1024) / 512))
# check whether swap is currently defined and a new swap partition is needed
grep -q swap /etc/fstab
case $? in
0)
parted -s "$1" -- mkpart primary $partedFsType ${FIRSTSECTOR}s $(( ${FIRSTSECTOR} + 131071 ))s
parted -s "$1" -- mkpart primary $partedFsType $(( ${FIRSTSECTOR} + 131072 ))s $(( ${FIRSTSECTOR} + 393215 ))s
parted -s "$1" -- mkpart primary $partedFsType ${FIRSTSECTOR}s $(( ${FIRSTSECTOR} + ${DEFAULT_BOOTSIZE_SECTORS} - 1 ))s
parted -s "$1" -- mkpart primary $partedFsType $(( ${FIRSTSECTOR} + ${DEFAULT_BOOTSIZE_SECTORS} ))s $(( ${FIRSTSECTOR} + 393215 ))s
parted -s "$1" -- mkpart primary $partedFsType $(( ${FIRSTSECTOR} + 393216 ))s ${LASTSECTOR}s
partprobe "$1"
mkfs.ext4 ${mkopts[ext4]} "$1"'p1' >> $logfile 2>&1
@@ -476,8 +483,8 @@ format_emmc()
dest_root=$emmccheck'p3'
;;
*)
parted -s "$1" -- mkpart primary $partedFsType ${FIRSTSECTOR}s $(( ${FIRSTSECTOR} + 131071 ))s
parted -s "$1" -- mkpart primary $partedFsType $(( ${FIRSTSECTOR} + 131072 ))s ${LASTSECTOR}s
parted -s "$1" -- mkpart primary $partedFsType ${FIRSTSECTOR}s $(( ${FIRSTSECTOR} + ${DEFAULT_BOOTSIZE_SECTORS} - 1 ))s
parted -s "$1" -- mkpart primary $partedFsType $(( ${FIRSTSECTOR} + ${DEFAULT_BOOTSIZE_SECTORS} ))s ${LASTSECTOR}s
partprobe "$1"
mkfs.ext4 ${mkopts[ext4]} "$1"'p1' >> $logfile 2>&1
mkfs.${eMMCFilesystemChoosen} "$1"'p2' ${mkopts[$eMMCFilesystemChoosen]} >> $logfile 2>&1