Cleanup make files

This commit is contained in:
Baptiste Wicht 2013-12-31 16:44:04 +01:00
parent 3664d4f6a0
commit 68c26a741b
4 changed files with 10 additions and 37 deletions

View File

@ -1,20 +1,17 @@
.PHONY: default clean force_look qemu bochs debug sectors
.PHONY: default clean force_look qemu bochs debug
default: thor.flp
kernel/kernel.bin: force_look
cd kernel; $(MAKE)
filler.bin: kernel/kernel.bin
bash fill.bash
bootloader/stage1.bin: force_look
cd bootloader; $(MAKE) stage1.bin
sectors: force_look filler.bin
cd bootloader; $(MAKE) sectors
bootloader/stage2.bin: force_look
cd bootloader; $(MAKE) stage2.bin
bootloader/bootloader.bin: force_look sectors
cd bootloader; $(MAKE)
thor.flp: bootloader/bootloader.bin
thor.flp: bootloader/stage1.bin bootloader/stage2.bin kernel/kernel.bin
dd if=bootloader/stage1.bin of=hdd.img conv=notrunc
dd if=bootloader/stage2.bin of=hdd.img seek=1 conv=notrunc
sudo /sbin/losetup -o1048576 /dev/loop0 hdd.img

View File

@ -1,23 +1,14 @@
default: bootloader.bin
default: all
.PHONY: sectors clean
sectors:
bash compute_sectors.bash
.PHONY: all clean
stage1.bin: stage1.asm
nasm -w+all -f bin -o stage1.bin stage1.asm
stage2.bin: stage2.asm sectors.asm
stage2.bin: stage2.asm
nasm -w+all -f bin -o stage2.bin stage2.asm
#padding.bin:
# dd if=/dev/zero of=padding.bin bs=512 count=34
bootloader.bin: stage1.bin stage2.bin
cat stage1.bin > bootloader.bin
cat stage2.bin >> bootloader.bin
# cat padding.bin >> bootloader.bin
all: stage1.bin stage2.bin
clean:
rm -f stage1.bin

View File

@ -1,9 +0,0 @@
#!/bin/bash
size_1=`stat -c%s ../kernel/kernel.bin`
size_2=`stat -c%s ../filler.bin`
total_size=$(( $size_1 + $size_2 ))
sectors=$(( $total_size / 512 ))
echo "sectors equ $sectors" > sectors.asm

View File

@ -1,6 +0,0 @@
#!/bin/bash
size=`stat -c%s kernel/kernel.bin`
better_size=$(( ($size / 512 + 1) * 512 ))
let filler_size=$better_size-$size
dd if=/dev/zero of=filler.bin bs=1 count=$filler_size