Compare commits

...

2 Commits

Author SHA1 Message Date
Bananymous c50dba900d General: Update README features and environment variables 2025-07-17 21:32:53 +03:00
Bananymous 502bb4f84a BuildSystem: Add support for building initrd image
This is nice for testing when there isn't xhci controller available or
my usb stack fails :)
2025-07-17 21:25:59 +03:00
6 changed files with 37 additions and 5 deletions

View File

@ -23,7 +23,7 @@ If you want to try out DOOM, you should first enter the GUI environment using th
- [x] Basic graphical environment
- [x] Terminal emulator
- [x] Status bar
- [ ] Program launcher
- [x] Program launcher
- [ ] Some nice apps
- [x] ELF dynamic linking
- [x] copy-on-write memory
@ -118,6 +118,8 @@ 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 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 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
./bos image-full

View File

@ -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

View File

@ -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"
}
@ -62,6 +66,11 @@ install_grub_uefi() {
}
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)

View File

@ -0,0 +1,4 @@
menuentry "banan-os" {
multiboot2 /boot/banan-os.kernel readonly
module2 /boot/banan-os.initrd
}

View File

@ -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
}