Skip to content

Commit 16ec7c5

Browse files
zzdifkilaterleeosteffenrh
authored
Merge from upstream (#1)
* Add Fedora 39 image with gcc13 (tianocore#82) Added Fedora 39 base image, providing GCC13 and Python 3.12. Signed-off-by: Chao Li <[email protected]> * Fedora 39 fixups (tianocore#87) * Fedora 39: Use Qemu from package repo Fedora 39 ships Qemu 8. We can use that instead of building it from source. Also add Qemu for RiscV. Signed-off-by: Oliver Steffen <[email protected]> * Allow using dev image as root Don't abort the entrypoint script if the user-id already exists. This allows using the dev images as root or when using Podman, which does some user mapping already. See issue tianocore#76 and PR tianocore#77. Signed-off-by: Oliver Steffen <[email protected]> * Readme: Add Fedora 39 image to table Add links and badges for the Fedora 39 images to the table. Signed-off-by: Oliver Steffen <[email protected]> --------- Signed-off-by: Oliver Steffen <[email protected]> * Fedora 39 Build Fixes (tianocore#88) * Fedora39: Don't use fixed package versions Specifying version numbers for the packages provided by the Linux distribution is counterproductive. The available patchlevel versions of a package can change within a Fedora release. This can breaks image builds which requires additional manual work. Since the major versions stay fixed, there should not be any compatibility issues between image builds. Additionally, bug fixes are picked up automatically. This patch removes the explicit version numbers from the packages and installs the default versions instead. Signed-off-by: Oliver Steffen <[email protected]> * Fedora 39: Install python-setuptools via pip Install python-setuptools via pip instead of taking it from the Fedora repo. This avoids possible conflicts with `pip install --upgrade ...` Signed-off-by: Oliver Steffen <[email protected]> --------- Signed-off-by: Oliver Steffen <[email protected]> --------- Signed-off-by: Chao Li <[email protected]> Signed-off-by: Oliver Steffen <[email protected]> Co-authored-by: Chao Li <[email protected]> Co-authored-by: Oliver Steffen <[email protected]>
1 parent e286dea commit 16ec7c5

File tree

5 files changed

+222
-0
lines changed

5 files changed

+222
-0
lines changed

.github/workflows/Fedora-39.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# GitHub Action Workflow for building the Fedora 39 images.
2+
3+
# SPDX-License-Identifier: BSD-2-Clause-Patent
4+
5+
name: "Fedora 39 Images"
6+
7+
# This workflow only runs (on the main branch or on PRs targeted
8+
# at the main branch) and if files inside the Fedora-39 directory
9+
# have been modifed/added/removed...
10+
11+
on:
12+
workflow_dispatch:
13+
push:
14+
branches: [ main ]
15+
paths:
16+
- 'Fedora-39/**'
17+
pull_request:
18+
branches: [ main ]
19+
paths:
20+
- 'Fedora-39/**'
21+
22+
jobs:
23+
Build_Image:
24+
uses: ./.github/workflows/build-image.yaml
25+
with:
26+
image_name: "Fedora-39"
27+
sub_images: "build test dev"

Fedora-39/Dockerfile

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Dockerfile for building container images for use in the EDK2 CI.
2+
#
3+
# Copyright (C) 2022, Red Hat, Inc.
4+
# Copyright (c) 2023 Loongson Technology Corporation Limited. All rights reserved.
5+
# SPDX-License-Identifier: BSD-2-Clause-Patent
6+
#
7+
# This file contains the definitions for images to be used for different
8+
# jobs in the EDK2 CI pipeline. The set of tools and dependencies is split into
9+
# multiple images to reduce the overall download size by providing images
10+
# tailored to the task of the CI job. Currently there are two images: "build"
11+
# and "test".
12+
# The images are intended to run on x86_64.
13+
14+
15+
# Build Image
16+
# This image is intended for jobs that compile the source code and as a general
17+
# purpose image. It contains the toolchains for all supported architectures, and
18+
# all build dependencies.
19+
FROM registry.fedoraproject.org/fedora:39 AS build
20+
ARG CSPELL_VERSION=8.0.0
21+
ARG MARKDOWNLINT_VERSION=0.37.0
22+
ARG POWERSHELL_VERSION=7.4.0
23+
ARG DOTNET_VERSION=6.0
24+
RUN dnf \
25+
--assumeyes \
26+
--nodocs \
27+
--setopt=install_weak_deps=0 \
28+
install \
29+
acpica-tools \
30+
dotnet-runtime-${DOTNET_VERSION} \
31+
curl \
32+
gcc-c++ \
33+
gcc \
34+
gcc-aarch64-linux-gnu \
35+
gcc-arm-linux-gnu \
36+
gcc-riscv64-linux-gnu \
37+
gcc-loongarch64-linux-gnu \
38+
git \
39+
lcov \
40+
libX11-devel \
41+
libXext-devel \
42+
libuuid-devel \
43+
make \
44+
nuget \
45+
nasm \
46+
https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-1.rh.x86_64.rpm \
47+
python3 \
48+
python3-distutils-extra \
49+
python3-pip \
50+
python3-devel \
51+
nodejs \
52+
npm \
53+
tar \
54+
sudo
55+
RUN alternatives --install /usr/bin/python python /usr/bin/python3 1
56+
RUN pip install --upgrade pip lcov_cobertura setuptools
57+
58+
ENV GCC5_AARCH64_PREFIX /usr/bin/aarch64-linux-gnu-
59+
ENV GCC5_ARM_PREFIX /usr/bin/arm-linux-gnu-
60+
ENV GCC5_RISCV64_PREFIX /usr/bin/riscv64-linux-gnu-
61+
ENV GCC5_LOONGARCH64_PREFIX /usr/bin/loongarch64-linux-gnu-
62+
63+
# Tools used by build extensions.
64+
RUN npm install -g npm \
65+
cspell@${CSPELL_VERSION} \
66+
markdownlint-cli@${MARKDOWNLINT_VERSION}
67+
68+
# Test Image
69+
# This image is intended for jobs that run tests (and possibly also build)
70+
# firmware images. It is based on the build image and adds Qemu for the
71+
# architectures under test.
72+
73+
FROM build AS test
74+
RUN dnf \
75+
--assumeyes \
76+
--nodocs \
77+
--setopt=install_weak_deps=0 \
78+
install \
79+
qemu-system-arm \
80+
qemu-system-aarch64 \
81+
qemu-system-loongarch64 \
82+
qemu-system-x86 \
83+
qemu-system-riscv \
84+
qemu-ui-gtk
85+
86+
# Dev Image
87+
# This image is intended for local use. This builds on the test image but adds
88+
# tools for local developers.
89+
FROM test AS dev
90+
ENV GCM_LINK=https://github.com/GitCredentialManager/git-credential-manager/releases/download/v2.0.785/gcm-linux_amd64.2.0.785.tar.gz
91+
RUN dnf \
92+
--assumeyes \
93+
--nodocs \
94+
--setopt=install_weak_deps=0 \
95+
install \
96+
libicu \
97+
curl \
98+
tar \
99+
vim \
100+
nano
101+
102+
# Setup the git credential manager for developer credentials.
103+
RUN curl -L "${GCM_LINK}" | tar -xz -C /usr/local/bin
104+
RUN git-credential-manager-core configure
105+
RUN git config --global credential.credentialStore cache
106+
RUN cp /etc/skel/.bashrc /root/.bashrc
107+
108+
# Set the entry point
109+
COPY fedora39_dev_entrypoint.sh /usr/libexec/entrypoint
110+
ENTRYPOINT ["/usr/libexec/entrypoint"]

Fedora-39/Readme.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Fedora 39 Images
2+
3+
This set of images is based on the Fedora 39 minimal image.
4+
It has three flavors, `build`, `test`, and `dev`.
5+
The first two are primarily intended for automated builds
6+
and CI usage.
7+
8+
The `build` image contains the compilers and build tools
9+
needed for building EDK2 under Linux (x86_64).
10+
11+
The `test` image extends the `build` image and adds Qemu for
12+
testing purposes.
13+
14+
The `dev` image in turn extends the `test` image and adds developer
15+
convenience tools, for example the git credential manager.
16+
17+
These images include:
18+
- gcc 13.2 (x86, arm, aarch64, riscv, loongarch64)
19+
- nasm 2.16.01
20+
- Python 3.12
21+
- Qemu 8.1.3 (x86, arm, aarch64, loongarch64)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
# SPDX-License-Identifier: BSD-2-Clause-Patent
5+
6+
set -e
7+
8+
#####################################################################
9+
# Run as the same uid/gid as the developer.
10+
11+
12+
#####################################################################
13+
# Check for required env
14+
if [ -z "${EDK2_DOCKER_USER_HOME}" ] || [ ! -d "${EDK2_DOCKER_USER_HOME}" ]; then
15+
echo 'Missing EDK2_DOCKER_USER_HOME. Running as root.'
16+
exec "$@"
17+
fi
18+
19+
#####################################################################
20+
# Create a user to run the command
21+
#
22+
# Docker would run as root, but that creates a permissions mess in a mixed
23+
# development environment where some commands are run inside the container and
24+
# some outside. Instead, we'll create a user with uid/gid to match the one
25+
# running the container. Then, the permissions will be consistent with
26+
# non-docker activities.
27+
#
28+
# - If the caller provides a username, we'll use it. Otherwise, just use an
29+
# arbitrary username.
30+
EDK2_DOCKER_USER=${EDK2_DOCKER_USER:-edk2}
31+
#
32+
# - Get the uid and gid from the user's home directory.
33+
user_uid=$(stat -c "%u" "${EDK2_DOCKER_USER_HOME}")
34+
user_gid=$(stat -c "%g" "${EDK2_DOCKER_USER_HOME}")
35+
#
36+
# - Add the group. We'll take a shortcut here and always name it the same as
37+
# the username. The name is cosmetic, though. The important thing is that the
38+
# gid matches.
39+
groupadd "${EDK2_DOCKER_USER}" -f -o -g "${user_gid}"
40+
#
41+
# - Add the user.
42+
useradd "${EDK2_DOCKER_USER}" -o -u "${user_uid}" -g "${user_gid}" \
43+
-G wheel -d "${EDK2_DOCKER_USER_HOME}" -M -s /bin/bash
44+
45+
echo "${EDK2_DOCKER_USER}":tianocore | chpasswd
46+
47+
#####################################################################
48+
# Cleanup variables
49+
unset user_uid
50+
unset user_gid
51+
52+
53+
#####################################################################
54+
# Drop permissions and run the command
55+
if [ "$1" = "su" ]; then
56+
# Special case. Let the user come in as root, if they really want to.
57+
shift
58+
exec "$@"
59+
else
60+
exec runuser -u "${EDK2_DOCKER_USER}" -- "$@"
61+
fi

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ be found in [current status](#Current-Status).
1111

1212
| Image Name | OS SKU | Type | Build Status | Documentation |
1313
| :--------- | :----- | :--- | :----------- | :---- |
14+
| [fedora-39-build](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-39-build) | Fedora 39 | Build | [![Fedora 39 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml) | [Doc](Fedora-39/Readme.md) |
15+
| [fedora-39-test](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-39-test) | Fedora 39 | Test | [![Fedora 39 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml) | [Doc](Fedora-39/Readme.md) |
16+
| [fedora-39-dev](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-39-dev) | Fedora 39 | Dev | [![Fedora 39 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-39.yaml) | [Doc](Fedora-39/Readme.md) |
1417
| [fedora-37-build](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-37-build) | Fedora 37 | Build | [![Fedora 37 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml) | [Doc](Fedora-37/Readme.md) |
1518
| [fedora-37-test](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-37-test) | Fedora 37 | Test | [![Fedora 37 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml) | [Doc](Fedora-37/Readme.md) |
1619
| [fedora-37-dev](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-37-dev) | Fedora 37 | Dev | [![Fedora 37 Images](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml/badge.svg)](https://github.com/tianocore/containers/actions/workflows/Fedora-37.yaml) | [Doc](Fedora-37/Readme.md) |

0 commit comments

Comments
 (0)