diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-03-28 17:16:09 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-03-28 17:16:09 +0100 |
commit | acb5161d7384e6b6352c0a9f3cc067621fbf28ad (patch) | |
tree | 6b66a66927e98b84d53f97da411b58c1b7ad3c53 /sos-code-article6.75/extra/Makefile | |
parent | a8968330aff45e0b8cf278f49fa337d5fcb9bfd8 (diff) | |
download | SOS-acb5161d7384e6b6352c0a9f3cc067621fbf28ad.tar.gz SOS-acb5161d7384e6b6352c0a9f3cc067621fbf28ad.zip |
Diffstat (limited to 'sos-code-article6.75/extra/Makefile')
-rw-r--r-- | sos-code-article6.75/extra/Makefile | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sos-code-article6.75/extra/Makefile b/sos-code-article6.75/extra/Makefile new file mode 100644 index 0000000..f858aa6 --- /dev/null +++ b/sos-code-article6.75/extra/Makefile @@ -0,0 +1,40 @@ +OBJCOPY=objcopy + +all: sos_qemu.img + +-include ../.mkvars + +# The image is the simple concatenation of the boot sector and the kernel +# It may be use in bochs or on a real floppy, but NOT in qemu (see below) +sos_bsect.img: bsect.bin sos.bin + cat $^ > $@ + @echo "[31mYou can use the $@ image in bochs or on a real floppy (NOT qemu)[m" + +# For qemu, the trick is to tell it we have *more* than 1440 sectors (720kB). +# Rtherwise the qemu disk geometry will be configured to be that of a 720kB +# floppy, while our boot sector assumes it to be 1.44MB +sos_qemu.img: sos_bsect.img + # Padding with 0s after the bsect/kernel image + cat $< /dev/zero | dd of=$@ bs=1k count=1440 + @echo "[31mYou can use the $@ image in qemu, bochs, or on a real floppy[m" + +# we extract the boot sector from the main ELF binary +bsect.bin: sos_bsect.elf + $(OBJCOPY) -v -O binary -j .bootsect $< $@ + +# we extract the kernel code from the main ELF binary +sos.bin: sos_bsect.elf + $(OBJCOPY) -v -O binary -R .bootsect $< $@ + +# The main ELF binary contains the boot sector and the kernel code +# linked together (hence we deal with a SINGLE image that we split +# above) because they share some symbol definitions +sos_bsect.elf: bootsect.o compile_kernel + $(LD) --warn-common -T ./sos_bsect.lds -o $@ \ + bootsect.o $(wildcard ../hwcore/*.o ../drivers/*.o ../sos/*.o) + +compile_kernel: + $(MAKE) -C .. + +clean: + $(RM) *.img *.elf *.bin *~ *.o *.out |