BuildSystem: Allow building compressed initrd

Building with BANAN_INITRD=2 will now compress using gzip!
This commit is contained in:
2026-06-25 22:43:47 +03:00
parent 92d10f612e
commit 5aea95129e
2 changed files with 7 additions and 4 deletions

View File

@@ -118,7 +118,7 @@ To change the bootloader you can set environment variable BANAN\_BOOTLOADER; sup
To run with UEFI set environment variable BANAN\_UEFI\_BOOT=1. You will also have to set OVMF\_PATH to the correct OVMF (default */usr/share/ovmf/x64/OVMF.fd*). To run with UEFI set environment variable BANAN\_UEFI\_BOOT=1. You will also have to set OVMF\_PATH to the correct OVMF (default */usr/share/ovmf/x64/OVMF.fd*).
To build an image with no physical root filesystem, but an initrd set environment variable BANAN\_INITRD=1. This can be used when testing on hardware with unsupported USB controller. To build an image with no physical root filesystem, but an initrd set environment variable BANAN\_INITRD=1. This can be used when testing on hardware with unsupported USB controller. If BANAN\_INITRD is set to a value larger than 1, initrd will be gzip compressed.
If you have corrupted your disk image or want to create new one, you can either manually delete *build/banan-os.img* and build system will automatically create you a new one or you can run the following command. If you have corrupted your disk image or want to create new one, you can either manually delete *build/banan-os.img* and build system will automatically create you a new one or you can run the following command.
```sh ```sh

View File

@@ -39,11 +39,14 @@ fi
if sudo mount "$ROOT_PARTITION" "$MOUNT_DIR"; then if sudo mount "$ROOT_PARTITION" "$MOUNT_DIR"; then
if (($BANAN_INITRD)); then if (($BANAN_INITRD)); then
fakeroot -i "$BANAN_FAKEROOT" tar -C "$BANAN_SYSROOT" -cf "$BANAN_SYSROOT.initrd" . INITRD_FILE="$BANAN_BUILD_DIR/banan-os.initrd"
(($BANAN_INITRD > 1)) && COMPRESS_FLAGS='-z' || COMPRESS_FLAGS=''
fakeroot -i "$BANAN_FAKEROOT" tar -C "$BANAN_SYSROOT" --exclude='./boot' $COMPRESS_FLAGS -cf "$INITRD_FILE" .
sudo mkdir -p "$MOUNT_DIR/boot" sudo mkdir -p "$MOUNT_DIR/boot"
sudo cp "$BANAN_BUILD_DIR/kernel/banan-os.kernel" "$MOUNT_DIR/boot/banan-os.kernel" sudo strip -o "$MOUNT_DIR/boot/banan-os.kernel" --strip-unneeded "$BANAN_BUILD_DIR/kernel/banan-os.kernel"
sudo mv "$BANAN_SYSROOT.initrd" "$MOUNT_DIR/boot/banan-os.initrd" sudo cp "$INITRD_FILE" "$MOUNT_DIR/boot/banan-os.initrd"
else else
sudo rsync -rulHpt "$BANAN_SYSROOT/" "$MOUNT_DIR" sudo rsync -rulHpt "$BANAN_SYSROOT/" "$MOUNT_DIR"