Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- echo Compiling kernel...
- REM ASSEMBLY FILES
- .\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
- REM C FILES
- gcc.exe -fno-leading-underscore -mno-stack-arg-probe ^
- -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/envvar/envvar.c ^
- ../kernel/vmem/vmem.c ^
- ../kernel/tickcounter/tickcounter.c ^
- ../kernel/serial/serial.c ^
- ../kernel/kvideo/kvideo.c ^
- ^
- ../kernel/dev/dev.c ^
- ../kernel/dev/kb/kb.c ^
- ^
- ../kernel/apps/term/term.c ^
- ../kernel/apps/xedit/xedit.c ^
- ^
- ../kernel/kernel.c
- echo Making linker script...
- REM base
- echo STARTUP(_kloader.o) > linker.auto
- REM c library
- echo INPUT(../kernel/mylib/_mylib_min.o) >> linker.auto
- REM base modules
- echo INPUT(portio.o) >> linker.auto
- echo INPUT(pic.o) >> linker.auto
- echo INPUT(gdt_flush.o) >> linker.auto
- echo INPUT(gdt.o) >> linker.auto
- echo INPUT(idt_stubs.o) >> linker.auto
- echo INPUT(idt.o) >> linker.auto
- echo INPUT(intman.o) >> linker.auto
- REM kernel modules
- echo INPUT(envvar.o) >> linker.auto
- echo INPUT(vmem.o) >> linker.auto
- echo INPUT(tickcounter.o) >> linker.auto
- echo INPUT(serial.o) >> linker.auto
- echo INPUT(kvideo.o) >> linker.auto
- REM dev-like (/dev)
- echo INPUT(dev.o) >> linker.auto
- echo INPUT(kb.o) >> linker.auto
- REM applications
- echo INPUT(term.o) >> linker.auto
- echo INPUT(xedit.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