From 9e6dca81b4abbb9488bd3a7406697ad5eb2d1cfd Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Wed, 12 Jun 2024 09:55:00 +0200 Subject: [PATCH] new(pkg,docker): added an amazonlinux2 gcc10 builder. This fixes driver build issues on al2 5.10 kernels. Signed-off-by: Federico Di Pierro --- ...r-amazonlinux2-x86_64_gcc10.0.0.Dockerfile | 32 +++++++++++++++++++ pkg/driverbuilder/builder/amazonlinux.go | 9 ++++++ 2 files changed, 41 insertions(+) create mode 100644 docker/builders/builder-amazonlinux2-x86_64_gcc10.0.0.Dockerfile diff --git a/docker/builders/builder-amazonlinux2-x86_64_gcc10.0.0.Dockerfile b/docker/builders/builder-amazonlinux2-x86_64_gcc10.0.0.Dockerfile new file mode 100644 index 0000000..8ecfcd0 --- /dev/null +++ b/docker/builders/builder-amazonlinux2-x86_64_gcc10.0.0.Dockerfile @@ -0,0 +1,32 @@ +FROM amazonlinux:2.0.20240529.0 + +LABEL maintainer="cncf-falco-dev@lists.cncf.io" + +RUN yum -y install gcc10 \ + clang \ + llvm \ + bash-completion \ + bc \ + ca-certificates \ + curl \ + gnupg2 \ + libc6-dev \ + elfutils-libelf-devel \ + xz \ + cpio \ + flex \ + bison \ + openssl \ + openssl-devel \ + wget \ + binutils \ + which \ + make \ + cmake3 \ + tar \ + zstd \ + git + +# Properly create soft links +RUN ln -s /usr/bin/gcc10-cc /usr/bin/gcc-10.0.0 +RUN ln -s /usr/bin/cmake3 /usr/bin/cmake \ No newline at end of file diff --git a/pkg/driverbuilder/builder/amazonlinux.go b/pkg/driverbuilder/builder/amazonlinux.go index 16b7693..475bb93 100644 --- a/pkg/driverbuilder/builder/amazonlinux.go +++ b/pkg/driverbuilder/builder/amazonlinux.go @@ -22,6 +22,7 @@ import ( "database/sql" _ "embed" "fmt" + "github.com/blang/semver" "io" "io/ioutil" "log" @@ -179,6 +180,14 @@ func (a *amazonlinux2) URLs(kr kernelrelease.KernelRelease) ([]string, error) { return fetchAmazonLinuxPackagesURLs(a, kr) } +func (a *amazonlinux2) GCCVersion(kr kernelrelease.KernelRelease) semver.Version { + // 5.10 amazonlinux2 kernels need gcc 10 + if kr.Major == 5 && kr.Minor == 10 { + return semver.Version{Major: 10} + } + return semver.Version{} +} + func (a *amazonlinux2) repos() []string { return []string{ "core/2.0",