mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 15:05:07 +00:00

This script was already used by both Ladybird and the Kernel, so move it into Meta/gn/build instead.
51 lines
1.2 KiB
Text
51 lines
1.2 KiB
Text
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/build/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}}" ]
|
|
}
|