From 770a36cef60904355eaa7a658adc065bd33dc86c Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Fri, 2 Feb 2024 13:38:33 -0800 Subject: [PATCH] WIP kernel and deps --- Makefile | 1 + src/core/bison/Dockerfile | 40 +++++++++++++++++++ src/core/build.mk | 37 ++++++++++++++++++ src/core/flex/Dockerfile | 60 +++++++++++++++++++++++++++++ src/core/gettext/Dockerfile | 40 +++++++++++++++++++ src/core/heirloom/Dockerfile | 40 +++++++++++++++++++ src/kernel/build.mk | 6 +++ src/kernel/linux-generic/Dockerfile | 29 ++++++++++++++ 8 files changed, 253 insertions(+) create mode 100644 src/core/bison/Dockerfile create mode 100644 src/core/flex/Dockerfile create mode 100644 src/core/gettext/Dockerfile create mode 100644 src/core/heirloom/Dockerfile create mode 100644 src/kernel/build.mk create mode 100644 src/kernel/linux-generic/Dockerfile diff --git a/Makefile b/Makefile index 03e4061..62ad61f 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ clean_logs := $(shell rm *.log 2>&1 >/dev/null || :) include src/macros.mk include src/bootstrap/build.mk include src/core/build.mk +include src/kernel/build.mk include src/libs/build.mk include src/tools/build.mk diff --git a/src/core/bison/Dockerfile b/src/core/bison/Dockerfile new file mode 100644 index 0000000..63868d2 --- /dev/null +++ b/src/core/bison/Dockerfile @@ -0,0 +1,40 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/gcc:latest as gcc +FROM ${REGISTRY}/binutils:latest as binutils +FROM ${REGISTRY}/musl:latest as musl +FROM ${REGISTRY}/make:latest as make +FROM ${REGISTRY}/busybox:latest as busybox + +FROM busybox as base +ENV SRC_SITE https://ftp.gnu.org/gnu/bison +ENV SRC_VERSION 3.8.2 +ENV SRC_HASH 06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb +ENV SRC_FILE bison-${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 -xf ${SRC_FILE} +WORKDIR bison-${SRC_VERSION} +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +ENV M4=/usr/bin/m4 +RUN set -eux; \ + ./configure \ + --prefix=/usr; \ + make + +from build as install +USER 0:0 +RUN make DESTDIR=/rootfs install +RUN find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / +ENTRYPOINT ["/usr/bin/bison"] +CMD ["--version"] diff --git a/src/core/build.mk b/src/core/build.mk index a1f434c..8270f16 100644 --- a/src/core/build.mk +++ b/src/core/build.mk @@ -272,3 +272,40 @@ out/rust1.73.tgz: out/rust1.72.tgz out/rust.tgz: out/rust1.73.tgz $(call build,core,rust,1.74.0,package,--build-arg BUILD_VERSION=1.73.0 --build-arg LLVM_VERSION=16) + +out/bison.tgz: \ + out/busybox.tgz \ + out/gcc.tgz \ + out/binutils.tgz \ + out/musl.tgz \ + out/make.tgz + $(call build,core,bison) + +out/gettext.tgz: \ + out/busybox.tgz \ + out/gcc.tgz \ + out/binutils.tgz \ + out/musl.tgz \ + out/make.tgz + $(call build,core,gettext) + +out/heirloom.tgz: \ + out/busybox.tgz \ + out/gcc.tgz \ + out/binutils.tgz \ + out/musl.tgz \ + out/make.tgz + $(call build,core,heirloom) + +out/flex.tgz: \ + out/heirloom.tgz \ + out/busybox.tgz \ + out/gcc.tgz \ + out/autoconf.tgz \ + out/libtool.tgz \ + out/binutils.tgz \ + out/gettext.tgz \ + out/bison.tgz \ + out/musl.tgz \ + out/make.tgz + $(call build,core,flex) diff --git a/src/core/flex/Dockerfile b/src/core/flex/Dockerfile new file mode 100644 index 0000000..f095fe6 --- /dev/null +++ b/src/core/flex/Dockerfile @@ -0,0 +1,60 @@ +ARG REGISTRY=local +from ${REGISTRY}/binutils as binutils +from ${REGISTRY}/m4 as m4 +from ${REGISTRY}/lex as lex +from ${REGISTRY}/gcc as gcc +from ${REGISTRY}/musl as musl +from ${REGISTRY}/make as make +from ${REGISTRY}/libtool as libtool +from ${REGISTRY}/autoconf as autoconf +from ${REGISTRY}/automake as automake +from ${REGISTRY}/gettext as gettext +from ${REGISTRY}/bison as bison +from ${REGISTRY}/busybox as busybox + +FROM busybox as base +ENV SRC_VERSION=2.5.11 +ENV SRC_SITE=http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz +ENV SRC_HASH=bc79b890f35ca38d66ff89a6e3758226131e51ccbd10ef78d5ff150b7bd73689 +ENV SRC_FILE=flex-${SRC_VERSION}.tar.gz + +FROM base as fetch +RUN set -eux; \ + wget ${SRC_SITE}; \ + echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xzf ${SRC_FILE} +WORKDIR flex-${VERSION} +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=m4 . / +COPY --from=libtool . / +COPY --from=autoconf . / +COPY --from=automake . / +COPY --from=bison . / +COPY --from=gettext . / +COPY --from=musl . / +RUN set -eux; \ + ./autogen.sh; \ + ./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 \ + --disable-shared \ + --disable-static; \ + make + +FROM build as install +USER 0:0 +RUN make DESTDIR=/rootfs install +RUN find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / +ENTRYPOINT ["/bin/flex"] +CMD ["--version"] diff --git a/src/core/gettext/Dockerfile b/src/core/gettext/Dockerfile new file mode 100644 index 0000000..1138a6f --- /dev/null +++ b/src/core/gettext/Dockerfile @@ -0,0 +1,40 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/gcc:latest as gcc +FROM ${REGISTRY}/binutils:latest as binutils +FROM ${REGISTRY}/musl:latest as musl +FROM ${REGISTRY}/make:latest as make +FROM ${REGISTRY}/busybox:latest as busybox + +FROM busybox as base +ENV SRC_SITE https://ftp.gnu.org/gnu/gettext +ENV SRC_VERSION 0.22.4 +ENV SRC_HASH c1e0bb2a4427a9024390c662cd532d664c4b36b8ff444ed5e54b115fdb7a1aea +ENV SRC_FILE gettext-${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 -xf ${SRC_FILE} +WORKDIR gettext-${SRC_VERSION} +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +ENV M4=/usr/bin/m4 +RUN set -eux; \ + ./configure \ + --prefix=/usr; \ + make + +from build as install +USER 0:0 +RUN make DESTDIR=/rootfs install +RUN find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / +ENTRYPOINT ["/usr/bin/gettext"] +CMD ["--version"] diff --git a/src/core/heirloom/Dockerfile b/src/core/heirloom/Dockerfile new file mode 100644 index 0000000..763445d --- /dev/null +++ b/src/core/heirloom/Dockerfile @@ -0,0 +1,40 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/gcc:latest as gcc +FROM ${REGISTRY}/binutils:latest as binutils +FROM ${REGISTRY}/musl:latest as musl +FROM ${REGISTRY}/make:latest as make +FROM ${REGISTRY}/busybox:latest as busybox + +FROM busybox as base +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +ENV SRC_VERSION 070527 +ENV SRC_FILE heirloom-devtools-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/${SRC_VERSION}/${SRC_FILE} +ENV SRC_HASH=9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba + +FROM base as fetch +RUN wget ${SRC_SITE} +RUN echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xjf ${SRC_FILE} +WORKDIR heirloom-devtools-${SRC_VERSION} +RUN set -eux; \ + make yacc/Makefile lex/Makefile; \ + make -C yacc LDFLAGS=-static; \ + make -C lex LDFLAGS=-static + +FROM build as install +USER 0:0 +RUN set -eux; \ + mkdir -p /rootfs/usr/bin; \ + install lex/lex /rootfs/usr/bin +RUN find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / +ENTRYPOINT ["/usr/bin/lex"] +CMD ["-V"] diff --git a/src/kernel/build.mk b/src/kernel/build.mk new file mode 100644 index 0000000..363417e --- /dev/null +++ b/src/kernel/build.mk @@ -0,0 +1,6 @@ +.PHONY: nitro +nitro: \ + out/linux-nitro.tgz + +out/linux-nitro.tgz: out/linux-nitro.tgz + $(call build,kernel,linux-nitro) diff --git a/src/kernel/linux-generic/Dockerfile b/src/kernel/linux-generic/Dockerfile new file mode 100644 index 0000000..27c0b82 --- /dev/null +++ b/src/kernel/linux-generic/Dockerfile @@ -0,0 +1,29 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/musl:latest as musl +FROM ${REGISTRY}/stage3:latest as stage3 + +FROM stage3 as base +WORKDIR ${HOME} +ENV SRC_SITE https://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 make oldconfig default + +FROM build as package + +#FROM build as install +#USER 0:0 +#RUN set -eux; \ +# mkdir -p /rootfs/usr; \ +# find /rootfs -exec touch -hcd "@0" "{}" + +# +#FROM scratch as package +#COPY --from=install /rootfs /