From ddf305082c3c88ba3d6fe4796e038d3c348c6dbd Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Fri, 16 Jun 2023 20:09:29 +0000 Subject: [PATCH 1/3] macros: drop arch from cross_os prefix The package architecture can be set correctly at build time, so it's not necessary to include it in the name. Signed-off-by: Ben Cressey --- macros/shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/shared b/macros/shared index 50528d39..9ffc2e1d 100644 --- a/macros/shared +++ b/macros/shared @@ -1,6 +1,6 @@ %_cross_vendor bottlerocket %_cross_libc gnu -%_cross_os %{_cross_vendor}-%{_cross_arch}- +%_cross_os %{_cross_vendor}- %_cross_triple %{_cross_arch}-%{_cross_vendor}-linux %_cross_target %{_cross_triple}-%{_cross_libc} %dist %{nil} From 0f1ae08ce488561c9549dac82949068fd5e0471c Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Fri, 16 Jun 2023 20:46:25 +0000 Subject: [PATCH 2/3] macros: simplify arch macros for GRUB This allows us to add a different bootloader - like shim - that also needs to know the EFI architecture name, without having to update the macros again. Signed-off-by: Ben Cressey --- macros/aarch64 | 2 +- macros/x86_64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/aarch64 b/macros/aarch64 index d7c8fb8f..e8d83335 100644 --- a/macros/aarch64 +++ b/macros/aarch64 @@ -4,7 +4,7 @@ %_cross_cpu_family arm %_cross_endian little +%_cross_efi_arch aa64 %_cross_grub_efi_format arm64-efi -%_cross_grub_efi_image bootaa64.efi %_cross_go_arch arm64 diff --git a/macros/x86_64 b/macros/x86_64 index fb00fcf2..315d3b43 100644 --- a/macros/x86_64 +++ b/macros/x86_64 @@ -4,7 +4,7 @@ %_cross_cpu_family x86 %_cross_endian little +%_cross_efi_arch x64 %_cross_grub_efi_format x86_64-efi -%_cross_grub_efi_image bootx64.efi %_cross_go_arch amd64 From e17b597bd5031ec00909b44155d705d06ea1c5f6 Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Mon, 19 Jun 2023 22:04:23 +0000 Subject: [PATCH 3/3] build: add macros to the SDK Signed-off-by: Ben Cressey --- Dockerfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Dockerfile b/Dockerfile index 750cee10..134d17cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -895,6 +895,19 @@ RUN \ -C /${MUSL_SYSROOT}/usr/share/licenses -T toolchain-licenses.txt && \ tar xvf toolchain.tar -C / +# =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= +# +# Generate macros for the target. + +FROM sdk as sdk-macros +ARG ARCH + +COPY macros/* /tmp/ + +WORKDIR /tmp +RUN \ + cat ${ARCH} shared rust cargo > /etc/rpm/macros.bottlerocket + # =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= # # Collects all toolchain builds as single image layer @@ -994,6 +1007,11 @@ COPY --chown=0:0 --from=sdk-e2fsprogs \ /home/builder/NOTICE \ /usr/share/licenses/dir2fs/ +# "sdk-macros" has the rpm macros +COPY --chown=0:0 --from=sdk-macros \ + /etc/rpm/macros.bottlerocket \ + /etc/rpm/macros.bottlerocket + # Add Rust programs and libraries to the path. # Also add symlinks to help out with sysroot discovery. RUN \