From 766cf0772e8aec2cda965f3a104a73a4e6a19f81 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 5 Dec 2023 16:16:38 +0100 Subject: [PATCH] update build script --- edk2-build.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/edk2-build.py b/edk2-build.py index cae701b..cee7541 100755 --- a/edk2-build.py +++ b/edk2-build.py @@ -53,6 +53,16 @@ def get_toolchain(cfg, build): return cfg['global']['tool'] return 'GCC5' +def get_hostarch(): + mach = os.uname().machine + if mach == 'x86_64': + return 'X64' + if mach == 'aarch64': + return 'AARCH64' + if mach == 'riscv64': + return 'RISCV64' + return 'UNKNOWN' + def get_version(cfg, silent = False): coredir = get_coredir(cfg) if version_override: @@ -191,7 +201,10 @@ def build_one(cfg, build, jobs = None, silent = False, nologs = False): if jobs: cmdline += [ '-n', jobs ] for arch in b['arch'].split(): - cmdline += [ '-a', arch ] + if arch == 'HOST': + cmdline += [ '-a', get_hostarch() ] + else: + cmdline += [ '-a', arch ] if 'opts' in b: for name in b['opts'].split(): section = 'opts.' + name @@ -362,7 +375,8 @@ def main(): type = str, action = 'append', metavar = 'DIR', help = 'location(s) of additional packages ' '(can be specified multiple times)') - parser.add_argument('-t', '--toolchain', dest = 'toolchain', type = str, metavar = 'NAME', + parser.add_argument('-t', '--toolchain', dest = 'toolchain', + type = str, metavar = 'NAME', help = 'tool chain to be used to build edk2') parser.add_argument('--version-override', dest = 'version_override', type = str, metavar = 'VERSION',