Skip to content

Instantly share code, notes, and snippets.

@Kwpolska
Created September 24, 2016 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kwpolska/be194d3a95eb7cfbfc183902b2af2095 to your computer and use it in GitHub Desktop.
Save Kwpolska/be194d3a95eb7cfbfc183902b2af2095 to your computer and use it in GitHub Desktop.
Makefile example for Gynvael’s OSDev
floppy.bin: kernel.c stage1.asm stage2.asm
gcc kernel.c -std=c99 -nostdlib -o kernel64
strip kernel64
nasm stage1.asm
nasm stage2.asm
dd if=/dev/zero bs=1 count=$((512-$(stat --printf="%s" stage1))) >> stage1
cat stage1 stage2 kernel64 > floppy.bin
bash -c 'fsize=$$(stat --printf="%s" floppy.bin); if [[ $$(($$fsize%512)) != 0 ]]; then dd if=/dev/zero bs=1 count=$$((512-($$fsize%512))) >> floppy.bin; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment