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

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