-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (34 loc) · 780 Bytes
/
Copy pathMakefile
File metadata and controls
45 lines (34 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# .PHONY:
default: build run
build: tiles.raw disk.img
run:
qemu-system-i386 \
-drive format=raw,file=disk.img
clean:
rm *.bin
rm *.img
rm raw/*.raw
load:
diskutil unmountDisk /dev/disk4
sudo dd if=disk.img of=/dev/rdisk4 bs=512 status=progress
sync
diskutil eject /dev/disk4
# 1 sector
bootloader.bin: bootloader.asm
nasm $< -o $@
# 59 sectors
kernel.bin: kernel.asm
nasm $< -o $@
truncate -s $$((512*59)) $@
# 64 sectors
source.bin: source.fs blocks.py
python3 blocks.py $< $@
truncate -s $$((512*64)) $@
disk.img: bootloader.bin kernel.bin source.bin
cat bootloader.bin kernel.bin source.bin > disk.img
tiles.raw: tiles
python3 format.py
truncate-%:
@size=$$(stat -f %z $*); \
newsize=$$(( (size + 511) / 512 * 512)); \
truncate -s $$newsize $*