[KERNEL][TEST] Refactor UMKA build

git-svn-id: svn://kolibrios.org@9329 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-11-27 09:23:17 +00:00
parent d67d360b41
commit c58fcd5efe

View File

@ -173,23 +173,42 @@ def run_tests_serially(tests, root_dir):
return thread return thread
def gcc(fin, fout): def gcc(fin, fout):
command = f"gcc -m32 -std=c11 -g -O0 -D_FILE_OFFSET_BITS=64 -DNDEBUG -masm=intel -D_POSIX_C_SOURCE=200809L -Iumka -Iumka/linux -fno-pie -c {fin} -o {fout}" flags = "-m32 -std=c11 -g -O0 -masm=intel -fno-pie"
defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
include = "-Iumka -Iumka/linux"
command = f"gcc {flags} {defines} {include} -c {fin} -o {fout}"
print(command) print(command)
os.system(command) os.system(command)
def build_umka_asm():
include = "INCLUDE=\"../../programs/develop/libraries/libcrash/hash\""
flags = "-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1"
files = "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas"
memory = "-m 2000000"
os.system(f"{include} fasm {flags} {files} {memory}")
def build_umka(): def build_umka():
if not enable_umka: if not enable_umka:
return return
if os.path.exists("umka_shell"): if os.path.exists("umka_shell"):
return return
os.makedirs("umka/build", exist_ok = True) os.makedirs("umka/build", exist_ok = True)
sources = ["umka_shell.c", "shell.c", "trace.c", "trace_lbr.c", "vdisk.c", "vnet.c", "lodepng.c", "linux/pci.c", "linux/thread.c", "util.c"] sources = [ "umka_shell.c",
"shell.c",
"trace.c",
"trace_lbr.c",
"vdisk.c",
"vnet.c",
"lodepng.c",
"linux/pci.c",
"linux/thread.c",
"util.c" ]
sources = [f"umka/{f}" for f in sources] sources = [f"umka/{f}" for f in sources]
for source in sources: for source in sources:
gcc(source, f"{source}.o") gcc(source, f"{source}.o")
objects = " ".join([ f"{s}.o" for s in sources ]) objects = " ".join([ f"{s}.o" for s in sources ])
os.system(f"INCLUDE=\"../../programs/develop/libraries/libcrash/hash\" fasm -dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 umka/umka.asm umka/build/umka.o -s umka/build/umka.fas -m 2000000") build_umka_asm()
objects += (" umka/build/umka.o") objects += " umka/build/umka.o"
os.system(f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}") os.system(f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}")
def run_umka_test(test_file_path): def run_umka_test(test_file_path):