diff options
author | Linus Groh <mail@linusgroh.de> | 2022-05-07 17:56:11 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-07 23:36:02 +0200 |
commit | 3d5645f07d74fa247323b54a84e12c13f89a7a27 (patch) | |
tree | bd1b45f82f5ec1c520de5a130d42f003b81d4811 /Meta | |
parent | 360e149c5ce99f1eadc4ed4e2da47005c9e21e1e (diff) | |
download | serenity-3d5645f07d74fa247323b54a84e12c13f89a7a27.zip |
Meta: Allow overriding the default calculated _disk_image size
By providing SERENITY_DISK_SIZE_BYTES as an environment variable, the
calculation of default value considered suitable for the size of files
and number of inodes that will be included can be sidestepped.
Diffstat (limited to 'Meta')
-rwxr-xr-x | Meta/build-image-qemu.sh | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index 594049906f..6b58ac900a 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -73,14 +73,21 @@ INODE_SIZE=128 INODE_COUNT=$(($(inode_usage "$SERENITY_SOURCE_DIR/Base") + $(inode_usage Root))) DISK_SIZE_BYTES=$((($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + INODE_COUNT) * 1024)) -# Try to use heuristics to guess a good disk size and inode count. -# The disk must notably fit: -# * Data blocks (for both files and directories), -# * Indirect/doubly indirect/triply indirect blocks, -# * Inodes and block bitmaps for each block group, -# * Plenty of extra free space and free inodes. -DISK_SIZE_BYTES=$(((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE * 2)) * 3)) -INODE_COUNT=$((INODE_COUNT * 7)) +if [ -z "$SERENITY_DISK_SIZE_BYTES" ]; then + # Try to use heuristics to guess a good disk size and inode count. + # The disk must notably fit: + # * Data blocks (for both files and directories), + # * Indirect/doubly indirect/triply indirect blocks, + # * Inodes and block bitmaps for each block group, + # * Plenty of extra free space and free inodes. + DISK_SIZE_BYTES=$(((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE * 2)) * 3)) + INODE_COUNT=$((INODE_COUNT * 7)) +else + if [ "$DISK_SIZE_BYTES" -gt "$SERENITY_DISK_SIZE_BYTES" ]; then + die "SERENITY_DISK_SIZE_BYTES is set to $SERENITY_DISK_SIZE_BYTES but required disk size is $DISK_SIZE_BYTES bytes" + fi + DISK_SIZE_BYTES="$SERENITY_DISK_SIZE_BYTES" +fi USE_EXISTING=0 |