diff --git a/.gitignore b/.gitignore index 5dc6254..5266f2b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ bochslog.txt build/ kernel.elf +os.iso +blankos.iso +real/ diff --git a/README.md b/README.md index 256a3aa..de1a7cf 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,21 @@ make run This will start a new Bochs debugger instance. To proceed with the kernel execution, you will have to type `c` in the shell spawning Bochs. Serial output will be saved under the `com1.out` file, this way you can debug the kernel by viewing its log messages. To quit, type `q`. Feel free to open issues or pull requests. +## Running on real hardware + +To run the OS on real hardware, you'll first need to have a BIOS-compatible computer. Some of the new laptops with graphical "BIOSes" only support UEFI now. So make sure to get a computer that can boot into BIOS mode, **not UEFI mode**. Then, switch the boot mode to "Legacy" in your BIOS utility. + +Then, use the Makefile target `real` to build a "real"-capable ISO disk image. The image will have GRUB2 installed on it, using the `grub-mkrescue` utility (make sure to install it before) which is dependent on `xorriso` (install it too). + +Once the ISO file is generated, you can write it on a disk using this command: + +``` +sudo dd bs=4M if=blankos.iso of=/dev/sdX status=progress oflag=sync +``` + +Replace `sdX` with your USB drive name (you can find it by doing `sudo fdisk -l`). +Tada! You now have a working BlankOS USB stick. Go ahead and try it out! + ### ⚠️ Disclaimer -This is a hobbyist operating system kernel and it comes without any warranty whatsoever! It isn't capable of anything really. +This is a hobbyist operating system kernel and it comes without any warranty whatsoever! It isn't capable of anything really. Feedback and contributions are highly appreciated! diff --git a/iso/boot/kernel.elf b/iso/boot/kernel.elf index 8e0ae03..5717819 100755 Binary files a/iso/boot/kernel.elf and b/iso/boot/kernel.elf differ diff --git a/makefile b/makefile index 70cd968..cc8fb96 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -Wall -Wextra -c -I src/ +CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -Wall -Wextra -Wno-div-by-zero -c -I src/ LDFLAGS = -T link.ld -melf_i386 AS = nasm ASFLAGS = -f elf @@ -43,9 +43,14 @@ os.iso: kernel.elf -o os.iso \ iso +real: kernel.elf + mkdir -p real/boot/grub + cp kernel.elf real/boot/kernel.elf + grub-mkrescue real -o blankos.iso + run: os.iso bochs -f bochsrc.txt -q clean: - rm -rf $(OBJ_DIR) kernel.elf os.iso + rm -rf $(OBJ_DIR) kernel.elf os.iso blankos.iso real diff --git a/os.iso b/os.iso index 389c463..62255ed 100644 Binary files a/os.iso and b/os.iso differ diff --git a/src/kernel/shell.c b/src/kernel/shell.c index 9f17a0e..16a4915 100644 --- a/src/kernel/shell.c +++ b/src/kernel/shell.c @@ -17,8 +17,12 @@ void shell_install() if (strcmp(input_buffer, "help") == 0) { - printf("This is the Blank Operating System\ndesigned for fun by xamidev\n\nCommand help:\n\n\thelp - shows this message\n"); + printf("This is the Blank Operating System\ndesigned for fun by xamidev\n\nCommand help:\n\n\thelp - shows this message\n\tpanic - makes the kernel panic\n"); + } + else if (strcmp(input_buffer, "panic") == 0) + { + printf("%d", 4/0); } } -} \ No newline at end of file +}