Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- echo Compiling kernel...
- .\nasm.exe -f elf32 -o _kloader.o ../kernel/_kloader.asm
- .\nasm.exe -f elf32 -o gdt_flush.o ../kernel/gdt/gdt_flush.asm
- .\nasm.exe -f elf32 -o idt_stubs.o ../kernel/intman/idt_stubs.asm
- gcc.exe -fno-leading-underscore -ffreestanding -fno-builtin -c ^
- ../kernel/portio/portio.c ^
- ../kernel/pic/pic.c ^
- ../kernel/gdt/gdt.c ^
- ../kernel/intman/idt.c ^
- ../kernel/intman/intman.c ^
- ../kernel/memory/physical.c ^
- ../kernel/memory/memory.c ^
- ../kernel/kvideo/kvideo.c ^
- ../kernel/tickcounter/tickcounter.c ^
- ../kernel/serial/serial.c ^
- ../kernel/kernel.c
- echo Making linker script...
- REM base stuff
- echo STARTUP(_kloader.o) > linker.auto
- echo INPUT(portio.o) >> linker.auto
- echo INPUT(pic.o) >> linker.auto
- REM gdt
- echo INPUT(gdt_flush.o) >> linker.auto
- echo INPUT(gdt.o) >> linker.auto
- REM idt/isr/irq (interrupts)
- echo INPUT(idt_stubs.o) >> linker.auto
- echo INPUT(idt.o) >> linker.auto
- echo INPUT(intman.o) >> linker.auto
- REM phys/paging/allocator (memory)
- echo INPUT(physical.o) >> linker.auto
- echo INPUT(memory.o) >> linker.auto
- REM kernel modules
- echo INPUT(kvideo.o) >> linker.auto
- echo INPUT(tickcounter.o) >> linker.auto
- echo INPUT(serial.o) >> linker.auto
- REM kernel
- echo INPUT(kernel.o) >> linker.auto
- echo ENTRY(_kloader) >> linker.auto
- echo SECTIONS >> linker.auto
- echo { >> linker.auto
- echo .text 0x00100000 : { >> linker.auto
- echo kernel_start = .; >> linker.auto
- echo *(.text) >> linker.auto
- echo . = ALIGN(4096); >> linker.auto
- echo } >> linker.auto
- echo .data : { >> linker.auto
- echo *(.data) >> linker.auto
- echo . = ALIGN(4096); >> linker.auto
- echo } >> linker.auto
- echo .rodata : { >> linker.auto
- echo *(.rodata) >> linker.auto
- echo . = ALIGN(4096); >> linker.auto
- echo } >> linker.auto
- echo .bss : { >> linker.auto
- echo *(.bss) >> linker.auto
- echo . = ALIGN(4096); >> linker.auto
- echo kernel_end = .; >> linker.auto
- echo } >> linker.auto
- echo } >> linker.auto
- echo OUTPUT(kernel.bin) >> linker.auto
- echo Linking kernel...
- ld.exe -T linker.auto
- objcopy.exe -O binary kernel.bin
- echo Moving binary to ../_output
- move kernel.bin ../_output/KERNEL.BIN
- echo Completed, press any key to exit.
- pause >nul
- del *.o
- del linker.auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement