BuildSystem: Add support for building initrd image
This is nice for testing when there isn't xhci controller available or my usb stack fails :)
This commit is contained in:
parent
d5301508ec
commit
b65068dc7d
|
@ -28,6 +28,10 @@ if [[ -z $BANAN_UEFI_BOOT ]]; then
|
|||
export BANAN_UEFI_BOOT=0
|
||||
fi
|
||||
|
||||
if [[ -z $BANAN_INITRD ]]; then
|
||||
export BANAN_INITRD=0
|
||||
fi
|
||||
|
||||
if [[ -z $BANAN_BOOTLOADER ]]; then
|
||||
export BANAN_BOOTLOADER='BANAN'
|
||||
fi
|
||||
|
|
|
@ -33,9 +33,15 @@ if [ ! -b $ROOT_PARTITION ]; then
|
|||
fi
|
||||
|
||||
if sudo mount $ROOT_PARTITION $MOUNT_DIR; then
|
||||
cd $MOUNT_DIR
|
||||
sudo tar xf $BANAN_SYSROOT_TAR
|
||||
cd
|
||||
if (($BANAN_INITRD)); then
|
||||
sudo mkdir -p $MOUNT_DIR/boot
|
||||
sudo cp $BANAN_BUILD_DIR/kernel/banan-os.kernel $MOUNT_DIR/boot/banan-os.kernel
|
||||
sudo cp $BANAN_SYSROOT_TAR $MOUNT_DIR/boot/banan-os.initrd
|
||||
else
|
||||
cd $MOUNT_DIR
|
||||
sudo tar xf $BANAN_SYSROOT_TAR
|
||||
cd
|
||||
fi
|
||||
|
||||
sudo umount $MOUNT_DIR
|
||||
fi
|
||||
|
|
|
@ -44,7 +44,11 @@ install_grub_legacy() {
|
|||
--boot-directory="$mount_dir/boot" \
|
||||
$loop_dev
|
||||
sudo mkdir -p "$mount_dir/boot/grub"
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-legacy-boot.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
if (($BANAN_INITRD)); then
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-legacy-initrd.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
else
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-legacy.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
fi
|
||||
sudo umount "$mount_dir"
|
||||
}
|
||||
|
||||
|
@ -57,11 +61,20 @@ install_grub_uefi() {
|
|||
|
||||
sudo mount $partition2 "$mount_dir"
|
||||
sudo mkdir -p "$mount_dir/boot/grub"
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-uefi.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
if (($BANAN_INITRD)); then
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-uefi-initrd.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
else
|
||||
sudo cp "$BANAN_BUILD_DIR/grub-uefi.cfg" "$mount_dir/boot/grub/grub.cfg"
|
||||
fi
|
||||
sudo umount "$mount_dir"
|
||||
}
|
||||
|
||||
install_banan_legacy() {
|
||||
if (($BANAN_INITRD)); then
|
||||
echo "banan bootloader does not support initrd" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
root_disk_info=$(fdisk -x "$BANAN_DISK_IMAGE_PATH" | tr -s ' ')
|
||||
root_part_guid=$(echo "$root_disk_info" | grep "^$BANAN_DISK_IMAGE_PATH" | head -2 | tail -1 | cut -d' ' -f6)
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
menuentry "banan-os" {
|
||||
multiboot2 /boot/banan-os.kernel readonly
|
||||
module2 /boot/banan-os.initrd
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
insmod part_gpt
|
||||
insmod search_fs_uuid
|
||||
|
||||
search --no-floppy --fs-uuid --set=root <ROOT_FS>
|
||||
|
||||
insmod all_video
|
||||
|
||||
menuentry "banan-os" {
|
||||
multiboot2 /boot/banan-os.kernel readonly
|
||||
module2 /boot/banan-os.initrd
|
||||
}
|
Loading…
Reference in New Issue