1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

Meta: Add Serenity Kernel to gn build

This commit is contained in:
Andrew Kaster 2023-07-26 07:20:17 -06:00 committed by Andrew Kaster
parent f4e37c8ad4
commit 0acd87954b
9 changed files with 1169 additions and 0 deletions

View file

@ -0,0 +1,51 @@
import("//Meta/gn/build/serenity_target.gni")
import("//Meta/gn/build/sysroot.gni")
assert(current_os == "serenity")
assert(current_cpu == "x86_64")
group("Prekernel") {
deps = [ ":install_prekernel" ]
}
executable("Prekernel_bin") {
configs += [ "//Kernel:Kernel_config" ]
deps = [ "//Userland/Libraries/LibC:install_libc_headers" ]
cflags = [
"-fno-pic",
"-fno-pie",
]
ldflags = [
"-static",
"-fno-pie",
"-Wl,-T" + rebase_path("linker.ld", root_build_dir),
]
sources = [
"//Kernel//Library/MiniStdLib.cpp",
"//Userland/Libraries/LibELF/Relocation.cpp",
"UBSanitizer.cpp",
"boot.S",
"init.cpp",
"multiboot.S",
]
}
action("postprocess_prekernel") {
script = "//Meta/gn/secondary/Ladybird/invoke_process_with_args.py"
inputs = [ "$target_out_dir/Prekernel_bin" ]
outputs = [ "$target_gen_dir/Prekernel" ]
deps = [ ":Prekernel_bin" ]
args = [
"$serenity_objcopy",
"-O",
"elf32-i386",
rebase_path(inputs[0], root_build_dir),
rebase_path(outputs[0], root_build_dir),
]
}
copy("install_prekernel") {
deps = [ ":postprocess_prekernel" ]
sources = [ "$target_gen_dir/Prekernel" ]
outputs = [ "$sysroot/boot/{{source_file_part}}" ]
}