Bundle HULK in HELLO

This commit is contained in:
Josh Holtrop 2022-03-18 22:43:37 -04:00
parent 18f1bfc88f
commit f27851def9

View File

@ -17,6 +17,26 @@ end
# Kernel default font size.
KFONT_SIZE = 15
class HulkBinObj < Builder
def run(options)
File.write(@target, <<EOF)
.section ".rodata"
.balign 4096
.global hulk_start
hulk_start:
.incbin "#{@sources.first}"
.balign 4096
.global hulk_end
hulk_end:
EOF
unless @cache.up_to_date?(@target, nil, @sources, @env)
print_run_message("Creating HULK binary object <target>#{@target}<reset>", nil)
@cache.register_build(@target, nil, @sources, @env)
end
true
end
end
class Image < Builder
def run(options)
unless @cache.up_to_date?(@target, nil, @sources, @env)
@ -68,8 +88,11 @@ end
hello_env = env "hello", use: %w[ldc2 x86_64-w64-mingw32-gcc] do |env|
env.add_builder(Image)
env.add_builder(HulkBinObj)
env["sources"] = glob("src/hello/**/*.d")
env["sources"] += glob("uefi-d/source/**/*.d")
env.HulkBinObj("^/hulk_bin.S", hulk_env.expand("^/hulk.bin"))
env["sources"] << "^/hulk_bin.S"
env["DFLAGS"] += %w[-mtriple=x86_64-unknown-windows-coff --betterC -release -O3 --wi --enable-cross-module-inlining]
env["D_IMPORT_PATH"] += %w[src/hello src/hulk uefi-d/source src/common]
env["LD"] = "x86_64-w64-mingw32-gcc"