Skip to contentSkip to conversation

edk2: update to 2023-02 stable tag

PATCH In review Gerd Hoffmann 4 participants 11 messages Mar 16, 2023 – Mar 28, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

cover edk2: update to 2023-02 stable tag

Turned out to be a bit more complicated than just "update submodule + binaries, done". One acpi test case needs a fix to not use too small numa nodes. So posting this as patch series for review first.

The patch updating the binaries will probably not make it to to the list. So for testing the the branch can be pulled here:

git://git.kraxel.org/qemu edk2-stable202302

Alternatively use "make -C roms efi" to build locally (needs cross compilers for arm, aarch64 and riscv64).

Gerd Hoffmann (6):
acpi: enable tests/data/acpi updates
bios-tables-test: use 128M numa nodes on aarch64
acpi: disable tests/data/acpi updates
edk2: update submodule to edk2-stable202302
edk2: replace build scripts
edk2: update firmware binaries

 roms/edk2-build.py                     | 380 +++++++++++++++++++++++++
 tests/qtest/bios-tables-test.c         |   6 +-
 pc-bios/README                         |   4 +-
 pc-bios/edk2-aarch64-code.fd.bz2       | Bin 1161290 -> 1508184 bytes
 pc-bios/edk2-arm-code.fd.bz2           | Bin 1161845 -> 1483149 bytes
 pc-bios/edk2-i386-code.fd.bz2          | Bin 1282120 -> 1695318 bytes
 pc-bios/edk2-i386-secure-code.fd.bz2   | Bin 1473677 -> 1922002 bytes
 pc-bios/edk2-riscv.fd.bz2              | Bin 0 -> 1096418 bytes
 pc-bios/edk2-x86_64-code.fd.bz2        | Bin 1327522 -> 1796544 bytes
 pc-bios/edk2-x86_64-microvm.fd.bz2     | Bin 1309407 -> 1697788 bytes
 pc-bios/edk2-x86_64-secure-code.fd.bz2 | Bin 1513711 -> 1999841 bytes
 roms/Makefile                          |  29 +-
 roms/Makefile.edk2                     | 178 ------------
 roms/edk2                              |   2 +-
 roms/edk2-build.config                 | 124 ++++++++
 roms/edk2-build.sh                     |  55 ----
 roms/edk2-funcs.sh                     | 273 ------------------
 tests/data/acpi/virt/SRAT.acpihmatvirt | Bin 240 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp        | Bin 1817 -> 1817 bytes
 19 files changed, 517 insertions(+), 534 deletions(-)
 create mode 100755 roms/edk2-build.py
 create mode 100644 pc-bios/edk2-riscv.fd.bz2
 delete mode 100644 roms/Makefile.edk2
 create mode 100644 roms/edk2-build.config
 delete mode 100755 roms/edk2-build.sh
 delete mode 100644 roms/edk2-funcs.sh
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/6 acpi: enable tests/data/acpi updates

---
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
index dfb8523c8bf4..b5ed0904b5ff 100644
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/SRAT.acpihmatvirt",
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/6 bios-tables-test: use 128M numa nodes on aarch64

In reply to Gerd Hoffmann

Recent edk2 versions don't boot with very small numa nodes. Bump the size from 64M to 128M.

---
 tests/qtest/bios-tables-test.c         |   6 +++---
 tests/data/acpi/virt/SRAT.acpihmatvirt | Bin 240 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp        | Bin 1817 -> 1817 bytes
 3 files changed, 3 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +3 -3
index 76d510091177..873358943784 100644
@@ -1679,9 +1679,9 @@ static void test_acpi_virt_tcg_acpi_hmat(void)
     test_acpi_one(" -machine hmat=on"
                   " -cpu cortex-a57"
                   " -smp 4,sockets=2"
-                  " -m 256M"
-                  " -object memory-backend-ram,size=64M,id=ram0"
-                  " -object memory-backend-ram,size=64M,id=ram1"
+                  " -m 384M"
+                  " -object memory-backend-ram,size=128M,id=ram0"
+                  " -object memory-backend-ram,size=128M,id=ram1"
                   " -object memory-backend-ram,size=128M,id=ram2"
                   " -numa node,nodeid=0,memdev=ram0"
                   " -numa node,nodeid=1,memdev=ram1"
tests/data/acpi/virt/SRAT.acpihmatvirt binary +0 -0
index 691ef56e34bc84509270db316d908f5979c209bb..6fe55dd7d07fef0f8fe16a209e96a89dd48ca240 100644
GIT binary patch
tests/data/acpi/virt/SSDT.memhp binary +0 -0
index 2fcfc5fda955dc4ba78a5f4116eed99ec7202fbd..ef93c44464f1fe38f7e5babd5d67f345cc6363a6 100644
GIT binary patch
Signature · 1 line
2.39.2
Reviewed-by on v1 2/6
#3 lore raw

Re: [PATCH 2/6] bios-tables-test: use 128M numa nodes on aarch64

Quoted 9 lines · On Thu, 16 Mar 2023 10:54:28 +0100 Gerd Hoffmann <[email protected]> wrote:

Recent edk2 versions don't boot with very small numa nodes. Bump the size from 64M to 128M.

---
 tests/qtest/bios-tables-test.c         |   6 +++---
 tests/data/acpi/virt/SRAT.acpihmatvirt | Bin 240 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp        | Bin 1817 -> 1817 bytes

binary blob updates should be in a separate patch

with this fixed:

Quoted 38 lines
 3 files changed, 3 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +3 -3
index 76d510091177..873358943784 100644
@@ -1679,9 +1679,9 @@ static void test_acpi_virt_tcg_acpi_hmat(void)
     test_acpi_one(" -machine hmat=on"
                   " -cpu cortex-a57"
                   " -smp 4,sockets=2"
-                  " -m 256M"
-                  " -object memory-backend-ram,size=64M,id=ram0"
-                  " -object memory-backend-ram,size=64M,id=ram1"
+                  " -m 384M"
+                  " -object memory-backend-ram,size=128M,id=ram0"
+                  " -object memory-backend-ram,size=128M,id=ram1"
                   " -object memory-backend-ram,size=128M,id=ram2"
                   " -numa node,nodeid=0,memdev=ram0"
                   " -numa node,nodeid=1,memdev=ram1"
tests/data/acpi/virt/SRAT.acpihmatvirt binary +0 -0
index 691ef56e34bc84509270db316d908f5979c209bb..6fe55dd7d07fef0f8fe16a209e96a89dd48ca240 100644
GIT binary patch
tests/data/acpi/virt/SSDT.memhp binary +0 -0
index 2fcfc5fda955dc4ba78a5f4116eed99ec7202fbd..ef93c44464f1fe38f7e5babd5d67f345cc6363a6 100644
GIT binary patch
#4 lore raw

Re: [PATCH 2/6] bios-tables-test: use 128M numa nodes on aarch64

Quoted 6 lines · Igor Mammedov
Quoted 3 lines · On Thu, 16 Mar 2023 10:54:28 +0100 Gerd Hoffmann <[email protected]> wrote:

Recent edk2 versions don't boot with very small numa nodes. Bump the size from 64M to 128M.

Quoted 7 lines
Quoted 6 lines
---
 tests/qtest/bios-tables-test.c         |   6 +++---
 tests/data/acpi/virt/SRAT.acpihmatvirt | Bin 240 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp        | Bin 1817 -> 1817 bytes

binary blob updates should be in a separate patch

Won't that break git bisect if it lands on the commit with the bios-tables-test.c change and is thus missing the corresponding blob change ?

Quoted 40 lines

with this fixed:

Quoted 35 lines
 3 files changed, 3 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +3 -3
index 76d510091177..873358943784 100644
@@ -1679,9 +1679,9 @@ static void test_acpi_virt_tcg_acpi_hmat(void)
     test_acpi_one(" -machine hmat=on"
                   " -cpu cortex-a57"
                   " -smp 4,sockets=2"
-                  " -m 256M"
-                  " -object memory-backend-ram,size=64M,id=ram0"
-                  " -object memory-backend-ram,size=64M,id=ram1"
+                  " -m 384M"
+                  " -object memory-backend-ram,size=128M,id=ram0"
+                  " -object memory-backend-ram,size=128M,id=ram1"
                   " -object memory-backend-ram,size=128M,id=ram2"
                   " -numa node,nodeid=0,memdev=ram0"
                   " -numa node,nodeid=1,memdev=ram1"
tests/data/acpi/virt/SRAT.acpihmatvirt binary +0 -0
index 691ef56e34bc84509270db316d908f5979c209bb..6fe55dd7d07fef0f8fe16a209e96a89dd48ca240 100644
GIT binary patch
tests/data/acpi/virt/SSDT.memhp binary +0 -0
index 2fcfc5fda955dc4ba78a5f4116eed99ec7202fbd..ef93c44464f1fe38f7e5babd5d67f345cc6363a6 100644
GIT binary patch
Quoted 5 lines
Quoted 3 lines

delta 22
dcmbQqH<OPmIM^jblAVEpv2i08FFVs$X8=5?1wsG-

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw

Re: [PATCH 2/6] bios-tables-test: use 128M numa nodes on aarch64

Quoted 11 lines · On Tue, 28 Mar 2023 13:09:37 +0100 Daniel P. Berrangé <[email protected]>…
Quoted 10 lines · Igor Mammedov
Quoted 6 lines · On Thu, 16 Mar 2023 10:54:28 +0100 Gerd Hoffmann <[email protected]> wrote:

Recent edk2 versions don't boot with very small numa nodes. Bump the size from 64M to 128M.

---
 tests/qtest/bios-tables-test.c         |   6 +++---  
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
 tests/data/acpi/virt/SRAT.acpihmatvirt | Bin 240 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp        | Bin 1817 -> 1817 bytes  

binary blob updates should be in a separate patch

Won't that break git bisect if it lands on the commit with the bios-tables-test.c change and is thus missing the corresponding blob change ?

nope, before change is introduced the affected blobs are white-listed (see patch 1/6 (btw it should be fixed to inl, all affected blobs)) and the patch updating blobs also may cleanup whitelist as well or do it in separate patch (but it's usually done at the same time).

The process is described in at the top of tests/qtest/bios-tables-test.c

Quoted 49 lines
Quoted 41 lines

with this fixed:

Quoted 35 lines
 3 files changed, 3 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +3 -3
index 76d510091177..873358943784 100644
@@ -1679,9 +1679,9 @@ static void test_acpi_virt_tcg_acpi_hmat(void)
     test_acpi_one(" -machine hmat=on"
                   " -cpu cortex-a57"
                   " -smp 4,sockets=2"
-                  " -m 256M"
-                  " -object memory-backend-ram,size=64M,id=ram0"
-                  " -object memory-backend-ram,size=64M,id=ram1"
+                  " -m 384M"
+                  " -object memory-backend-ram,size=128M,id=ram0"
+                  " -object memory-backend-ram,size=128M,id=ram1"
                   " -object memory-backend-ram,size=128M,id=ram2"
                   " -numa node,nodeid=0,memdev=ram0"
                   " -numa node,nodeid=1,memdev=ram1"
tests/data/acpi/virt/SRAT.acpihmatvirt binary +0 -0
index 691ef56e34bc84509270db316d908f5979c209bb..6fe55dd7d07fef0f8fe16a209e96a89dd48ca240 100644
GIT binary patch
tests/data/acpi/virt/SSDT.memhp binary +0 -0
index 2fcfc5fda955dc4ba78a5f4116eed99ec7202fbd..ef93c44464f1fe38f7e5babd5d67f345cc6363a6 100644
GIT binary patch
Quoted 5 lines
Quoted 3 lines

delta 22
dcmbQqH<OPmIM^jblAVEpv2i08FFVs$X8=5?1wsG-

With regards,
Daniel

#6 lore raw

PATCH 3/6 acpi: disable tests/data/acpi updates

In reply to Gerd Hoffmann
---
 tests/qtest/bios-tables-test-allowed-diff.h | 1 -
 1 file changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index b5ed0904b5ff..dfb8523c8bf4 100644
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/SRAT.acpihmatvirt",
Signature · 1 line
2.39.2
#7 lore raw

PATCH 4/6 edk2: update submodule to edk2-stable202302

In reply to Gerd Hoffmann
---
 pc-bios/README | 4 ++--
 roms/edk2      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
pc-bios/README +2 -2
index 3702ed485c63..c555dd324ea1 100644
@@ -50,8 +50,8 @@
   variable store templates built from the TianoCore community's EFI Development
   Kit II project
   <https://github.com/tianocore/tianocore.github.io/wiki/EDK-II>. The images
-  were built at git tag "edk2-stable202008". The firmware binaries bundle parts
-  of the OpenSSL project, at git tag "OpenSSL_1_1_1g" (the OpenSSL tag is a
+  were built at git tag "edk2-stable202302". The firmware binaries bundle parts
+  of the OpenSSL project, at git tag "OpenSSL_1_1_1s" (the OpenSSL tag is a
   function of the edk2 tag). Parts of the Berkeley SoftFloat library are
   bundled as well, at Release 3e plus a subsequent typo fix (commit
   b64af41c3276f97f0e181920400ee056b9c88037), as an OpenSSL dependency on 32-bit
roms/edk2 +1 -1
index b24306f15daa..f80f052277c8 160000
@@ -1 +1 @@
-Subproject commit b24306f15daa2ff8510b06702114724b33895d3c
+Subproject commit f80f052277c88a67c55e107b550f504eeea947d3
Signature · 1 line
2.39.2
#9 lore raw

PATCH 5/6 edk2: replace build scripts

In reply to Gerd Hoffmann

Remove Makefile.edk2 and the edk2*.sh scripts and replace them with a python script (which already handles fedora rpm builds) and a config file for it.

---
 roms/edk2-build.py     | 380 +++++++++++++++++++++++++++++++++++++++++
 roms/Makefile          |  29 +---
 roms/Makefile.edk2     | 178 -------------------
 roms/edk2-build.config | 124 ++++++++++++++
 roms/edk2-build.sh     |  55 ------
 roms/edk2-funcs.sh     | 273 -----------------------------
 6 files changed, 511 insertions(+), 528 deletions(-)
 create mode 100755 roms/edk2-build.py
 delete mode 100644 roms/Makefile.edk2
 create mode 100644 roms/edk2-build.config
 delete mode 100755 roms/edk2-build.sh
 delete mode 100644 roms/edk2-funcs.sh
roms/edk2-build.py new file +380 -0
new file mode 100755
index 000000000000..870893f7c8e3
@@ -0,0 +1,380 @@
+#!/usr/bin/python3
+"""
+build helper script for edk2, see
+https://gitlab.com/kraxel/edk2-build-config
+
+"""
+import os
+import sys
+import shutil
+import argparse
+import subprocess
+import configparser
+
+rebase_prefix    = ""
+version_override = None
+release_date     = None
+
+# pylint: disable=unused-variable
+def check_rebase():
+    """ detect 'git rebase -x edk2-build.py master' testbuilds """
+    global rebase_prefix
+    global version_override
+    gitdir = '.git'
+
+    if os.path.isfile(gitdir):
+        with open(gitdir, 'r', encoding = 'utf-8') as f:
+            (unused, gitdir) = f.read().split()
+
+    if not os.path.exists(f'{gitdir}/rebase-merge/msgnum'):
+        return
+    with open(f'{gitdir}/rebase-merge/msgnum', 'r', encoding = 'utf-8') as f:
+        msgnum = int(f.read())
+    with open(f'{gitdir}/rebase-merge/end', 'r', encoding = 'utf-8') as f:
+        end = int(f.read())
+    with open(f'{gitdir}/rebase-merge/head-name', 'r', encoding = 'utf-8') as f:
+        head = f.read().strip().split('/')
+
+    rebase_prefix = f'[ {int(msgnum/2)} / {int(end/2)} - {head[-1]} ] '
+    if msgnum != end and not version_override:
+        # fixed version speeds up builds
+        version_override = "test-build-patch-series"
+
+def get_coredir(cfg):
+    if cfg.has_option('global', 'core'):
+        return os.path.abspath(cfg['global']['core'])
+    return os.getcwd()
+
+def get_version(cfg):
+    coredir = get_coredir(cfg)
+    if version_override:
+        version = version_override
+        print('')
+        print(f'### version [override]: {version}')
+        return version
+    if os.environ.get('RPM_PACKAGE_NAME'):
+        version = os.environ.get('RPM_PACKAGE_NAME')
+        version += '-' + os.environ.get('RPM_PACKAGE_VERSION')
+        version += '-' + os.environ.get('RPM_PACKAGE_RELEASE')
+        print('')
+        print(f'### version [rpmbuild]: {version}')
+        return version
+    if os.path.exists(coredir + '/.git'):
+        cmdline = [ 'git', 'describe', '--tags', '--abbrev=8',
+                    '--match=edk2-stable*' ]
+        result = subprocess.run(cmdline, cwd = coredir,
+                                stdout = subprocess.PIPE,
+                                check = True)
+        version = result.stdout.decode().strip()
+        print('')
+        print(f'### version [git]: {version}')
+        return version
+    return None
+
+def pcd_string(name, value):
+    return f'{name}=L{value}\\0'
+
+def pcd_version(cfg):
+    version = get_version(cfg)
+    if version is None:
+        return []
+    return [ '--pcd', pcd_string('PcdFirmwareVersionString', version) ]
+
+def pcd_release_date():
+    if release_date is None:
+        return []
+    return [ '--pcd', pcd_string('PcdFirmwareReleaseDateString', release_date) ]
+
+def build_message(line, line2 = None):
+    if os.environ.get('TERM') in [ 'xterm', 'xterm-256color' ]:
+        # setxterm  title
+        start  = '\x1b]2;'
+        end    = '\x07'
+        print(f'{start}{rebase_prefix}{line}{end}', end = '')
+
+    print('')
+    print('###')
+    print(f'### {rebase_prefix}{line}')
+    if line2:
+        print(f'### {line2}')
+    print('###', flush = True)
+
+def build_run(cmdline, name, section, silent = False):
+    print(cmdline, flush = True)
+    if silent:
+        print('### building in silent mode ...', flush = True)
+        result = subprocess.run(cmdline, check = False,
+                                stdout = subprocess.PIPE,
+                                stderr = subprocess.STDOUT)
+
+        logfile = f'{section}.log'
+        print(f'### writing log to {logfile} ...')
+        with open(logfile, 'wb') as f:
+            f.write(result.stdout)
+
+        if result.returncode:
+            print('### BUILD FAILURE')
+            print('### output')
+            print(result.stdout.decode())
+            print(f'### exit code: {result.returncode}')
+        else:
+            print('### OK')
+    else:
+        result = subprocess.run(cmdline, check = False)
+    if result.returncode:
+        print(f'ERROR: {cmdline[0]} exited with {result.returncode}'
+              f' while building {name}')
+        sys.exit(result.returncode)
+
+def build_copy(plat, tgt, dstdir, copy):
+    srcdir = f'Build/{plat}/{tgt}_GCC5'
+    names = copy.split()
+    srcfile = names[0]
+    if len(names) > 1:
+        dstfile = names[1]
+    else:
+        dstfile = os.path.basename(srcfile)
+    print(f'# copy: {srcdir} / {srcfile}  =>  {dstdir} / {dstfile}')
+
+    src = srcdir + '/' + srcfile
+    dst = dstdir + '/' + dstfile
+    os.makedirs(os.path.dirname(dst), exist_ok = True)
+    shutil.copy(src, dst)
+
+def pad_file(dstdir, pad):
+    args = pad.split()
+    if len(args) < 2:
+        raise RuntimeError(f'missing arg for pad ({args})')
+    name = args[0]
+    size = args[1]
+    cmdline = [
+        'truncate',
+        '--size', size,
+        dstdir + '/' + name,
+    ]
+    print(f'# padding: {dstdir} / {name}  =>  {size}')
+    subprocess.run(cmdline, check = True)
+
+# pylint: disable=too-many-branches
+def build_one(cfg, build, jobs = None, silent = False):
+    cmdline  = [ 'build' ]
+    cmdline += [ '-t', 'GCC5' ]
+    cmdline += [ '-p', cfg[build]['conf'] ]
+
+    if (cfg[build]['conf'].startswith('OvmfPkg/') or
+        cfg[build]['conf'].startswith('ArmVirtPkg/')):
+        cmdline += pcd_version(cfg)
+        cmdline += pcd_release_date()
+
+    if jobs:
+        cmdline += [ '-n', jobs ]
+    for arch in cfg[build]['arch'].split():
+        cmdline += [ '-a', arch ]
+    if 'opts' in cfg[build]:
+        for name in cfg[build]['opts'].split():
+            section = 'opts.' + name
+            for opt in cfg[section]:
+                cmdline += [ '-D', opt + '=' + cfg[section][opt] ]
+    if 'pcds' in cfg[build]:
+        for name in cfg[build]['pcds'].split():
+            section = 'pcds.' + name
+            for pcd in cfg[section]:
+                cmdline += [ '--pcd', pcd + '=' + cfg[section][pcd] ]
+    if 'tgts' in cfg[build]:
+        tgts = cfg[build]['tgts'].split()
+    else:
+        tgts = [ 'DEBUG' ]
+    for tgt in tgts:
+        desc = None
+        if 'desc' in cfg[build]:
+            desc = cfg[build]['desc']
+        build_message(f'building: {cfg[build]["conf"]} ({cfg[build]["arch"]}, {tgt})',
+                      f'description: {desc}')
+        build_run(cmdline + [ '-b', tgt ],
+                  cfg[build]['conf'],
+                  build + '.' + tgt,
+                  silent)
+
+        if 'plat' in cfg[build]:
+            # copy files
+            for cpy in cfg[build]:
+                if not cpy.startswith('cpy'):
+                    continue
+                build_copy(cfg[build]['plat'],
+                           tgt,
+                           cfg[build]['dest'],
+                           cfg[build][cpy])
+            # pad builds
+            for pad in cfg[build]:
+                if not pad.startswith('pad'):
+                    continue
+                pad_file(cfg[build]['dest'],
+                         cfg[build][pad])
+
+def build_basetools(silent = False):
+    build_message('building: BaseTools')
+    basedir = os.environ['EDK_TOOLS_PATH']
+    cmdline = [ 'make', '-C', basedir ]
+    build_run(cmdline, 'BaseTools', 'build.basetools', silent)
+
+def binary_exists(name):
+    for pdir in os.environ['PATH'].split(':'):
+        if os.path.exists(pdir + '/' + name):
+            return True
+    return False
+
+def prepare_env(cfg):
+    """ mimic Conf/BuildEnv.sh """
+    workspace = os.getcwd()
+    packages = [ workspace, ]
+    path = os.environ['PATH'].split(':')
+    dirs = [
+        'BaseTools/Bin/Linux-x86_64',
+        'BaseTools/BinWrappers/PosixLike'
+    ]
+
+    if cfg.has_option('global', 'pkgs'):
+        for pkgdir in cfg['global']['pkgs'].split():
+            packages.append(os.path.abspath(pkgdir))
+    coredir = get_coredir(cfg)
+    if coredir != workspace:
+        packages.append(coredir)
+
+    # add basetools to path
+    for pdir in dirs:
+        p = coredir + '/' + pdir
+        if not os.path.exists(p):
+            continue
+        if p in path:
+            continue
+        path.insert(0, p)
+
+    # run edksetup if needed
+    toolsdef = coredir + '/Conf/tools_def.txt'
+    if not os.path.exists(toolsdef):
+        os.makedirs(os.path.dirname(toolsdef), exist_ok = True)
+        build_message('running BaseTools/BuildEnv')
+        cmdline = [ 'bash', 'BaseTools/BuildEnv' ]
+        subprocess.run(cmdline, cwd = coredir, check = True)
+
+    # set variables
+    os.environ['PATH'] = ':'.join(path)
+    os.environ['PACKAGES_PATH'] = ':'.join(packages)
+    os.environ['WORKSPACE'] = workspace
+    os.environ['EDK_TOOLS_PATH'] = coredir + '/BaseTools'
+    os.environ['CONF_PATH'] = coredir + '/Conf'
+    os.environ['PYTHON_COMMAND'] = '/usr/bin/python3'
+    os.environ['PYTHONHASHSEED'] = '1'
+
+    # for cross builds
+    if binary_exists('arm-linux-gnu-gcc'):
+        os.environ['GCC5_ARM_PREFIX'] = 'arm-linux-gnu-'
+    if binary_exists('loongarch64-linux-gnu-gcc'):
+        os.environ['GCC5_LOONGARCH64_PREFIX'] = 'loongarch64-linux-gnu-'
+
+    hostarch = os.uname().machine
+    if binary_exists('aarch64-linux-gnu-gcc') and hostarch != 'aarch64':
+        os.environ['GCC5_AARCH64_PREFIX'] = 'aarch64-linux-gnu-'
+    if binary_exists('riscv64-linux-gnu-gcc') and hostarch != 'riscv64':
+        os.environ['GCC5_RISCV64_PREFIX'] = 'riscv64-linux-gnu-'
+    if binary_exists('x86_64-linux-gnu-gcc') and hostarch != 'x86_64':
+        os.environ['GCC5_IA32_PREFIX'] = 'x86_64-linux-gnu-'
+        os.environ['GCC5_X64_PREFIX'] = 'x86_64-linux-gnu-'
+        os.environ['GCC5_BIN'] = 'x86_64-linux-gnu-'
+
+def build_list(cfg):
+    for build in cfg.sections():
+        if not build.startswith('build.'):
+            continue
+        name = build.lstrip('build.')
+        desc = 'no description'
+        if 'desc' in cfg[build]:
+            desc = cfg[build]['desc']
+        print(f'# {name:20s} - {desc}')
+
+def main():
+    parser = argparse.ArgumentParser(prog = 'edk2-build',
+                                     description = 'edk2 build helper script')
+    parser.add_argument('-c', '--config', dest = 'configfile',
+                        type = str, default = '.edk2.builds', metavar = 'FILE',
+                        help = 'read configuration from FILE (default: .edk2.builds)')
+    parser.add_argument('-C', '--directory', dest = 'directory', type = str,
+                        help = 'change to DIR before building', metavar = 'DIR')
+    parser.add_argument('-j', '--jobs', dest = 'jobs', type = str,
+                        help = 'allow up to JOBS parallel build jobs',
+                        metavar = 'JOBS')
+    parser.add_argument('-m', '--match', dest = 'match', type = str,
+                        help = 'only run builds matching INCLUDE (substring)',
+                        metavar = 'INCLUDE')
+    parser.add_argument('-x', '--exclude', dest = 'exclude', type = str,
+                        help = 'skip builds matching EXCLUDE (substring)',
+                        metavar = 'EXCLUDE')
+    parser.add_argument('-l', '--list', dest = 'list',
+                        action = 'store_true', default = False,
+                        help = 'list build configs available')
+    parser.add_argument('--silent', dest = 'silent',
+                        action = 'store_true', default = False,
+                        help = 'write build output to logfiles, '
+                        'write to console only on errors')
+    parser.add_argument('--core', dest = 'core', type = str, metavar = 'DIR',
+                        help = 'location of the core edk2 repository '
+                        '(i.e. where BuildTools are located)')
+    parser.add_argument('--pkg', '--package', dest = 'pkgs',
+                        type = str, action = 'append', metavar = 'DIR',
+                        help = 'location(s) of additional packages '
+                        '(can be specified multiple times)')
+    parser.add_argument('--version-override', dest = 'version_override',
+                        type = str, metavar = 'VERSION',
+                        help = 'set firmware build version')
+    parser.add_argument('--release-date', dest = 'release_date',
+                        type = str, metavar = 'DATE',
+                        help = 'set firmware build release date (in MM/DD/YYYY format)')
+    options = parser.parse_args()
+
+    if options.directory:
+        os.chdir(options.directory)
+
+    if not os.path.exists(options.configfile):
+        print('config file "{options.configfile}" not found')
+        return 1
+
+    cfg = configparser.ConfigParser()
+    cfg.optionxform = str
+    cfg.read(options.configfile)
+
+    if options.list:
+        build_list(cfg)
+        return
+
+    if not cfg.has_section('global'):
+        cfg.add_section('global')
+    if options.core:
+        cfg.set('global', 'core', options.core)
+    if options.pkgs:
+        cfg.set('global', 'pkgs', ' '.join(options.pkgs))
+
+    global version_override
+    global release_date
+    check_rebase()
+    if options.version_override:
+        version_override = options.version_override
+    if options.release_date:
+        release_date = options.release_date
+
+    prepare_env(cfg)
+    build_basetools(options.silent)
+    for build in cfg.sections():
+        if not build.startswith('build.'):
+            continue
+        if options.match and options.match not in build:
+            print(f'# skipping "{build}" (not matching "{options.match}")')
+            continue
+        if options.exclude and options.exclude in build:
+            print(f'# skipping "{build}" (matching "{options.exclude}")')
+            continue
+        build_one(cfg, build, options.jobs, options.silent)
+
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main())
roms/Makefile +7 -22
index 955f92286de0..6859685290bf 100644
@@ -126,25 +126,6 @@ build-efi-roms: build-pxe-roms
 		CROSS_COMPILE=$(x86_64_cross_prefix) \
 		$(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))
 
-# Build scripts can pass compiler/linker flags to the EDK2
-# build tools via the EDK2_BASETOOLS_OPTFLAGS (CFLAGS) and
-# EDK2_BASETOOLS_LDFLAGS (LDFLAGS) environment variables.
-#
-# Example:
-#
-#  make -C roms \
-#    EDK2_BASETOOLS_OPTFLAGS='...' \
-#    EDK2_BASETOOLS_LDFLAGS='...' \
-#    efirom
-#
-edk2-basetools:
-	cd edk2/BaseTools && git submodule update --init --force \
-		Source/C/BrotliCompress/brotli
-	$(MAKE) -C edk2/BaseTools \
-		PYTHON_COMMAND=$${EDK2_PYTHON_COMMAND:-python3} \
-		EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
-		EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
-
 slof:
 	$(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu
 	cp SLOF/boot_rom.bin ../pc-bios/slof.bin
@@ -165,8 +146,12 @@ skiboot:
 	$(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
 	cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
 
-efi: edk2-basetools
-	$(MAKE) -f Makefile.edk2
+efi:
+	python3 edk2-build.py --config edk2-build.config \
+		--version-override "edk2-stable202302-for-qemu" \
+		--release-date "03/01/2023"
+	rm -f ../pc-bios/edk2-*.fd.bz2
+	bzip2 --verbose ../pc-bios/edk2-*.fd
 
 opensbi32-generic:
 	$(MAKE) -C opensbi \
@@ -200,7 +185,7 @@ clean:
 	rm -rf u-boot/build-e500
 	$(MAKE) -C u-boot-sam460ex distclean
 	$(MAKE) -C skiboot clean
-	$(MAKE) -f Makefile.edk2 clean
+	rm -rf Build
 	$(MAKE) -C opensbi clean
 	$(MAKE) -C qboot clean
 	$(MAKE) -C vbootrom clean
roms/Makefile.edk2 deleted +0 -178

178 lines not on this page · raw message

roms/edk2-build.config new file +124 -0

124 lines not on this page · raw message

roms/edk2-build.sh deleted +0 -55

55 lines not on this page · raw message

roms/edk2-funcs.sh deleted +0 -273

273 lines not on this page · raw message

Signature · 1 line
2.39.2
#10 lore raw

PATCH 6/6 edk2: update firmware binaries

In reply to Gerd Hoffmann
---
 pc-bios/edk2-aarch64-code.fd.bz2       | Bin 1161290 -> 1508184 bytes
 pc-bios/edk2-arm-code.fd.bz2           | Bin 1161845 -> 1483149 bytes
 pc-bios/edk2-i386-code.fd.bz2          | Bin 1282120 -> 1695318 bytes
 pc-bios/edk2-i386-secure-code.fd.bz2   | Bin 1473677 -> 1922002 bytes
 pc-bios/edk2-riscv.fd.bz2              | Bin 0 -> 1096418 bytes
 pc-bios/edk2-x86_64-code.fd.bz2        | Bin 1327522 -> 1796544 bytes
 pc-bios/edk2-x86_64-microvm.fd.bz2     | Bin 1309407 -> 1697788 bytes
 pc-bios/edk2-x86_64-secure-code.fd.bz2 | Bin 1513711 -> 1999841 bytes
 8 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/edk2-riscv.fd.bz2
pc-bios/edk2-aarch64-code.fd.bz2 binary +0 -0
index 0262f5bd8f72f95e23fddebef40170887270928e..4bc824e48d969e7cd8ee30294cd71dfc0d0b083c 100644
GIT binary patch
pc-bios/edk2-arm-code.fd.bz2 binary +0 -0
index 4ca97b43eaab396eb543cc522765a6ff5ec76989..7899fca426a26f6b926acb11cc00b265665b35cd 100644
GIT binary patch
pc-bios/edk2-i386-code.fd.bz2 binary +0 -0
index 6e02c9b995b548c170c8d5797ee5f79baf0afcf3..a68ae4fa15a6562cb0a38627aed6a99453a1ab43 100644
GIT binary patch
pc-bios/edk2-i386-secure-code.fd.bz2 binary +0 -0
index a4b1cc92bdd55a53363d70551c41a2f5b52e41ca..91936ebbc9233f409b62e1f954c3893c88532b27 100644
GIT binary patch
pc-bios/edk2-riscv.fd.bz2 new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..ef566b374a8278e390c4012039809dbc47a6fc5d
GIT binary patch
pc-bios/edk2-x86_64-code.fd.bz2 binary +0 -0
index 37bfb0dbed7bc6a717755de95450753d575de963..35c2340e46d3b3ca90eff864189d12712e391152 100644
GIT binary patch
pc-bios/edk2-x86_64-microvm.fd.bz2 binary +0 -0
index 1d65c61ded38cbf810d64b78420b04b1bc2df7f6..742abf06c59be0fb9cb2deec02c8cddaa06508c0 100644
GIT binary patch
pc-bios/edk2-x86_64-secure-code.fd.bz2 binary +0 -0
index 76dc6d5aad8d54966adfa86c69b4fde2b16f1fe3..311b7b91d718a12c5cd03f95d9b3d23cd3ea6ea2 100644
GIT binary patch
Signature · 1 line
2.39.2