BuildSystem: Add option to generate an ISO file
This creates ISO file with compressed initrd and grub files that can be live booted easily
This commit is contained in:
@@ -56,6 +56,12 @@ create_image () {
|
||||
$BANAN_SCRIPT_DIR/image.sh "$1"
|
||||
}
|
||||
|
||||
create_iso () {
|
||||
build_target all
|
||||
build_target install
|
||||
$BANAN_SCRIPT_DIR/iso.sh
|
||||
}
|
||||
|
||||
run_qemu () {
|
||||
create_image
|
||||
$BANAN_SCRIPT_DIR/qemu.sh $@
|
||||
@@ -103,6 +109,9 @@ case $1 in
|
||||
image-full)
|
||||
create_image full
|
||||
;;
|
||||
iso)
|
||||
create_iso
|
||||
;;
|
||||
qemu)
|
||||
run_qemu -serial stdio $QEMU_ACCEL
|
||||
;;
|
||||
|
||||
@@ -26,6 +26,7 @@ export BANAN_SYSROOT="$BANAN_BUILD_DIR/sysroot"
|
||||
export BANAN_FAKEROOT="$BANAN_BUILD_DIR/fakeroot-context"
|
||||
|
||||
export BANAN_DISK_IMAGE_PATH="$BANAN_BUILD_DIR/banan-os.img"
|
||||
export BANAN_ISO_PATH="$BANAN_BUILD_DIR/banan-os.iso"
|
||||
|
||||
if [[ -z $BANAN_UEFI_BOOT ]]; then
|
||||
export BANAN_UEFI_BOOT=0
|
||||
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z $BANAN_ISO_PATH ]; then
|
||||
echo "You must set the BANAN_ISO_PATH environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $BANAN_SYSROOT ]; then
|
||||
echo "You must set the BANAN_SYSROOT environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $BANAN_FAKEROOT ]; then
|
||||
echo "You must set the BANAN_FAKEROOT environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $BANAN_BUILD_DIR ]; then
|
||||
echo "You must set the BANAN_BUILD_DIR environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -u
|
||||
|
||||
iso_dir="$BANAN_BUILD_DIR/iso"
|
||||
|
||||
rm -rf "$iso_dir"
|
||||
mkdir -p "$iso_dir/boot/grub"
|
||||
|
||||
echo "Packing initrd"
|
||||
fakeroot -i "$BANAN_FAKEROOT" tar -C "$BANAN_SYSROOT" --exclude='./boot' -zcf "$iso_dir/boot/banan-os.initrd" .
|
||||
|
||||
strip -o "$iso_dir/boot/banan-os.kernel" --strip-unneeded "$BANAN_BUILD_DIR/kernel/banan-os.kernel"
|
||||
|
||||
cat > "$iso_dir/boot/grub/grub.cfg" << EOF
|
||||
insmod all_video
|
||||
menuentry "banan-os" {
|
||||
multiboot2 /boot/banan-os.kernel readonly
|
||||
module2 --nounzip /boot/banan-os.initrd
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Creating ISO"
|
||||
grub-mkrescue --compress=gz -o "$BANAN_ISO_PATH" "$iso_dir" >/dev/null
|
||||
Reference in New Issue
Block a user