blob: 9132a1bd640d93833fdb9be163b2e1ab609026e9 (
plain)
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
|
CC := gcc
LD := ld
all: image.bin
image.bin: boot.bin kernel.bin
cat boot.bin kernel.bin > image.bin
truncate -s 1536 image.bin
boot.bin: boot.asm gdt.asm stage1_functions.asm stage2_functions.asm switch_mode.asm
nasm boot.asm -f bin -o boot.bin
kernel.bin: kernel.o
$(LD) -o kernel.bin -Ttext 0x8000 kernel.o -m elf_i386 --oformat binary
kernel.o: kernel.c
$(CC) -m32 -ffreestanding -c -o kernel.o kernel.c
clean:
-rm -f boot.bin kernel.bin image.bin *.o
run-qemu: image.bin
qemu-system-i386 -m 16 -drive "file=image.bin,if=ide,format=raw"
run-bochs:
bochs -q -f bochs.config 'boot:floppy' 'floppya: 1_44=image.bin, status=inserted'
functions.o: functions.c
gcc -m32 -ffreestanding -c -o functions.o functions.c
|