diff --git a/src/core/grub/Containerfile b/src/core/grub/Containerfile new file mode 100644 index 0000000..ce72080 --- /dev/null +++ b/src/core/grub/Containerfile @@ -0,0 +1,50 @@ +FROM scratch as base +ENV SRC_VERSION=2.06 +ENV SRC_HASH=23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f +ENV SRC_FILE=grub-${SRC_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=busybox . / +COPY --from=bison . / +COPY --from=flex . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +COPY --from=python . / +COPY --from=m4 . / +COPY --from=linux-headers . / +RUN tar -xf ${SRC_FILE} +WORKDIR grub-${SRC_VERSION} +RUN --network=none <<-EOF + set -eux + ./configure \ + --prefix=/usr + make 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=musl . / +COPY --from=busybox . / +RUN grub-install --version +RUN /bin/sh <<-EOF + set -eux + GRUB_VERSION=\$(echo | grub-install --version) + if [ "grub-install (GRUB) ${SRC_VERSION}" != "\$GRUB_VERSION" ]; then + echo "Expected grub version is \$SRC_VERSION, but got \$GRUB_VERSION" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/packages.mk b/src/packages.mk index 9025c14..2f4da30 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -188,6 +188,16 @@ out/gettext/index.json: \ out/musl/index.json $(call build,gettext) +.PHONY: grub +grub: out/grub/index.json +out/grub/index.json: \ + src/core/grub/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/musl/index.json + $(call build,core,grub) + .PHONY: go go: out/go/index.json out/go/index.json: \