Advertisement
Guest User

makefile

a guest
Sep 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 2.03 KB | None | 0 0
  1. PATH := ../local/bin:$(PATH)      # DON'T PUT THIS LINE IN ON THE LAB MACHINES!
  2.  
  3. run: disk.iso
  4.     qemu-system-i386 -m 64M -serial file:serial.txt disk.iso
  5.     cat serial.txt
  6.  
  7. disk.iso: prefix.iso bootp.iso
  8.     rm -f disk.iso
  9.     truncate -s16M disk.iso
  10.     dd if=prefix.iso of=disk.iso count=2048 conv=notrunc
  11.     dd if=bootp.iso of=disk.iso seek=2048 count=14336 conv=notrunc
  12.  
  13. # Requires root privleges, use the provided copy in the labs
  14. prefix.iso:        
  15.     sudo ./makePrefix.bash
  16.  
  17. archive.tar: initrd/init
  18.     tar cf archive.tar initrd/
  19.  
  20. archive.o: archive.tar
  21.     i686-elf-objcopy -I binary -O elf32-i386 -B i386 archive.tar archive.o
  22.  
  23. initrd/init: init.c crt0.s
  24.     i686-elf-gcc -g -o initrd/init init.c crt0.s -ffreestanding -O1 -nostdlib -w
  25.  
  26.  
  27. # Use a bash script as shell variables are awkward in make
  28. bootp.iso: kernel.bin
  29.     sudo ./makeBootp.bash
  30.  
  31. kernel.bin: linker.ld boot.o kernel.o serial.o mem.o ints.o tickhandler.o initrd.o archive.o
  32.     i686-elf-gcc -g -T linker.ld -o kernel.bin -ffreestanding -O2 -nostdlib -w boot.o kernel.o serial.o mem.o ints.o tickhandler.o initrd.o archive.o -lgcc
  33.  
  34. boot.o: boot.s
  35.     i686-elf-as boot.s -o boot.o
  36.  
  37. kernel.o: kernel.c mem.o
  38.     i686-elf-gcc -g -c kernel.c -o kernel.o mem.o -std=gnu99 -ffreestanding -O2 -w
  39.  
  40. serial.o: serial.c serial.h
  41.     i686-elf-gcc -g -c serial.c -o serial.o -std=gnu99 -ffreestanding -O2 -w
  42.  
  43. mem.o: mem.c mem.h
  44.     i686-elf-gcc -g -c mem.c -o mem.o -std=gnu99 -ffreestanding -O2 -w
  45.  
  46. ints.o: ints.c ints.h
  47.     i686-elf-gcc -g -c ints.c -o ints.o serial.o -std=gnu99 -ffreestanding -O2 -w
  48.  
  49. tickhandler.o: tickhandler.c tickhandler.h
  50.     i686-elf-gcc -g -c tickhandler.c -o tickhandler.o ints.o -std=gnu99 -ffreestanding -O2 -w
  51.  
  52. initrd.o: initrd.c initrd.h
  53.     i686-elf-gcc -g -c initrd.c -o initrd.o -std=gnu99 -ffreestanding -O2 -w
  54.  
  55. dbg: disk.iso
  56.     qemu-system-i386 -s -S disk.iso -serial file:serial.txt -monitor stdio
  57.  
  58. clean:
  59.     sudo rm -r t/*; rmdir bootploop; rmdir t; rm -f boot.o kernel.o serial.o mem.o ints.o tickhandler.o initrd.o archive.o disk.iso bootp.iso prefix.iso kernel.bin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement