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.

105 lines
2.1 KiB

.PHONY: clean all run disk kernel force_look threaded_build native_disk
HDD_ROOT := disc_root
11 months ago
DISK_FILE := disk.bin
PARTITION := /dev/nvme0n1p5
1 year ago
USED_LOOPBACK := /dev/loop2
LIMINE_INSTALL := ./limine-bootloader/limine-install-linux-x86_64
11 months ago
QEMU_PATH := qemu-system-x86_64
1 year ago
11 months ago
QEMU_COMMON_ARGS := -bios /usr/share/ovmf/OVMF.fd \
1 year ago
-m 8192 \
-M q35 \
-vga virtio \
-no-reboot -no-shutdown \
1 year ago
-D qemu.log \
11 months ago
-trace "pci_nvme_*" \
-trace "apic_*" \
11 months ago
-device nvme,drive=NVME1,serial=deadbeef \
-drive format=raw,if=none,id=NVME1,file=disk.bin \
11 months ago
11 months ago
QEMU_ARGS := -monitor stdio $(QEMU_COMMON_ARGS)
12 months ago
# -usb \
# -device usb-host \
1 year ago
11 months ago
QEMU_DEBUG_ARGS:= -no-shutdown -s -S -d int $(QEMU_COMMON_ARGS)
1 year ago
run: all
$(QEMU_PATH) $(QEMU_ARGS) -device nvme,drive=NVME2,serial=dead \
-drive format=raw,if=none,id=NVME2,file=/dev/nvme0n1
prun: kernel $(PARTITION)
1 year ago
debug: all
11 months ago
11 months ago
gdb-multiarch -x gdb_cfg
pdebug: $(PARTITION)
11 months ago
all: diskfile
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=72 of=$(DISK_FILE)
11 months ago
sudo /sbin/parted -s $(DISK_FILE) mklabel gpt
10 months ago
sudo /sbin/parted -s $(DISK_FILE) mkpart Bincows2 fat32 2048s 100%
11 months ago
sudo /sbin/parted -s $(DISK_FILE) set 1 esp on
11 months ago
diskfile: kernel $(DISK_FILE)
11 months ago
sudo losetup -P $(USED_LOOPBACK) $(DISK_FILE)
sudo mkfs.fat -F 32 $(USED_LOOPBACK)p1
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/
cd ./kernel/ && make clean
11 months ago
rm -f $(DISK_FILE)