You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
2.0 KiB

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