50 lines
1.3 KiB
Docker
50 lines
1.3 KiB
Docker
FROM scratch as base
|
|
ENV VERSION=2.06
|
|
ENV SRC_HASH=23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f
|
|
ENV SRC_FILE=grub-${VERSION}.tar.gz
|
|
ENV SRC_SITE=https://mirrors.kernel.org/gnu/grub/${SRC_FILE}
|
|
|
|
FROM base as fetch
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE}
|
|
|
|
FROM fetch as build
|
|
COPY --from=stagex/busybox . /
|
|
COPY --from=stagex/bison . /
|
|
COPY --from=stagex/flex . /
|
|
COPY --from=stagex/gcc . /
|
|
COPY --from=stagex/binutils . /
|
|
COPY --from=stagex/make . /
|
|
COPY --from=stagex/musl . /
|
|
COPY --from=stagex/python . /
|
|
COPY --from=stagex/m4 . /
|
|
COPY --from=stagex/linux-headers . /
|
|
RUN tar -xf ${SRC_FILE}
|
|
WORKDIR grub-${VERSION}
|
|
RUN --network=none <<-EOF
|
|
set -eux
|
|
./configure \
|
|
--prefix=/usr
|
|
make -j "$(nproc)" CFLAGS="-Wno-error"
|
|
EOF
|
|
|
|
FROM build as install
|
|
RUN make DESTDIR=/rootfs install
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
|
RUN ls -la .
|
|
|
|
FROM base as test
|
|
COPY --from=install /rootfs/. /
|
|
COPY --from=stagex/musl . /
|
|
COPY --from=stagex/busybox . /
|
|
RUN grub-install --version
|
|
RUN /bin/sh <<-EOF
|
|
set -eux
|
|
GRUB_VERSION=\$(echo | grub-install --version)
|
|
if [ "grub-install (GRUB) ${VERSION}" != "\$GRUB_VERSION" ]; then
|
|
echo "Expected grub version is \$VERSION, but got \$GRUB_VERSION"
|
|
exit 1
|
|
fi
|
|
EOF
|
|
|
|
FROM stagex/filesystem as package
|
|
COPY --from=install /rootfs/. /
|