You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB
Plaintext

include_flags := "-Iinclude"
common_flags := "-werror " + include_flags
ld32 := "ld -m elf_i386"
run:
qemu-system-x86_64 \
-monitor stdio \
-no-reboot \
-m 512M \
-drive format=raw,file=disk.bin
#-bios seabios/out/bios.bin
build: build_stage_1 build_stage_2
build_stage_1:
nasm -f bin {{common_flags}} -o stage_1/stage_1.bin stage_1/main.s
build_stage_2:
nasm -f elf {{common_flags}} -o stage_2/prelude.o stage_2/prelude.s
nasm -f elf {{common_flags}} -o stage_2/main.o stage_2/main.s
nasm -f elf {{common_flags}} -o stage_2/a20.o stage_2/a20.s
{{ld32}} -m elf_i386 -T stage_2/link.ld -o stage_2/stage_2.bin stage_2/*.o
mkimg:
dd if=/dev/zero of=disk.bin bs=440 count=1 conv=notrunc
dd if=build/stage_1/s1.bin of=disk.bin conv=notrunc
dd if=build/s23.bin of=disk.bin bs=512 seek=70 conv=notrunc
# build:
# nasm -f bin -Iinclude -o boot0.bin boot0.s
# cd boot1; cargo build --release
# # nasm -f bin -Iinclude -o boot1.bin boot1.s
zero_disk:
dd if=/dev/zero of=disk.bin bs=512 count=1000
partition_disk:
parted --script disk.bin mklabel gpt
parted --script disk.bin mkpart dummy1 34s 47s
parted --script disk.bin type 1 e3c9e316-0b5c-4db8-817d-f92df00215ae
parted --script disk.bin mkpart dummy2 64s 65s
parted --script disk.bin type 2 e3c9e316-0b5c-4db8-817d-f92df00215ae
parted --script disk.bin mkpart dummy3 66s 67s
parted --script disk.bin type 3 e3c9e316-0b5c-4db8-817d-f92df00215ae
parted --script disk.bin mkpart dummy4 68s 69s
parted --script disk.bin type 4 e3c9e316-0b5c-4db8-817d-f92df00215ae
parted --script disk.bin mkpart dummy5 48s 63s
parted --script disk.bin type 5 0fc63daf-8483-4772-8e79-3d69d8477de4
# parted --script disk.bin mkpart stage2 70s 200s
parted --script disk.bin mkpart stage2 70s 900s
parted --script disk.bin type 6 fdffea69-3651-442f-a11d-88a09bf372dd