Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

62 rader
1.8 KiB

  1. #! /bin/sh
  2. ## Kernel-mode libcaca compilation script -- Sam Hocevar <sam@hocevar.net>
  3. set -x
  4. set -e
  5. MYCFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
  6. ./configure --enable-kernel --disable-doc --host i386
  7. # Compile cacademo, leave it as an object
  8. cd caca && make && cd ..
  9. cd examples && make dithering.o && cd ..
  10. cd kernel
  11. # Bootsector
  12. nasm -f bin -o bootsect.bin boot/bootsect.asm
  13. # Interruption handlers
  14. nasm -f elf -o int.o boot/int.asm
  15. ##### Boot (x86)
  16. # Stage2, loads GDT, PIC, IDT, interrupts, then calls kmain()
  17. gcc $MYCFLAGS boot/stage2.c -c
  18. # GDT installation, called by stage2
  19. gcc $MYCFLAGS boot/gdt.c -c
  20. # PIC installation, called by stage2
  21. gcc $MYCFLAGS boot/pic.c -c
  22. # IDT installation, called by stage2
  23. gcc $MYCFLAGS boot/idt.c -c
  24. # Interruptions installation, called by stage2
  25. gcc $MYCFLAGS boot/interruptions.c -c
  26. ##### Drivers
  27. # Floppy driver
  28. gcc $MYCFLAGS drivers/floppy.c -c
  29. # Processor driver
  30. gcc $MYCFLAGS drivers/processor.c -c
  31. # Keyboard handler
  32. gcc $MYCFLAGS drivers/keyboard.c -c
  33. # Memory driver
  34. gcc $MYCFLAGS drivers/memory.c -c
  35. # Programmable Interval Timer driver
  36. gcc $MYCFLAGS drivers/timer.c -c
  37. # Minimalistic libc
  38. gcc $MYCFLAGS klibc.c -c
  39. # Kernel by itself, contains cmain() which calls main()
  40. gcc $MYCFLAGS kernel.c -c
  41. # Link everything but bootsector, kernel.o MUST be at the very end
  42. ld --oformat binary -Ttext 1000 stage2.o gdt.o pic.o int.o idt.o interruptions.o keyboard.o memory.o timer.o floppy.o processor.o klibc.o kernel.o ../caca/.libs/libcaca.a -Map kernel.map -o kern.bin
  43. ls -ail kern.bin
  44. cd ..
  45. # Copy bootsector at the very beginning of the floppy (first sector/512 bytes of the image), then kernel right after
  46. cat kernel/bootsect.bin kernel/kern.bin /dev/zero | dd of=cacademo.img bs=512 count=2500