Compare commits
2 Commits
b8a061797b
...
41469a293a
Author | SHA1 | Date |
---|---|---|
Lance Vick | 41469a293a | |
Lance Vick | 41befd1345 |
|
@ -8,6 +8,18 @@ out/curl.tgz: \
|
|||
out/ca-certificates.tgz
|
||||
$(call build,tools,curl)
|
||||
|
||||
out/gen_initramfs.tgz: \
|
||||
out/gcc.tgz \
|
||||
out/binutils.tgz \
|
||||
out/musl.tgz
|
||||
$(call build,tools,gen_initramfs)
|
||||
|
||||
out/cpio.tgz: \
|
||||
out/gcc.tgz \
|
||||
out/binutils.tgz \
|
||||
out/musl.tgz
|
||||
$(call build,tools,cpio)
|
||||
|
||||
out/tofu.tgz: \
|
||||
out/busybox.tgz \
|
||||
out/go.tgz
|
||||
|
@ -16,4 +28,4 @@ out/tofu.tgz: \
|
|||
out/sops.tgz: \
|
||||
out/busybox.tgz \
|
||||
out/go.tgz
|
||||
$(call build,tools,sops)
|
||||
$(call build,tools,sops)
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
ARG REGISTRY=local
|
||||
from ${REGISTRY}/binutils as binutils
|
||||
from ${REGISTRY}/gcc as gcc
|
||||
from ${REGISTRY}/musl as musl
|
||||
from ${REGISTRY}/make as make
|
||||
from ${REGISTRY}/busybox as busybox
|
||||
|
||||
FROM busybox as base
|
||||
ENV SRC_SITE=https://ftp.gnu.org/gnu/cpio
|
||||
ENV SRC_VERSION=2.15
|
||||
ENV SRC_HASH=efa50ef983137eefc0a02fdb51509d624b5e3295c980aa127ceee4183455499e
|
||||
ENV SRC_FILE=cpio-${SRC_VERSION}.tar.gz
|
||||
|
||||
FROM base as fetch
|
||||
RUN set -eux; \
|
||||
wget ${SRC_SITE}/${SRC_FILE}; \
|
||||
echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
RUN tar -xzf ${SRC_FILE}
|
||||
WORKDIR cpio-${SRC_VERSION}
|
||||
COPY --from=gcc . /
|
||||
COPY --from=binutils . /
|
||||
COPY --from=make . /
|
||||
COPY --from=musl . /
|
||||
RUN set -eux; \
|
||||
mkdir -p /home/user/rootfs/lib; \
|
||||
./configure \
|
||||
--build=x86_64-unknown-linux-musl \
|
||||
--host=x86_64-unknown-linux-musl \
|
||||
--prefix=/usr \
|
||||
--bindir=/bin \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info; \
|
||||
make
|
||||
|
||||
FROM build as install
|
||||
USER 0:0
|
||||
RUN make DESTDIR=/rootfs install
|
||||
COPY --from=musl /usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1
|
||||
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
|
||||
FROM scratch as package
|
||||
COPY --from=install /rootfs /
|
||||
ENTRYPOINT ["/bin/cpio"]
|
||||
CMD ["--version"]
|
|
@ -0,0 +1,34 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/musl as musl
|
||||
FROM ${REGISTRY}/gcc as gcc
|
||||
FROM ${REGISTRY}/binutils as binutils
|
||||
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}
|
||||
COPY --from=gcc . /
|
||||
COPY --from=binutils . /
|
||||
COPY --from=musl . /
|
||||
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 /
|
Reference in New Issue