stagex/packages/ipxe/Containerfile

87 lines
2.4 KiB
Text
Raw Normal View History

2024-09-16 22:26:08 +00:00
FROM scratch AS base
ENV VERSION=6ca597eee9f95b846a3c2dc1231e63cfc02272c1
ENV SRC_FILE=${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/ipxe/ipxe/archive/${SRC_FILE}
ENV SRC_HASH=f90cc9024d90e3fcbd738a3a1904dd552f276fcc52d177ebdd4e78d17e5c5b44
FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch AS build
COPY --from=stagex/busybox . /
COPY --from=stagex/coreutils . /
COPY --from=stagex/gcc . /
COPY --from=stagex/binutils . /
COPY --from=stagex/openssl . /
COPY --from=stagex/make . /
COPY --from=stagex/perl . /
COPY --from=stagex/musl . /
COPY --from=stagex/edk2 . /
COPY --from=stagex/syslinux . /
COPY --from=stagex/xorriso . /
COPY --from=stagex/xz . /
RUN tar -xf ${SRC_FILE}
WORKDIR /ipxe-${VERSION}/src
ENV SOURCE_DATE_EPOCH=1
RUN --network=none <<-EOF
set -ex
mkdir -p out
make \
-j "$(nproc)" \
CC=x86_64-linux-musl-gcc \
NO_WERROR=1 \
EXTRA_CFLAGS="-fcommon" \
bin/ipxe.iso \
bin/ipxe.lkrn \
bin/ipxe.pxe \
bin/undionly.kpxe \
bin/ipxe.usb \
bin/ipxe.dsk \
bin-x86_64-efi/ipxe.efi
printf " \
e1000 8086 100e \n \
e1000e 8086 10d3 \n \
eepro100 8086 1209 \n \
ne2k_pci 1050 0940 \n \
pcnet 1022 2000 \n \
rtl8139 10ec 8139 \n \
virtio 1af4 1000 \n \
vmxnet3 15ad 07b0" \
| while IFS= read -r line; do
set -- $line;
target="$1";
vid="$2";
did="$3";
make \
-j "$(nproc)" \
CONFIG=qemu \
CC=x86_64-linux-musl-gcc \
NO_WERROR=1 \
EXTRA_CFLAGS="-fcommon" \
bin-x86_64-efi/${vid}${did}.efidrv \
bin/${vid}${did}.rom;
EfiRom \
-f "0x${vid}" \
-i "0x${did}" \
-l 0x02 \
-b bin/${vid}${did}.rom \
-ec bin-x86_64-efi/${vid}${did}.efidrv \
-o out/efi-${target}.rom;
done
EOF
FROM build AS install
RUN <<-EOF
set -eux
install -vDm 644 bin/*.lkrn -t /rootfs/usr/share/ipxe/
install -vDm 644 bin/*.dsk -t /rootfs/usr/share/ipxe/
install -vDm 644 bin/*.iso -t /rootfs/usr/share/ipxe/
install -vDm 644 bin/*.pxe -t /rootfs/usr/share/ipxe/
install -vDm 644 bin/*.kpxe -t /rootfs/usr/share/ipxe/
install -vDm 644 bin-x86_64-efi/*.efi -t /rootfs/usr/share/ipxe/x86_64/
install -vDm 644 out/efi-*.rom -t /rootfs/usr/share/qemu/
EOF
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /