Skip to content

Commit

Permalink
Improve OS running step
Browse files Browse the repository at this point in the history
  • Loading branch information
bagggage committed Sep 6, 2024
1 parent ab9abf9 commit 5298b48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,24 @@ By default, the build result will be located in the `.zig-out` directory. To spe

## Creating an Image

Currently, the OS relies on the third-party [BOOTBOOT](https://gitlab.com/bztsrc/bootboot) bootloader, and the `mkbootimg` utility is used to create the image. In the future, this stage is planned to be simplified and made more cross-platform. However, for now, to create an image, you need to:
Currently, the OS relies on the third-party [BOOTBOOT](https://gitlab.com/bztsrc/bootboot) bootloader, and the `bootboot/mkbootimg` utility is used to create the image. In the future, this stage is planned to be simplified and made more cross-platform. However, for now, to create an image, you need to:

- Obtain the [BOOTBOOT](https://gitlab.com/bztsrc/bootboot) binaries.
- Specify the path to the `bootboot/dist` directory by setting the `BOOTBOOT` variable in `env.sh`.
- Obtain precompiled [BOOTBOOT](https://github.com/bagggage/bootboot-bin) binaries. And unzip `mkbootimg` for your host OS.
- Specify the path to the `bootboot-bin` directory by setting the `BOOTBOOT` variable in `env.sh`.
- Run `iso.sh`.

By default, the image will be placed in the `dist` directory.

## Running

For quick OS testing and launch, it is recommended to use the [QEMU](https://www.qemu.org) emulator.
On **Windows**, you should also add the `qemu` directory in the `PATH` environment variable beforehand.

In the project's root directory, there are the `qemu.sh` and `debug.sh` scripts:

- `qemu.sh` runs a pre-built system image (by default `dist/bamos.iso`) in the emulator.
- `debug.sh` compiles, creates the image, and runs the system in the emulator.

## Details

BamOS is at an early stage of development, and many things are not yet implemented. Moreover, writing the implementation and developing the operating system architecture requires an iterative approach to find the best solutions, so some details may change, but this is all for the better.
Expand Down
26 changes: 5 additions & 21 deletions qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,10 @@ set -e
. ./env.sh

export UEFI=${THIRD_PRT}/uefi/OVMF-efi.fd
export DRIVE_IMG=nvme.img

echo $(losetup -j $DRIVE_IMG | grep -o "/dev/loop[0-9]*")

if [ -z $(echo $(losetup -j $DRIVE_IMG | grep -o "/dev/loop[0-9]*")) ]; then
sudo losetup -f $DRIVE_IMG && \
dev_loop=$(losetup -j $DRIVE_IMG | grep -o "/dev/loop[0-9]*") && \
sudo partprobe $dev_loop
fi

unset GTK_PATH
#qemu-img create -f raw ${DIST_DIR}/nvme.img 512M
#mkfs -t ext2 ${DIST_DIR}/nvme.img
qemu-system-x86_64 -enable-kvm -cpu host -bios ${UEFI} -smp cores=4 -nic none -m 64M -no-reboot \
-drive file=${DIST_DIR}/bamos.iso,media=cdrom \
-drive file=${DRIVE_IMG},if=none,id=nvm \
-device nvme,id=nvme-ctrl-0,addr=06,serial=deadbeef,drive=nvm \

# -device usb-ehci,id=ehci \

# -device nvme,id=nvme-ctrl-0,serial=deadbeef \
# -drive file=${DIST_DIR}/nvme.img,if=none,id=nvm-1 \
# -device nvme-ns,drive=nvm-1
qemu-system-x86_64 \
-enable-kvm -cpu host \
-machine q35 -smp cores=4 -m 64M \
-bios ${UEFI} -nic none -no-reboot \
-drive file=${DIST_DIR}/bamos.iso,media=cdrom \

0 comments on commit 5298b48

Please sign in to comment.