Compare commits

...

2 Commits

Author SHA1 Message Date
Bananymous 9a82de6b70 General: Update README features and environment variables 2025-07-17 21:43:13 +03:00
Bananymous 19082874ea 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:43:13 +03:00
7 changed files with 41 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] Basic graphical environment
- [x] Terminal emulator - [x] Terminal emulator
- [x] Status bar - [x] Status bar
- [ ] Program launcher - [x] Program launcher
- [ ] Some nice apps - [ ] Some nice apps
- [x] ELF dynamic linking - [x] ELF dynamic linking
- [x] copy-on-write memory - [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 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. 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
./bos image-full ./bos image-full

View File

@ -28,6 +28,10 @@ if [[ -z $BANAN_UEFI_BOOT ]]; then
export BANAN_UEFI_BOOT=0 export BANAN_UEFI_BOOT=0
fi fi
if [[ -z $BANAN_INITRD ]]; then
export BANAN_INITRD=0
fi
if [[ -z $BANAN_BOOTLOADER ]]; then if [[ -z $BANAN_BOOTLOADER ]]; then
export BANAN_BOOTLOADER='BANAN' export BANAN_BOOTLOADER='BANAN'
fi fi

View File

@ -33,9 +33,15 @@ if [ ! -b $ROOT_PARTITION ]; then
fi fi
if sudo mount $ROOT_PARTITION $MOUNT_DIR; then if sudo mount $ROOT_PARTITION $MOUNT_DIR; then
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 cd $MOUNT_DIR
sudo tar xf $BANAN_SYSROOT_TAR sudo tar xf $BANAN_SYSROOT_TAR
cd cd
fi
sudo umount $MOUNT_DIR sudo umount $MOUNT_DIR
fi fi

View File

@ -44,7 +44,11 @@ install_grub_legacy() {
--boot-directory="$mount_dir/boot" \ --boot-directory="$mount_dir/boot" \
$loop_dev $loop_dev
sudo mkdir -p "$mount_dir/boot/grub" 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" sudo umount "$mount_dir"
} }
@ -62,6 +66,11 @@ install_grub_uefi() {
} }
install_banan_legacy() { 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_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) 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
}