Skip to content

Commit

Permalink
feat(action): add new env var to indicate which GCC version to use
Browse files Browse the repository at this point in the history
- add new environment variable USE_GCC_VERSION into the containers which
  tells the compiler which GCC to use
- this is needed because EDK2 needs option GGC5 even for gcc v9 ...
  don't ask, it is stupid
  • Loading branch information
AtomicFS committed Nov 3, 2023
1 parent f0d62de commit 74cf26f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ inputs:
should be used to build the target.
For coreboot and linux this is a defconfig.
For EDK2 this is a one-line file containing the build arguments
such as '-t GCC5 -D BOOTLOADER=COREBOOT -D TPM_ENABLE=TRUE -D NETWORK_IPXE=TRUE'.
such as '-D BOOTLOADER=COREBOOT -D TPM_ENABLE=TRUE -D NETWORK_IPXE=TRUE'.
Some arguments will be added automatically from action inputs:
'-a <architecture>'
'-p <edk2__platform>'
'-b <edk2__release_type>'
'-t <GCC version>' (defined as part of docker toolchain in sdk_version)
required: true
output:
description: |
Expand Down
4 changes: 2 additions & 2 deletions action/recipes/edk2.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func edk2GetOpts(getInputVar getValFunc, getEnvVar getValFunc) (edk2Opts, error)
opts := edk2Opts{
platform: getInputVar("edk2__platform"),
releaseType: getInputVar("edk2__release_type"),
gccVersion: getEnvVar("GCC_VERSION"),
gccVersion: getEnvVar("USE_GCC_VERSION"),
}

// Check if required options are not empty
Expand Down Expand Up @@ -73,7 +73,7 @@ func edk2(ctx context.Context, client *dagger.Client, common *commonOpts, docker

// Assemble build arguments
// and read content of the config file at "defconfig_path"
buildArgs := fmt.Sprintf("-a %s -p %s -b %s", common.arch, opts.platform, opts.releaseType)
buildArgs := fmt.Sprintf("-a %s -p %s -b %s -t GCC%s", common.arch, opts.platform, opts.releaseType, opts.gccVersion)
defconfigFileArgs, err := os.ReadFile(common.defconfigPath)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion action/recipes/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type linuxOpts struct {
// It is here to keep the same structure to other recipes
func linuxGetOpts(_ getValFunc, getEnvVar getValFunc) (linuxOpts, error) {
opts := linuxOpts{
gccVersion: getEnvVar("GCC_VERSION"),
gccVersion: getEnvVar("USE_GCC_VERSION"),
}
return opts, nil
}
Expand Down
1 change: 1 addition & 0 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- EDK2_PLATFORM_COMMIT=5b849a6397d51607098cb4d0cf8b9b3f88731912
- EDK2_NON_OSI_COMMIT=663322292e2cc81ee6ec26aa0c5948f4d8c4849a
- GCC_VERSION=4.8
- USE_GCC_VERSION=48
- PYTHON_PACKAGES=python
- GCC_CROSS_COMPILER_PACKAGES=gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi gcc-i686-linux-gnu
# NonOSI wasn't used in 2017
Expand Down
4 changes: 4 additions & 0 deletions docker/edk2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ FROM ${SOURCE_IMAGE} AS base
ARG EDK2_VERSION=edk2-stable202008
ARG EDK2_PLATFORM_COMMIT=7093026e924291b9e9f6f5211a052c6a761a4704
ARG EDK2_NON_OSI_COMMIT=4f88718028316aee31cb577f7127d5706255722d

ARG GCC_VERSION=9
ENV GCC_VERSION=$GCC_VERSION
ARG USE_GCC_VERSION=5
ENV USE_GCC_VERSION=$USE_GCC_VERSION

ARG PYTHON_PACKAGES=python-is-python3 python2 python3
ARG GCC_CROSS_COMPILER_PACKAGES=gcc-${GCC_VERSION}-aarch64-linux-gnu gcc-${GCC_VERSION}-arm-linux-gnueabi gcc-${GCC_VERSION}-i686-linux-gnu

Expand Down
7 changes: 5 additions & 2 deletions docker/linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ FROM ${SOURCE_IMAGE} AS base

ARG TARGETARCH=amd64
ARG LINUX_VERSION=6.1.45
ARG GCC_VERSION=10
ENV GCC_VERSION=10
ARG CONTEXT=linux

ARG GCC_VERSION=10
ENV GCC_VERSION=$GCC_VERSION
ARG USE_GCC_VERSION=$GCC_VERSION
ENV USE_GCC_VERSION=$USE_GCC_VERSION

# Verification test
ENV VERIFICATION_TEST=./tests/test_${CONTEXT}.sh
ENV VERIFICATION_TEST_LINUX_VERSION=$LINUX_VERSION
Expand Down

0 comments on commit 74cf26f

Please sign in to comment.