Add: build process for real hardware

This commit is contained in:
xamidev
2024-07-22 11:07:52 +02:00
parent 5eee67a0e5
commit 01a4016f15
6 changed files with 32 additions and 5 deletions

3
.gitignore vendored
View File

@@ -2,3 +2,6 @@
bochslog.txt bochslog.txt
build/ build/
kernel.elf kernel.elf
os.iso
blankos.iso
real/

View File

@@ -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. 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 ### ⚠️ 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!

Binary file not shown.

View File

@@ -1,5 +1,5 @@
CC = gcc 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 LDFLAGS = -T link.ld -melf_i386
AS = nasm AS = nasm
ASFLAGS = -f elf ASFLAGS = -f elf
@@ -43,9 +43,14 @@ os.iso: kernel.elf
-o os.iso \ -o os.iso \
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 run: os.iso
bochs -f bochsrc.txt -q bochs -f bochsrc.txt -q
clean: clean:
rm -rf $(OBJ_DIR) kernel.elf os.iso rm -rf $(OBJ_DIR) kernel.elf os.iso blankos.iso real

BIN
os.iso

Binary file not shown.

View File

@@ -17,7 +17,11 @@ void shell_install()
if (strcmp(input_buffer, "help") == 0) 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);
} }
} }