a cow based x86_64 operating system, using limine and stivale2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.3 KiB

9 months ago
.PHONY: clean all run disk kernel force_look threaded_build native_disk test
HDD_ROOT := disc_root
11 months ago
DISK_FILE := disk.bin
PARTITION :=/dev/nvme0n1p5
USED_LOOPBACK :=/dev/loop2
LIMINE_INSTALL := ./limine-bootloader/limine-install-linux-x86_64
12 months ago
QEMU_PATH := qemu-system-x86_64
1 year ago
12 months ago
# default: passing -g -fno-inline
# to gcc
# you can change this to
# 'release' to replace by
9 months ago
QEMU_COMMON_ARGS := -bios ./ovmf/OVMF.fd \
1 year ago
-m 8192 \
-M q35 \
-vga virtio \
-no-reboot -no-shutdown \
1 year ago
-D qemu.log \
-device nvme,drive=NVME1,serial=deadbeef \
-drive format=raw,if=none,id=NVME1,file=disk.bin \
# -trace "pci_nvme_*" \
-trace "apic_*" \
11 months ago
12 months ago
QEMU_ARGS := -monitor stdio $(QEMU_COMMON_ARGS)
12 months ago
# -usb \
# -device usb-host \
1 year ago
12 months ago
QEMU_DEBUG_ARGS:= -no-shutdown -s -S -d int $(QEMU_COMMON_ARGS)
1 year ago
run: all
9 months ago
native_disk: all
9 months ago
sudo $(QEMU_PATH) $(QEMU_ARGS) -device nvme,drive=NVME2,serial=dead \
-drive format=raw,if=none,id=NVME2,file=/dev/nvme0n1
9 months ago
all: diskfile
prun: kernel $(PARTITION)
9 months ago
test: force_look
$(MAKE) -C ./tests/
1 year ago
debug: all
# gdb -x gdb_cfg ./disk_root/boot/kernel.elf
pdebug: $(PARTITION)
11 months ago
make -j all
$(PARTITION): kernel
sudo cp -r disk_root/* /media/bincows/
11 months ago
$(DISK_FILE): kernel/entry.c
dd if=/dev/zero bs=1M count=0 seek=513 of=$(DISK_FILE)
11 months ago
sudo /sbin/parted -s $(DISK_FILE) mklabel gpt
sudo /sbin/parted -s $(DISK_FILE) mkpart Bincows fat32 0% 100%
11 months ago
sudo /sbin/parted -s $(DISK_FILE) set 1 esp on
9 months ago
diskfile: kernel $(DISK_FILE)
11 months ago
sudo losetup -P $(USED_LOOPBACK) $(DISK_FILE)
sudo /sbin/mkfs.fat -F 32 $(USED_LOOPBACK)p1 -s 8
mkdir -p img_mount
sudo mount $(USED_LOOPBACK)p1 img_mount
sudo cp -r disk_root/* img_mount/
sudo umount img_mount
sudo /sbin/losetup -d $(USED_LOOPBACK)
rm -rf img_mount
kernel: force_look
$(MAKE) -C ./kernel/ $(KERNEL_TARGET)
cd ./kernel/ && make clean
11 months ago
rm -f $(DISK_FILE)