11# syntax=docker/dockerfile-upstream:1.5.0-rc2-labs
22ARG PLATFORM=generic
33
4- FROM lfedge/eve-alpine:1f744180283ffb4eabcc3862531aeacf1de886b3 AS build-base
4+ FROM lfedge/eve-alpine:41f3648ded073c351d0dcd3432322f5816c9c7b1 AS build-base
55
66ARG TARGETARCH
77
@@ -100,10 +100,24 @@ ADD ${RPI_BT_FIRMWARE_URL}/${RPI_BT_FIRMWARE_VERSION}/broadcom/BCM4345C5.hcd .
100100ENV HAILO_FW_VERSION=4.21.0
101101ADD https://hailo-hailort.s3.eu-west-2.amazonaws.com/Hailo8/${HAILO_FW_VERSION}/FW/hailo8_fw.${HAILO_FW_VERSION}.bin /lib/firmware/hailo/hailo8_fw.bin
102102
103+ # Register firmware packages in the APK DB, mandatory for them to be included in the SBOM.
104+ RUN register-sbom-pkg.sh -n wireless-regdb -v "${WIRELESS_REGDB_VERSION}" -l ISC -u https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb -o /sbom-out
105+ RUN register-sbom-pkg.sh -n linux-firmware -v "${LINUX_FIRMWARE_VERSION}" -l GPL-2.0-only -u https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git -o /sbom-out
106+ RUN register-sbom-pkg.sh -n rtw88-firmware -v "${RTL8822_FW_VERSION:0:8}" -l GPL-2.0-only -u https://github.com/lwfinger/rtw88 -o /sbom-out
107+ RUN register-sbom-pkg.sh -n hailo8-firmware -v "${HAILO_FW_VERSION}" -l proprietary -u https://hailo.ai -o /sbom-out
108+ RUN register-sbom-pkg.sh -n nvidia-l4t-firmware -v "${NVIDIA_FW_TEGRA}" -l proprietary -u https://repo.download.nvidia.com/jetson -o /sbom-out
109+ RUN if [ "${TARGETARCH}" = "arm64" ]; then \
110+ register-sbom-pkg.sh -n rpi-firmware-nonfree -v "${RPI_FIRMWARE_VERSION:0:8}" -l proprietary -u https://github.com/RPi-Distro/firmware-nonfree -o /sbom-out && \
111+ register-sbom-pkg.sh -n rpi-bluez-firmware -v "${RPI_BT_FIRMWARE_VERSION:0:8}" -l proprietary -u https://github.com/RPi-Distro/bluez-firmware -o /sbom-out; \
112+ fi
113+
103114# generate initrd for Intel's and AMD's microcode
104115# it makes sense only for x86_64 platform
105- FROM --platform=${TARGETPLATFORM} lfedge/eve-alpine:1f744180283ffb4eabcc3862531aeacf1de886b3 AS ucode-build-common
116+ FROM --platform=${TARGETPLATFORM} lfedge/eve-alpine:41f3648ded073c351d0dcd3432322f5816c9c7b1 AS ucode-build-common
106117RUN mkdir -p /boot /tmp/ucode/intel /tmp/ucode/amd /usr/share/licenses/ucode
118+ # Ensure /sbom-out/lib/apk/db/installed exists for all archs so the COPY in
119+ # compactor-common works even when no ucode registrations run (arm64/riscv64).
120+ RUN register-sbom-pkg.sh -o /sbom-out
107121
108122FROM ucode-build-common AS ucode-build-amd64
109123ENV BUILD_PKGS=iucode-tool
@@ -139,13 +153,22 @@ RUN cp /tmp/ucode/amd/linux-firmware/LICENSE.amd-ucode /usr/share/licenses/ucode
139153# merge intel and amd microcode
140154RUN cat /tmp/ucode/intel/intel-ucode.img /tmp/ucode/amd/amd-ucode.img >/boot/ucode.img
141155
156+ # Register intel-ucode and amd-ucode in the APK DB, mandatory for them to be included in the SBOM.
157+ RUN register-sbom-pkg.sh -n intel-ucode -v "${INTEL_UCODE_VERSION}" -l proprietary -u https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files -o /sbom-out
158+ RUN register-sbom-pkg.sh -n amd-ucode -v "${AMD_UCODE_VERSION}" -l proprietary -u https://www.amd.com -o /sbom-out
159+
142160FROM ucode-build-common AS ucode-build-arm64
143161FROM ucode-build-common AS ucode-build-riscv64
144162FROM ucode-build-${TARGETARCH} AS ucode-build
145163
146- FROM lfedge/eve-alpine:1f744180283ffb4eabcc3862531aeacf1de886b3 AS compactor-common
164+ FROM lfedge/eve-alpine:41f3648ded073c351d0dcd3432322f5816c9c7b1 AS compactor-common
147165ENTRYPOINT []
148166WORKDIR /
167+ # Reset the APK DB so the final image only reports source-built/firmware packages
168+ RUN rm -f /lib/apk/db/installed && register-sbom-pkg.sh -o /
169+ COPY --from=build /sbom-out/lib/apk/db/installed /tmp/sbom-fw
170+ COPY --from=ucode-build /sbom-out/lib/apk/db/installed /tmp/sbom-ucode
171+ RUN cat /tmp/sbom-fw /tmp/sbom-ucode >> /lib/apk/db/installed && rm -f /tmp/sbom-fw /tmp/sbom-ucode
149172COPY --from=build /lib/firmware/regulatory* /lib/firmware/
150173COPY --from=build /lib/firmware/bnx2x/* /lib/firmware/bnx2x/
151174COPY --from=build /lib/firmware/mrvl/*.bin /lib/firmware/mrvl/
@@ -222,7 +245,12 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
222245 fi
223246
224247
225- FROM lfedge/eve-alpine:1f744180283ffb4eabcc3862531aeacf1de886b3 AS compactor-full
248+ FROM lfedge/eve-alpine:41f3648ded073c351d0dcd3432322f5816c9c7b1 AS compactor-full
249+ # Reset the APK DB so the final image only reports source-built/firmware packages
250+ RUN rm -f /lib/apk/db/installed && register-sbom-pkg.sh -o /
251+ COPY --from=build /sbom-out/lib/apk/db/installed /tmp/sbom-fw
252+ COPY --from=ucode-build /sbom-out/lib/apk/db/installed /tmp/sbom-ucode
253+ RUN cat /tmp/sbom-fw /tmp/sbom-ucode >> /lib/apk/db/installed && rm -f /tmp/sbom-fw /tmp/sbom-ucode
226254# get all possible FW
227255COPY --from=build /lib/firmware/ /lib/firmware/
228256
@@ -239,5 +267,6 @@ ENTRYPOINT []
239267WORKDIR /
240268
241269COPY --from=compactor /lib/firmware /lib/firmware
270+ COPY --from=compactor /lib/apk/db/installed /lib/apk/db/installed
242271COPY --from=ucode-build /boot/ /boot/
243272COPY --from=ucode-build /usr/share/licenses/ucode /usr/share/licenses/ucode
0 commit comments