mirror of
https://github.com/PartialVolume/shredos.x86_64.git
synced 2026-02-20 09:35:26 +00:00
Merge pull request #433 from PartialVolume/dynamically-calculate-partition-size
Dynamically calculate vfat size based on bzImage size plus 20MB
This commit is contained in:
@@ -12,7 +12,7 @@ image boot.vfat {
|
||||
file autorun.inf { image = 'autorun.inf' }
|
||||
}
|
||||
|
||||
size = 380000000
|
||||
size = 74137344
|
||||
}
|
||||
|
||||
image shredos.img {
|
||||
|
||||
@@ -23,6 +23,31 @@ cp "board/shredos/shredos.ico" "${BINARIES_DIR}/shredos.ico"
|
||||
# version.txt is used to help identify the (boot) USB disk
|
||||
cp "board/shredos/fsoverlay/etc/shredos/version.txt" "${BINARIES_DIR}/version.txt" || exit 1
|
||||
|
||||
# Determine size of FAT partition based on size of bzImage plus an arbitary 20MB to hold PDF's etc.
|
||||
BZIMAGE="${BINARIES_DIR}/bzImage"
|
||||
CFG="board/shredos/${MKIMAGE_CFG}"
|
||||
OFFSET=20000000
|
||||
|
||||
# Get bzImage size in bytes
|
||||
if [[ ! -f "$BZIMAGE" ]]; then
|
||||
echo "Error: $BZIMAGE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SIZE=$(stat -c %s "$BZIMAGE")
|
||||
NEW_SIZE=$((SIZE + OFFSET))
|
||||
|
||||
# Update size line in genimage.cfg
|
||||
if [[ ! -f "$CFG" ]]; then
|
||||
echo "Error: $CFG not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i -E "0,/^[[:space:]]*size[[:space:]]*=/{s/^[[:space:]]*size[[:space:]]*=.*/size = ${NEW_SIZE}/}" "$CFG"
|
||||
|
||||
echo "Updated size to $NEW_SIZE bytes in $CFG"
|
||||
|
||||
# Create the .img
|
||||
rm -rf "${BUILD_DIR}/genimage.tmp" || exit 1
|
||||
genimage --rootpath="${TARGET_DIR}" \
|
||||
--inputpath="${BINARIES_DIR}" \
|
||||
|
||||
@@ -6,6 +6,7 @@ BR2_TARGET_GENERIC_HOSTNAME="shredos"
|
||||
BR2_TARGET_GENERIC_ISSUE="Welcome to ShredOS https://github.com/PartialVolume/shredos.i686"
|
||||
BR2_INIT_SYSV=y
|
||||
BR2_ROOTFS_MERGED_USR=y
|
||||
BR2_SYSTEM_BIN_SH_BASH=y
|
||||
BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
# BR2_ENABLE_LOCALE_PURGE is not set
|
||||
BR2_ROOTFS_OVERLAY="board/shredos/fsoverlay"
|
||||
|
||||
Reference in New Issue
Block a user