Advertisement
captmicro

kernel build file

Aug 17th, 2011
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. @echo off
  2. echo Compiling kernel...
  3. .\nasm.exe -f elf32 -o _kloader.o ../kernel/_kloader.asm
  4. .\nasm.exe -f elf32 -o gdt_flush.o ../kernel/gdt/gdt_flush.asm
  5. .\nasm.exe -f elf32 -o idt_stubs.o ../kernel/intman/idt_stubs.asm
  6.  
  7. gcc.exe -fno-leading-underscore -ffreestanding -fno-builtin -c ^
  8. ../kernel/portio/portio.c ^
  9. ../kernel/pic/pic.c ^
  10. ../kernel/gdt/gdt.c ^
  11. ../kernel/intman/idt.c ^
  12. ../kernel/intman/intman.c ^
  13. ../kernel/memory/physical.c ^
  14. ../kernel/memory/memory.c ^
  15. ../kernel/kvideo/kvideo.c ^
  16. ../kernel/tickcounter/tickcounter.c ^
  17. ../kernel/serial/serial.c ^
  18. ../kernel/kernel.c
  19.  
  20. echo Making linker script...
  21.  
  22. REM base stuff
  23. echo STARTUP(_kloader.o) > linker.auto
  24. echo INPUT(portio.o) >> linker.auto
  25. echo INPUT(pic.o) >> linker.auto
  26. REM gdt
  27. echo INPUT(gdt_flush.o) >> linker.auto
  28. echo INPUT(gdt.o) >> linker.auto
  29. REM idt/isr/irq (interrupts)
  30. echo INPUT(idt_stubs.o) >> linker.auto
  31. echo INPUT(idt.o) >> linker.auto
  32. echo INPUT(intman.o) >> linker.auto
  33. REM phys/paging/allocator (memory)
  34. echo INPUT(physical.o) >> linker.auto
  35. echo INPUT(memory.o) >> linker.auto
  36. REM kernel modules
  37. echo INPUT(kvideo.o) >> linker.auto
  38. echo INPUT(tickcounter.o) >> linker.auto
  39. echo INPUT(serial.o) >> linker.auto
  40. REM kernel
  41. echo INPUT(kernel.o) >> linker.auto
  42.  
  43. echo ENTRY(_kloader) >> linker.auto
  44. echo SECTIONS >> linker.auto
  45. echo { >> linker.auto
  46. echo .text 0x00100000 : { >> linker.auto
  47. echo kernel_start = .; >> linker.auto
  48. echo *(.text) >> linker.auto
  49. echo . = ALIGN(4096); >> linker.auto
  50. echo } >> linker.auto
  51. echo .data : { >> linker.auto
  52. echo *(.data) >> linker.auto
  53. echo . = ALIGN(4096); >> linker.auto
  54. echo } >> linker.auto
  55. echo .rodata : { >> linker.auto
  56. echo *(.rodata) >> linker.auto
  57. echo . = ALIGN(4096); >> linker.auto
  58. echo } >> linker.auto
  59. echo .bss : { >> linker.auto
  60. echo *(.bss) >> linker.auto
  61. echo . = ALIGN(4096); >> linker.auto
  62. echo kernel_end = .; >> linker.auto
  63. echo } >> linker.auto
  64. echo } >> linker.auto
  65. echo OUTPUT(kernel.bin) >> linker.auto
  66.  
  67. echo Linking kernel...
  68. ld.exe -T linker.auto
  69. objcopy.exe -O binary kernel.bin
  70. echo Moving binary to ../_output
  71. move kernel.bin ../_output/KERNEL.BIN
  72. echo Completed, press any key to exit.
  73. pause >nul
  74. del *.o
  75. del linker.auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement