build core with stage3
This commit is contained in:
parent
8286e33e52
commit
6a29777dc3
|
@ -215,7 +215,12 @@ RUN set -eux; \
|
|||
env -C ${MAKE_DIR} make DESTDIR=/rootfs install; \
|
||||
env -C ${GCC_DIR} make DESTDIR=/rootfs install; \
|
||||
cp -Rv ${LINUX_DIR}/* /rootfs/usr/include/; \
|
||||
mkdir -p /home/user; \
|
||||
cd /rootfs/; \
|
||||
ln -sT /lib lib64; \
|
||||
mkdir -p etc tmp var/tmp home/user; \
|
||||
echo "user:x:1000:" > etc/group; \
|
||||
echo "user:x:1000:1000::/home/user:/bin/sh" > etc/passwd; \
|
||||
chown -R 1000:1000 tmp var/tmp home/user; \
|
||||
find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
|
||||
FROM scratch as package
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/musl:latest as musl
|
||||
FROM ${REGISTRY}/bootstrap:latest as bootstrap
|
||||
FROM ${REGISTRY}/stage3 as stage3
|
||||
FROM ${REGISTRY}/musl as musl
|
||||
|
||||
FROM bootstrap as base
|
||||
FROM stage3 as base
|
||||
ENV SRC_SITE https://ftp.gnu.org/gnu/binutils
|
||||
ENV SRC_VERSION 2.41
|
||||
ENV SRC_HASH ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
|
||||
|
||||
FROM base as fetch
|
||||
WORKDIR ${HOME}
|
||||
RUN wget ${SRC_SITE}/binutils-${SRC_VERSION}.tar.xz
|
||||
RUN echo "${SRC_HASH} binutils-${SRC_VERSION}.tar.xz" | sha256sum -c
|
||||
RUN echo "${SRC_HASH} binutils-${SRC_VERSION}.tar.xz" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
RUN tar -xf binutils-${SRC_VERSION}.tar.xz
|
||||
|
|
|
@ -7,21 +7,21 @@ core: \
|
|||
out/gcc.tgz \
|
||||
out/llvm.tgz
|
||||
|
||||
out/musl.tgz: out/bootstrap.tgz
|
||||
out/musl.tgz: out/stage3.tgz
|
||||
$(call build,core,musl)
|
||||
|
||||
out/busybox.tgz: out/bootstrap.tgz
|
||||
out/busybox.tgz: out/stage3.tgz
|
||||
$(call build,core,busybox)
|
||||
|
||||
out/binutils.tgz: out/bootstrap.tgz
|
||||
out/binutils.tgz: out/stage3.tgz
|
||||
$(call build,core,binutils)
|
||||
|
||||
out/gcc.tgz: out/bootstrap.tgz out/musl.tgz
|
||||
$(call build,core,gcc)
|
||||
|
||||
out/make.tgz: out/bootstrap.tgz
|
||||
out/make.tgz: out/stage3.tgz
|
||||
$(call build,core,make)
|
||||
|
||||
out/gcc.tgz: out/stage3.tgz out/binutils.tgz out/musl.tgz
|
||||
$(call build,core,gcc)
|
||||
|
||||
out/bash.tgz: \
|
||||
out/busybox.tgz \
|
||||
out/gcc.tgz \
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/bootstrap as bootstrap
|
||||
FROM ${REGISTRY}/stage3 as stage3
|
||||
|
||||
FROM bootstrap as base
|
||||
FROM stage3 as base
|
||||
ENV SRC_SITE=https://busybox.net/downloads
|
||||
ENV SRC_VERSION=1.35.0
|
||||
ENV SRC_HASH=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694
|
||||
ENV SRC_VERSION=1.36.1
|
||||
ENV SRC_HASH=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314
|
||||
ENV SRC_FILE=busybox-${SRC_VERSION}.tar.bz2
|
||||
ENV KCONFIG_NOTIMESTAMP=1
|
||||
|
||||
FROM base as fetch
|
||||
WORKDIR /home/user
|
||||
WORKDIR ${HOME}
|
||||
RUN set -eux; \
|
||||
curl -O -J ${SRC_SITE}/${SRC_FILE}; \
|
||||
wget ${SRC_SITE}/${SRC_FILE}; \
|
||||
echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
|
@ -19,9 +19,6 @@ RUN tar -xjf ${SRC_FILE}
|
|||
WORKDIR busybox-${SRC_VERSION}
|
||||
RUN set -eux; \
|
||||
setConfs=' \
|
||||
CONFIG_AR=y \
|
||||
CONFIG_FEATURE_AR_CREATE=y \
|
||||
CONFIG_FEATURE_AR_LONG_FILENAMES=y \
|
||||
CONFIG_LAST_SUPPORTED_WCHAR=0 \
|
||||
CONFIG_STATIC=y \
|
||||
'; \
|
||||
|
@ -55,7 +52,7 @@ RUN set -eux; \
|
|||
for confV in $setConfs; do \
|
||||
grep -q "^$confV\$" .config; \
|
||||
done; \
|
||||
make
|
||||
make
|
||||
|
||||
FROM build as install
|
||||
USER 0:0
|
||||
|
@ -81,4 +78,4 @@ ENV TZ=UTC
|
|||
ENV LANG=C.UTF-8
|
||||
ENV SOURCE_DATE_EPOCH=1
|
||||
ENV KCONFIG_NOTIMESTAMP=1
|
||||
ENV PS1="busybox$ "
|
||||
ENV PS1="stage4 $ "
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/musl:latest as musl
|
||||
FROM ${REGISTRY}/binutils:latest as binutils
|
||||
FROM ${REGISTRY}/bootstrap:latest as bootstrap
|
||||
FROM ${REGISTRY}/stage3:latest as stage3
|
||||
|
||||
FROM bootstrap as base
|
||||
FROM stage3 as base
|
||||
ENV VERSION 12.2.0
|
||||
ENV SRC_FILE gcc-$VERSION.tar.xz
|
||||
ENV SRC_SITE https://mirrors.kernel.org/gnu/gcc/gcc-${VERSION}
|
||||
|
@ -19,6 +19,7 @@ ENV ISL_FILE isl-0.24.tar.bz2
|
|||
ENV ISL_HASH fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0
|
||||
|
||||
FROM base as fetch
|
||||
WORKDIR ${HOME}
|
||||
RUN set -eux; \
|
||||
wget ${SRC_SITE}/${SRC_FILE}; \
|
||||
echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c; \
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/musl:latest as musl
|
||||
FROM ${REGISTRY}/bootstrap:latest as base
|
||||
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
|
||||
RUN echo "${SRC_HASH} linux-${SRC_VERSION}.tar.xz" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
RUN tar -xf linux-${SRC_VERSION}.tar.xz
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/musl:latest as musl
|
||||
FROM ${REGISTRY}/bootstrap:latest as bootstrap
|
||||
FROM ${REGISTRY}/stage3 as stage3
|
||||
FROM ${REGISTRY}/musl as musl
|
||||
|
||||
FROM bootstrap as base
|
||||
FROM stage3 as base
|
||||
ENV SRC_SITE https://ftp.gnu.org/gnu/make
|
||||
ENV SRC_VERSION 4.4
|
||||
ENV SRC_HASH 581f4d4e872da74b3941c874215898a7d35802f03732bdccee1d4a7979105d18
|
||||
|
||||
FROM base as fetch
|
||||
WORKDIR ${HOME}
|
||||
RUN wget ${SRC_SITE}/make-${SRC_VERSION}.tar.gz
|
||||
RUN echo "${SRC_HASH} make-${SRC_VERSION}.tar.gz" | sha256sum -c
|
||||
RUN echo "${SRC_HASH} make-${SRC_VERSION}.tar.gz" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
RUN tar -xf make-${SRC_VERSION}.tar.gz
|
||||
WORKDIR make-${SRC_VERSION}
|
||||
RUN set -ex; \
|
||||
./configure \
|
||||
--build=x86_64-linux-musl \
|
||||
--host=x86_64-linux-musl \
|
||||
--target=x86_64-linux-musl \
|
||||
--build=${TARGET} \
|
||||
--host=${TARGET} \
|
||||
--prefix=/usr \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--disable-nls; \
|
||||
make -j "$(nproc)"
|
||||
make
|
||||
|
||||
FROM build as install
|
||||
USER 0:0
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
ARG REGISTRY=local
|
||||
FROM ${REGISTRY}/bootstrap:latest as bootstrap
|
||||
FROM ${REGISTRY}/stage3:latest as stage3
|
||||
|
||||
FROM bootstrap as base
|
||||
FROM stage3 as base
|
||||
ENV SRC_SITE http://musl.libc.org
|
||||
ENV SRC_VERSION 1.2.4
|
||||
ENV SRC_HASH 7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039
|
||||
ENV CFLAGS="-Os -fstack-clash-protection -Wformat -Werror=format-security"
|
||||
ENV CXXFLAGS="-Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1"
|
||||
ENV LDFLAGS="-Wl,--as-needed,-O1,--sort-common -Wl,-soname,libc.musl-x86_64.so.1"
|
||||
ENV LDFLAGS="-Wl,--as-needed,-O1,--sort-common -Wl,-soname,libc.musl-${ARCH}.so.1"
|
||||
|
||||
FROM base as fetch
|
||||
WORKDIR ${HOME}
|
||||
RUN wget ${SRC_SITE}/releases/musl-$SRC_VERSION.tar.gz
|
||||
RUN echo "${SRC_HASH} musl-${SRC_VERSION}.tar.gz" | sha256sum -c
|
||||
RUN echo "${SRC_HASH} musl-${SRC_VERSION}.tar.gz" | sha256sum -c
|
||||
|
||||
FROM fetch as build
|
||||
RUN tar -xzf musl-${SRC_VERSION}.tar.gz
|
||||
|
@ -22,8 +23,8 @@ RUN set -eux; \
|
|||
patch -p1 < lfs64.patch; \
|
||||
patch -p1 < lfs64-2.patch; \
|
||||
./configure \
|
||||
--build=x86_64-linux-musl \
|
||||
--host=x86_64-linux-musl \
|
||||
--build=${ARCH}-linux-musl \
|
||||
--host=${ARCH}-linux-musl \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--mandir=/usr/share/man \
|
||||
|
@ -37,12 +38,12 @@ USER 0:0
|
|||
RUN set -eux; \
|
||||
make DESTDIR=/rootfs install; \
|
||||
mkdir -p /rootfs/usr/bin; \
|
||||
printf "%s\n%s\n" '#!/bin/sh' 'exec /lib/ld-musl-x86_64.so.1 --list "$@"' \
|
||||
printf "%s\n%s\n" '#!/bin/sh' 'exec /lib/ld-musl-${ARCH}.so.1 --list "$@"' \
|
||||
> /rootfs/usr/bin/ldd; \
|
||||
chmod 755 /rootfs/usr/bin/ldd; \
|
||||
mv -f /rootfs/usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1; \
|
||||
ln -sf ld-musl-x86_64.so.1 /rootfs/lib/libc.musl-x86_64.so.1; \
|
||||
ln -sf ../../lib/ld-musl-x86_64.so.1 /rootfs/usr/lib/libc.so; \
|
||||
mv -f /rootfs/usr/lib/libc.so /rootfs/lib/ld-musl-${ARCH}.so.1; \
|
||||
ln -sf ld-musl-${ARCH}.so.1 /rootfs/lib/libc.musl-${ARCH}.so.1; \
|
||||
ln -sf ../../lib/ld-musl-${ARCH}.so.1 /rootfs/usr/lib/libc.so; \
|
||||
find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
|
||||
FROM scratch as package
|
||||
|
|
Reference in New Issue