From f950f66b791b3c71110547cfbfc6a253efd96f7f Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Mon, 5 Feb 2024 02:42:27 -0800 Subject: [PATCH] generic kernel building support --- src/compat.sh | 0 src/core/argp-standalone/Dockerfile | 1 + src/core/build.mk | 86 +++++++++++++++++++++++++---- src/core/elfutils/Dockerfile | 63 +++++++++++++++++++++ src/core/elfutils/musl-macros.patch | 78 ++++++++++++++++++++++++++ src/core/libzstd/Dockerfile | 76 +++++++++++++++++++++++++ src/core/llvm/Dockerfile | 2 + src/core/meson/Dockerfile | 32 +++++++++++ src/core/musl-obstack/Dockerfile | 47 ++++++++++++++++ src/core/musl/Dockerfile | 4 +- src/core/musl/relr-typedefs.patch | 28 ++++++++++ src/core/py-setuptools/Dockerfile | 2 + src/core/python/Dockerfile | 2 + src/kernel/build.mk | 22 ++++++-- src/kernel/linux-generic/Dockerfile | 43 +++++++++------ src/macros.mk | 1 + 16 files changed, 454 insertions(+), 33 deletions(-) mode change 100644 => 100755 src/compat.sh create mode 100644 src/core/elfutils/Dockerfile create mode 100644 src/core/elfutils/musl-macros.patch create mode 100644 src/core/libzstd/Dockerfile create mode 100644 src/core/meson/Dockerfile create mode 100644 src/core/musl-obstack/Dockerfile create mode 100644 src/core/musl/relr-typedefs.patch diff --git a/src/compat.sh b/src/compat.sh old mode 100644 new mode 100755 diff --git a/src/core/argp-standalone/Dockerfile b/src/core/argp-standalone/Dockerfile index 1bac8a0..ac03c82 100644 --- a/src/core/argp-standalone/Dockerfile +++ b/src/core/argp-standalone/Dockerfile @@ -31,6 +31,7 @@ WORKDIR argp-standalone-${VERSION} RUN ls -lah RUN set -eux; \ autoreconf -vif; \ + CFLAGS="-fPIC" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ diff --git a/src/core/build.mk b/src/core/build.mk index 8270f16..41d3383 100644 --- a/src/core/build.mk +++ b/src/core/build.mk @@ -133,6 +133,7 @@ out/python.tgz: \ out/binutils.tgz \ out/busybox.tgz \ out/openssl.tgz \ + out/zlib.tgz \ out/make.tgz \ out/musl.tgz $(call build,core,python) @@ -159,7 +160,8 @@ out/cmake.tgz: \ out/py-setuptools.tgz: \ out/busybox.tgz \ - out/python.tgz + out/python.tgz \ + out/zlib.tgz $(call build,core,py-setuptools) out/zlib.tgz: \ @@ -179,6 +181,7 @@ out/llvm13.tgz: \ out/cmake.tgz \ out/ninja.tgz \ out/busybox.tgz \ + out/zlib.tgz \ out/musl.tgz $(call build,core,llvm,13.0.1) @@ -191,6 +194,7 @@ out/llvm.tgz: \ out/cmake.tgz \ out/ninja.tgz \ out/busybox.tgz \ + out/zlib.tgz \ out/musl.tgz $(call build,core,llvm) $(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16 @@ -289,16 +293,7 @@ out/gettext.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 \ @@ -309,3 +304,74 @@ out/flex.tgz: \ out/musl.tgz \ out/make.tgz $(call build,core,flex) + +out/argp-standalone.tgz: \ + out/libtool.tgz \ + out/automake.tgz \ + out/autoconf.tgz \ + out/make.tgz \ + out/musl.tgz \ + out/m4.tgz \ + out/gcc.tgz + $(call build,core,argp-standalone) + +out/musl-fts.tgz: \ + out/libtool.tgz \ + out/automake.tgz \ + out/autoconf.tgz \ + out/make.tgz \ + out/musl.tgz \ + out/m4.tgz \ + out/pkgconf.tgz \ + out/gcc.tgz + $(call build,core,musl-fts) + +out/musl-obstack.tgz: \ + out/libtool.tgz \ + out/automake.tgz \ + out/autoconf.tgz \ + out/make.tgz \ + out/musl.tgz \ + out/m4.tgz \ + out/pkgconf.tgz \ + out/gcc.tgz + $(call build,core,musl-obstack) + +out/meson.tgz: \ + out/busybox.tgz \ + out/cmake.tgz \ + out/llvm.tgz \ + out/python.tgz \ + out/py-setuptools.tgz \ + out/linux-headers.tgz \ + out/zlib.tgz + $(call build,core,meson) + +out/libzstd.tgz: \ + out/busybox.tgz \ + out/meson.tgz \ + out/python.tgz \ + out/zlib.tgz + $(call build,core,libzstd) + +out/elfutils.tgz: \ + out/busybox.tgz \ + out/argp-standalone.tgz \ + out/musl.tgz \ + out/musl-fts.tgz \ + out/musl-obstack.tgz \ + out/binutils.tgz \ + out/bison.tgz \ + out/flex.tgz \ + out/linux-headers.tgz \ + out/libtool.tgz \ + out/gettext.tgz \ + out/libzstd.tgz \ + out/pkgconf.tgz \ + out/autoconf.tgz \ + out/automake.tgz \ + out/m4.tgz \ + out/make.tgz \ + out/gcc.tgz \ + out/zlib.tgz + $(call build,core,elfutils) diff --git a/src/core/elfutils/Dockerfile b/src/core/elfutils/Dockerfile new file mode 100644 index 0000000..28868e5 --- /dev/null +++ b/src/core/elfutils/Dockerfile @@ -0,0 +1,63 @@ +FROM stagex/busybox as base +ENV VERSION=0.190 +ENV SRC_FILE=elfutils-${VERSION}.tar.bz2 +ENV SRC_SITE=https://sourceware.org/elfutils/ftp/${VERSION}/${SRC_FILE} +ENV SRC_HASH=8e00a3a9b5f04bc1dc273ae86281d2d26ed412020b391ffcc23198f10231d692 +COPY --from=stagex/gcc . / +COPY --from=stagex/binutils . / +COPY --from=stagex/make . / +COPY --from=stagex/bison . / +COPY --from=stagex/libtool . / +COPY --from=stagex/zlib . / +COPY --from=stagex/libzstd . / +COPY --from=stagex/flex . / +COPY --from=stagex/autoconf . / +COPY --from=stagex/automake . / +COPY --from=stagex/pkgconf . / +COPY --from=stagex/gettext . / +COPY --from=stagex/m4 . / +COPY --from=stagex/argp-standalone . / +COPY --from=stagex/musl . / +COPY --from=stagex/musl-fts . / +COPY --from=stagex/musl-obstack . / +COPY --from=stagex/linux-headers . / + +FROM base as fetch +RUN wget --no-check-certificate ${SRC_SITE} -O ${SRC_FILE} +RUN echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN set -eux; \ + tar -xjf ${SRC_FILE} +WORKDIR elfutils-${VERSION} +ADD *.patch . +RUN set -eux; \ + patch -p1 < musl-macros.patch; \ + autoreconf -vif; \ + CFLAGS="-D_GNU_SOURCE -Wno-error -Wno-null-dereference" \ + ./configure \ + --build="x86_64-linux-musl" \ + --host="x86_64-linux-musl" \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --program-prefix=eu- \ + --enable-deterministic-archives \ + --disable-nls \ + --disable-progs \ + --disable-libdebuginfod \ + --disable-debuginfod \ + --with-zstd; \ + make + +FROM build as install +USER 0:0 +RUN set -eux; \ + mkdir -p /rootfs; \ + make DESTDIR=/rootfs install; \ + find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/core/elfutils/musl-macros.patch b/src/core/elfutils/musl-macros.patch new file mode 100644 index 0000000..d1bf92e --- /dev/null +++ b/src/core/elfutils/musl-macros.patch @@ -0,0 +1,78 @@ +diff -ur elfutils-0.187.orig/lib/libeu.h elfutils-0.187/lib/libeu.h +--- elfutils-0.187.orig/lib/libeu.h 2022-06-16 18:48:12.916472948 +0200 ++++ elfutils-0.187/lib/libeu.h 2022-06-16 18:48:54.219839323 +0200 +@@ -31,6 +31,18 @@ + + #include + #include ++#include ++#include ++#include ++ ++#ifndef TEMP_FAILURE_RETRY ++#define TEMP_FAILURE_RETRY(expression) \ ++ (__extension__ \ ++ ({ long int __result; \ ++ do __result = (long int) (expression); \ ++ while (__result == -1L && errno == EINTR); \ ++ __result; })) ++#endif + + extern void *xmalloc (size_t) __attribute__ ((__malloc__)); + extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__)); +diff -ur elfutils-0.187.orig/src/arlib.h elfutils-0.187/src/arlib.h +--- elfutils-0.187.orig/src/arlib.h 2022-06-16 18:48:12.919806284 +0200 ++++ elfutils-0.187/src/arlib.h 2022-06-16 18:48:18.879811052 +0200 +@@ -29,6 +29,16 @@ + #include + #include + ++#if !defined(ACCESSPERMS) ++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ ++#endif ++#if !defined(ALLPERMS) ++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ ++#endif ++#if !defined(DEFFILEMODE) ++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ ++#endif ++ + + /* State of -D/-U flags. */ + extern bool arlib_deterministic_output; +diff -ur elfutils-0.187.orig/src/elfcompress.c elfutils-0.187/src/elfcompress.c +--- elfutils-0.187.orig/src/elfcompress.c 2022-06-16 18:48:12.919806284 +0200 ++++ elfutils-0.187/src/elfcompress.c 2022-06-16 18:48:18.879811052 +0200 +@@ -37,6 +37,14 @@ + #include "libeu.h" + #include "printversion.h" + ++#if !defined(FNM_EXTMATCH) ++# define FNM_EXTMATCH 0 ++#endif ++ ++#if !defined(ALLPERMS) ++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ ++#endif ++ + /* Name and version of program. */ + ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; + +diff -ur elfutils-0.187.orig/src/strip.c elfutils-0.187/src/strip.c +--- elfutils-0.187.orig/src/strip.c 2022-06-16 18:48:12.919806284 +0200 ++++ elfutils-0.187/src/strip.c 2022-06-16 18:48:18.879811052 +0200 +@@ -46,6 +46,14 @@ + #include + #include + ++#if !defined(FNM_EXTMATCH) ++# define FNM_EXTMATCH 0 ++#endif ++ ++#if !defined(ACCESSPERMS) ++#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) ++#endif ++ + typedef uint8_t GElf_Byte; + + /* Name and version of program. */ diff --git a/src/core/libzstd/Dockerfile b/src/core/libzstd/Dockerfile new file mode 100644 index 0000000..78e41a4 --- /dev/null +++ b/src/core/libzstd/Dockerfile @@ -0,0 +1,76 @@ +FROM stagex/busybox as base +ENV VERSION=1.5.5 +ENV SRC_FILE=v${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/facebook/zstd/archive/${SRC_FILE} +ENV SRC_HASH=98e9c3d949d1b924e28e01eccb7deed865eefebf25c2f21c702e5cd5b63b85e1 +COPY --from=stagex/python . / +COPY --from=stagex/gcc . / +COPY --from=stagex/musl . / +COPY --from=stagex/meson . / +COPY --from=stagex/ninja . / +COPY --from=stagex/binutils . / +COPY --from=stagex/pkgconf . / +COPY --from=stagex/zlib . / + +FROM base as fetch +RUN set -eux; \ + wget ${SRC_SITE}; \ + echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xf ${SRC_FILE} +WORKDIR zstd-${VERSION} +RUN set -eux; \ + meson env2mfile \ + --native \ + --system=linux \ + --cpu-family=x86_64 \ + --cpu=x86_64 \ + --endian=little \ + -o meson.cross; \ + meson setup \ + --prefix=/usr \ + --libdir=/usr/lib \ + --libexecdir=/usr/libexec \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --includedir=/usr/include \ + --datadir=/usr/share \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localedir=/usr/share/locale \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --sharedstatedir=/var/lib \ + --buildtype=plain \ + --auto-features=auto \ + --wrap-mode=nodownload \ + --default-library=both \ + --cross-file=meson.cross \ + -Dbacktrace=disabled \ + -Db_lto=false \ + -Db_staticpic=true \ + -Db_pie=true \ + -Dpython.bytecompile=0 \ + -Dwerror=false \ + -Db_ndebug=true \ + -Dbin_tests=false \ + -Dbin_contrib=false \ + -Dbin_programs=true \ + -Dbacktrace=disabled \ + -Dmulti_thread=enabled \ + -Dlz4=disabled \ + -Dlzma=disabled \ + -Dzlib=disabled \ + build/meson \ + output; \ + meson compile -C output + +FROM build as install +USER 0:0 +RUN set -eux; \ + DESTDIR=/rootfs meson install --no-rebuild -C output; \ + find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/core/llvm/Dockerfile b/src/core/llvm/Dockerfile index dd68417..00f2552 100644 --- a/src/core/llvm/Dockerfile +++ b/src/core/llvm/Dockerfile @@ -10,6 +10,7 @@ FROM ${REGISTRY}/cmake as cmake FROM ${REGISTRY}/ninja as ninja FROM ${REGISTRY}/busybox as busybox FROM ${REGISTRY}/openssl as openssl +FROM ${REGISTRY}/zlib as zlib FROM busybox as base ARG VERSION @@ -25,6 +26,7 @@ COPY --from=musl . / COPY --from=gcc . / COPY --from=python . / COPY --from=py-setuptools . / +COPY --from=zlib . / COPY --from=openssl . / FROM base as fetch diff --git a/src/core/meson/Dockerfile b/src/core/meson/Dockerfile new file mode 100644 index 0000000..706935c --- /dev/null +++ b/src/core/meson/Dockerfile @@ -0,0 +1,32 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/python as python +FROM ${REGISTRY}/py-setuptools as py-setuptools +FROM ${REGISTRY}/zlib as zlib + +FROM busybox as base +ENV VERSION=1.3.1 +ENV SRC_FILE=meson-${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/mesonbuild/meson/releases/download/${VERSION}/${SRC_FILE} +ENV SRC_HASH=6020568bdede1643d4fb41e28215be38eff5d52da28ac7d125457c59e0032ad7 +COPY --from=python . / +COPY --from=py-setuptools . / +COPY --from=zlib . / + +FROM base as fetch +RUN set -eux; \ + wget ${SRC_SITE}; \ + echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xf ${SRC_FILE} +WORKDIR meson-${VERSION} +RUN python setup.py build; + +FROM build as install +USER 0:0 +RUN set -eux; \ + python setup.py install --root=/rootfs; \ + find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/core/musl-obstack/Dockerfile b/src/core/musl-obstack/Dockerfile new file mode 100644 index 0000000..ad207e2 --- /dev/null +++ b/src/core/musl-obstack/Dockerfile @@ -0,0 +1,47 @@ +ARG REGISTRY=local +FROM ${REGISTRY}/busybox as busybox +FROM ${REGISTRY}/gcc as gcc +FROM ${REGISTRY}/binutils as binutils +FROM ${REGISTRY}/musl as musl +FROM ${REGISTRY}/make as make +FROM ${REGISTRY}/autoconf as autoconf +FROM ${REGISTRY}/automake as automake +FROM ${REGISTRY}/libtool as libtool +FROM ${REGISTRY}/m4 as m4 +FROM ${REGISTRY}/pkgconf as pkgconf + +FROM busybox as base +ENV VERSION=1.2.3 +ENV SRC_FILE=v${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/void-linux/musl-obstack/archive/refs/tags/${SRC_FILE} +ENV SRC_HASH=9ffb3479b15df0170eba4480e51723c3961dbe0b461ec289744622db03a69395 +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +COPY --from=autoconf . / +COPY --from=automake . / +COPY --from=libtool . / +COPY --from=pkgconf . / +COPY --from=m4 . / + +FROM base as fetch +RUN wget ${SRC_SITE} +RUN echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c + +FROM fetch as build +RUN tar -xzf ${SRC_FILE} +WORKDIR musl-obstack-${VERSION} +RUN set -eux; \ + ./bootstrap.sh; \ + ./configure --prefix=/usr; \ + make + +FROM build as install +USER 0:0 +RUN set -eux; \ + make DESTDIR=/rootfs install; \ + find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/core/musl/Dockerfile b/src/core/musl/Dockerfile index 74128d6..2852671 100644 --- a/src/core/musl/Dockerfile +++ b/src/core/musl/Dockerfile @@ -17,11 +17,11 @@ RUN echo "${SRC_HASH} musl-${SRC_VERSION}.tar.gz" | sha256sum -c FROM fetch as build RUN tar -xzf musl-${SRC_VERSION}.tar.gz WORKDIR musl-${SRC_VERSION} -ADD lfs64.patch . -ADD lfs64-2.patch . +ADD *.patch . RUN set -eux; \ patch -p1 < lfs64.patch; \ patch -p1 < lfs64-2.patch; \ + patch -p1 < relr-typedefs.patch; \ ./configure \ --build=${ARCH}-linux-musl \ --host=${ARCH}-linux-musl \ diff --git a/src/core/musl/relr-typedefs.patch b/src/core/musl/relr-typedefs.patch new file mode 100644 index 0000000..7b5d1fb --- /dev/null +++ b/src/core/musl/relr-typedefs.patch @@ -0,0 +1,28 @@ +From 981144ebc9ff30b085af107f1337543de7b0bf94 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Mon, 6 Nov 2023 12:29:16 +0100 +Subject: [PATCH] elf.h: add typedefs for Elf*_Relr + +Add typedefs for Elf32_Relr and Elf64_relr as a follow-up to commit +d32dadd60efb (ldso: support DT_RELR relative relocation format) +--- + include/elf.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/elf.h b/include/elf.h +index 23f2c4bc..aa186d9d 100644 +--- a/include/elf.h ++++ b/include/elf.h +@@ -32,6 +32,9 @@ typedef uint16_t Elf64_Section; + typedef Elf32_Half Elf32_Versym; + typedef Elf64_Half Elf64_Versym; + ++typedef Elf32_Word Elf32_Relr; ++typedef Elf64_Xword Elf64_Relr; ++ + #define EI_NIDENT (16) + + typedef struct { +-- +2.42.1 + diff --git a/src/core/py-setuptools/Dockerfile b/src/core/py-setuptools/Dockerfile index dbd1e56..3d89be5 100644 --- a/src/core/py-setuptools/Dockerfile +++ b/src/core/py-setuptools/Dockerfile @@ -1,12 +1,14 @@ ARG REGISTRY=local FROM ${REGISTRY}/python:latest as python FROM ${REGISTRY}/busybox:latest as busybox +FROM ${REGISTRY}/zlib:latest as zlib FROM busybox as base ENV SRC_SITE=https://pypi.io/packages/source/s/setuptools ENV SRC_VERSION=68.2.2 ENV SRC_HASH=4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87 COPY --from=python . / +COPY --from=zlib . / FROM base as fetch RUN wget ${SRC_SITE}/setuptools-${SRC_VERSION}.tar.gz diff --git a/src/core/python/Dockerfile b/src/core/python/Dockerfile index 118cbf0..7fc74cc 100644 --- a/src/core/python/Dockerfile +++ b/src/core/python/Dockerfile @@ -4,6 +4,7 @@ FROM ${REGISTRY}/binutils:latest as binutils FROM ${REGISTRY}/musl:latest as musl FROM ${REGISTRY}/make:latest as make FROM ${REGISTRY}/openssl:latest as openssl +FROM ${REGISTRY}/zlib:latest as zlib FROM ${REGISTRY}/busybox:latest as busybox FROM busybox as base @@ -23,6 +24,7 @@ COPY --from=binutils . / COPY --from=make . / COPY --from=musl . / COPY --from=openssl . / +COPY --from=zlib . / ENV PYTHONHASHSEED=0 ENV PYTHONDONTWRITEBYTECODE=1 RUN set -eux; \ diff --git a/src/kernel/build.mk b/src/kernel/build.mk index 363417e..a8001d7 100644 --- a/src/kernel/build.mk +++ b/src/kernel/build.mk @@ -1,6 +1,18 @@ -.PHONY: nitro -nitro: \ - out/linux-nitro.tgz +.PHONY: linux +linux: \ + out/linux-generic.tgz -out/linux-nitro.tgz: out/linux-nitro.tgz - $(call build,kernel,linux-nitro) +out/linux-generic.tgz: \ + out/gcc.tgz \ + out/binutils.tgz \ + out/make.tgz \ + out/musl.tgz \ + out/bison.tgz \ + out/pkgconf.tgz \ + out/libzstd.tgz \ + out/openssl.tgz \ + out/perl.tgz \ + out/zlib.tgz \ + out/flex.tgz \ + out/libelf.tgz + $(call build,kernel,linux-generic) diff --git a/src/kernel/linux-generic/Dockerfile b/src/kernel/linux-generic/Dockerfile index 27c0b82..27819b6 100644 --- a/src/kernel/linux-generic/Dockerfile +++ b/src/kernel/linux-generic/Dockerfile @@ -1,10 +1,6 @@ -ARG REGISTRY=local -FROM ${REGISTRY}/musl:latest as musl -FROM ${REGISTRY}/stage3:latest as stage3 - -FROM stage3 as base +FROM stagex/busybox as base WORKDIR ${HOME} -ENV SRC_SITE https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/ +ENV SRC_SITE http://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/ ENV SRC_VERSION 6.6 ENV SRC_HASH d926a06c63dd8ac7df3f86ee1ffc2ce2a3b81a2d168484e76b5b389aba8e56d0 @@ -15,15 +11,30 @@ 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 +COPY --from=stagex/musl . / +COPY --from=stagex/make . / +COPY --from=stagex/binutils . / +COPY --from=stagex/linux-headers . / +COPY --from=stagex/elfutils . / +COPY --from=stagex/openssl . / +COPY --from=stagex/perl . / +COPY --from=stagex/m4 . / +COPY --from=stagex/gcc . / +COPY --from=stagex/bison . / +COPY --from=stagex/libzstd . / +COPY --from=stagex/zlib . / +COPY --from=stagex/flex . / +COPY --from=stagex/pkgconf . / +RUN set -eux; \ + make oldconfig +RUN make -FROM build as package +FROM build as install +USER 0:0 +RUN set -eux; \ + make DESTDIR=/rootfs install; \ + mkdir -p /rootfs/usr; \ + find /rootfs -exec touch -hcd "@0" "{}" + -#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 / +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/macros.mk b/src/macros.mk index 937ca8b..180cf6d 100644 --- a/src/macros.mk +++ b/src/macros.mk @@ -44,6 +44,7 @@ define build $(EXTRA_ARGS) \ $(NOCACHE_FLAG) \ src/$(CATEGORY)/$(NAME) \ + && tar -tf $(basename $@).tar \ && gzip < $(basename $@).tar > $@ \ && rm $(basename $@).tar \ && gunzip -c $@ | docker load; \