add initial gen_initramfs package

This commit is contained in:
Lance Vick 2024-01-31 02:57:52 -08:00
parent b8a061797b
commit 41befd1345
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
2 changed files with 36 additions and 1 deletions

View File

@ -8,6 +8,11 @@ out/curl.tgz: \
out/ca-certificates.tgz
$(call build,tools,curl)
out/gen_initramfs.tgz: \
out/gcc.tgz \
out/musl.tgz
$(call build,tools,gen_initramfs)
out/tofu.tgz: \
out/busybox.tgz \
out/go.tgz
@ -16,4 +21,4 @@ out/tofu.tgz: \
out/sops.tgz: \
out/busybox.tgz \
out/go.tgz
$(call build,tools,sops)
$(call build,tools,sops)

View File

@ -0,0 +1,30 @@
ARG REGISTRY=local
FROM ${REGISTRY}/musl as musl
FROM ${REGISTRY}/gcc as gcc
FROM ${REGISTRY}/busybox as busybox
FROM busybox as base
WORKDIR ${HOME}
ENV SRC_SITE http://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/
ENV SRC_VERSION 6.6
ENV SRC_HASH d926a06c63dd8ac7df3f86ee1ffc2ce2a3b81a2d168484e76b5b389aba8e56d0
FROM base as fetch
RUN wget ${SRC_SITE}/linux-${SRC_VERSION}.tar.xz
RUN echo "${SRC_HASH} linux-${SRC_VERSION}.tar.xz" | sha256sum -c
FROM fetch as build
RUN tar -xf linux-${SRC_VERSION}.tar.xz
WORKDIR linux-${SRC_VERSION}
RUN gcc usr/gen_init_cpio.c -o usr/gen_init_cpio
FROM build as install
USER 0:0
RUN set -eux; \
mkdir -p /rootfs/usr/bin; \
cp -a usr/gen_initramfs.sh /rootfs/usr/bin/gen_initramfs; \
cp -a usr/gen_init_cpio /rootfs/usr/bin; \
find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /