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}}" ] }