-
Notifications
You must be signed in to change notification settings - Fork 1
/
0_0_build_kernel.bat
57 lines (44 loc) · 1.49 KB
/
0_0_build_kernel.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
set KERNEL_NAME=\"Q-STEP\"
set KERNEL_VERSION=\"0.0.1\"
set searchPath=kernel\src\arch\x86,kernel\src,shared
set ASSEMBLER=ToolChain\fasm.exe
set COMPILER=ToolChain\fbc.exe
set CFLAGS=-c -nodeflibs -lang fb -arch 486 -i kernel/include -i shared -d KERNEL_NAME=%KERNEL_NAME% -d KERNEL_VERSION=%KERNEL_VERSION%
set LINKER=Toolchain\bin\linux\ld.exe
set AFLAGS=
set objs=
echo compile kernel objects
if not exist obj mkdir obj
if not exist bin mkdir bin
for %%t in (%searchPath%) do (
for /r %%j in (%%t\*.asm) do (
echo %ASSEMBLER% %AFLAGS% %%t\%%~nj.asm obj/%%~nj.o
%ASSEMBLER% %AFLAGS% %%t\%%~nj.asm obj/%%~nj.o
call set "objs=%%objs%% obj/%%~nj.o"
)
rem for /r %%j in (%%t\*.bas) do (
rem echo %COMPILER% %CFLAGS% %%t\%%~nj.bas -o obj/%%~nj.o
rem %COMPILER% %CFLAGS% %%t\%%~nj.bas -o obj/%%~nj.o
rem
rem call set "objs=%%objs%% obj/%%~nj.o"
rem )
)
%COMPILER% %CFLAGS% kernel\src\main.bas -o obj/main.o
call set "objs=%%objs%% obj/main.o"
echo Linking kernel...
echo %LINKER% %objs% -m elf_i386 -T kernel/kernel.ld -o bin/kernel.elf -Map=kernel.map
%LINKER% %objs% -m elf_i386 -T kernel/kernel.ld -o bin/kernel.elf -Map=kernel.map
echo compile keymaps
IF NOT EXIST bin\keymaps mkdir bin\keymaps
for /r %%j in (keymaps\*.asm) do (
echo %%~nj...
ToolChain\fasm.exe keymaps/%%~nj.asm bin/keymaps/%%~nj.map
)
echo compile resources
IF NOT EXIST bin\res mkdir bin\res
for /r %%j in (res\*.asm) do (
echo %%~nj...
ToolChain\fasm.exe res/%%~nj.asm bin/res/%%~nj.bin
)
pause