Skip to contentSkip to conversation

Dockerfile: Build coreboot from source

PATCH In review Tom Rini 1 participant 5 messages Feb 13, 2024 – Feb 28, 2024

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/3 Dockerfile: Build coreboot from source

To make CI runs rely less on external servers, build a coreboot release from source and populate /opt/coreboot with the output.

---
 tools/docker/Dockerfile | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/docker/Dockerfile +11 -0
index 6122776bc64d..3d044657406e 100644
@@ -231,6 +231,17 @@ RUN mkdir /tmp/trace && \
     sudo make install && \
     rm -rf /tmp/trace
 
+# Build coreboot
+RUN wget -O - https://coreboot.org/releases/coreboot-4.22.01.tar.xz | tar -C /tmp -xJ && \
+    cd /tmp/coreboot-4.22.01 && \
+    make crossgcc-i386 CPUS=$(nproc) && \
+    make -C payloads/coreinfo olddefconfig && \
+    make -C payloads/coreinfo && \
+    make olddefconfig && \
+    make -j $(nproc) && \
+    sudo mkdir /opt/coreboot && \
+    sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/
+
 # Create our user/group
 RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
 RUN useradd -m -U uboot
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/3 CI: Switch to using coreboot from our image

Instead of downloading coreboot binaries from a Google drive location, use the ones we have built ourselves.

---
 .azure-pipelines.yml |  7 +++----
 .gitlab-ci.yml       | 11 +++--------
 2 files changed, 6 insertions(+), 12 deletions(-)
.azure-pipelines.yml +3 -4
index e2646783ee62..aebcc8908687 100644
@@ -236,10 +236,9 @@ stages:
               cp images/spi-nor.img \${UBOOT_TRAVIS_BUILD_DIR}/;
           fi
           if [[ "\${TEST_PY_BD}" == "coreboot" ]]; then
-              wget -O - "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |xz -dc >\${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
-              wget -O - "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >cbfstool;
-              chmod a+x cbfstool;
-              ./cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
+              cp /opt/coreboot/coreboot.rom \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
+              /opt/coreboot/cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom remove -n fallback/payload;
+              /opt/coreboot/cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
           fi
           virtualenv -p /usr/bin/python3 /tmp/venv
           . /tmp/venv/bin/activate
.gitlab-ci.yml +3 -8
index 278a2e2bbf31..66f3cb14b03a 100644
@@ -70,14 +70,9 @@ stages:
         cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
       fi
     - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
-        wget -O -
-          "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |
-          xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
-        wget -O -
-          "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >
-          cbfstool;
-        chmod a+x cbfstool;
-        ./cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
+        cp /opt/coreboot/coreboot.rom ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
+        /opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom remove -n fallback/payload;
+        /opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
       fi
     - virtualenv -p /usr/bin/python3 /tmp/venv
     - . /tmp/venv/bin/activate
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 3/3 CI: Move to latest container image

In reply to Tom Rini

This moves us to our latest container image, which is now based on the current "Jammy" tag.

---
 .azure-pipelines.yml    | 2 +-
 .gitlab-ci.yml          | 2 +-
 tools/docker/Dockerfile | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
.azure-pipelines.yml +1 -1
index aebcc8908687..7c3172610ee6 100644
@@ -2,7 +2,7 @@ variables:
   windows_vm: windows-2019
   ubuntu_vm: ubuntu-22.04
   macos_vm: macOS-12
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240111-17Jan2024
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240125-12Feb2024
   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
   # since our $(ci_runner_image) user is not root.
.gitlab-ci.yml +1 -1
index 66f3cb14b03a..6ab3bb5ec2aa 100644
@@ -10,7 +10,7 @@ default:
 
 # Grab our configured image.  The source for this is found
 # in the u-boot tree at tools/docker/Dockerfile
-image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240111-17Jan2024
+image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240125-12Feb2024
 
 # We run some tests in different order, to catch some failures quicker.
 stages:
tools/docker/Dockerfile +1 -1
index 3d044657406e..274255456619 100644
@@ -2,7 +2,7 @@
 # This Dockerfile is used to build an image containing basic stuff to be used
 # to build U-Boot and run our test suites.
 
-FROM ubuntu:jammy-20240111
+FROM ubuntu:jammy-20240125
 MAINTAINER Tom Rini <[email protected]>
 LABEL Description=" This image is for building U-Boot inside a container"
 
Signature · 1 line
2.34.1
author
#3 lore raw
In reply to Tom Rini
Quoted 16 lines · Tom Rini

To make CI runs rely less on external servers, build a coreboot release from source and populate /opt/coreboot with the output.

---
 tools/docker/Dockerfile | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/docker/Dockerfile +0 -0
index 6122776bc64d..3d044657406e 100644
@@ -231,6 +231,17 @@ RUN mkdir /tmp/trace && \
     sudo make install && \
     rm -rf /tmp/trace
 

tools/docker/Dockerfile RUN mkdir /tmp/trace && \ · line 243

Quoted 10 lines
tools/docker/Dockerfile +10 -0
+# Build coreboot
+RUN wget -O - https://coreboot.org/releases/coreboot-4.22.01.tar.xz | tar -C /tmp -xJ && \
+    cd /tmp/coreboot-4.22.01 && \
+    make crossgcc-i386 CPUS=$(nproc) && \
+    make -C payloads/coreinfo olddefconfig && \
+    make -C payloads/coreinfo && \
+    make olddefconfig && \
+    make -j $(nproc) && \
+    sudo mkdir /opt/coreboot && \
+    sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/

And I forgot an "rm -rf /tmp/coreboot-4.22.01" at the end here which I'll add while merging if there's no further comments.

Signature · 1 line
Tom
author
#4 lore raw
In reply to Tom Rini
Quoted 4 lines · Tom Rini

To make CI runs rely less on external servers, build a coreboot release from source and populate /opt/coreboot with the output.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom