Skip to content

Commit

Permalink
refactor: move kernel build into independent Docker layer
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Aug 13, 2024
1 parent 9ef3ed8 commit f361354
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
FROM rust:bookworm AS builder
FROM --platform=$BUILDPLATFORM rust:bookworm AS kernel
ADD --link https://github.com/hermit-os/kernel.git /kernel
WORKDIR /kernel
RUN cargo xtask build \
--artifact-dir . \
--arch x86_64 \
--release \
--no-default-features \
--features pci,smp,acpi,newlib,tcp,dhcpv4

FROM buildpack-deps:bookworm AS builder

RUN set -eux; \
apt-get update; \
Expand All @@ -15,6 +25,9 @@ RUN set -eux; \

WORKDIR /root

COPY --link --from=kernel /kernel/libhermit.a /root/kernel/libhermit.a
ENV LDFLAGS_FOR_TARGET="-L/root/target/x86_64/release -lhermit"

ADD --link https://github.com/hermit-os/binutils.git binutils
ADD --link https://github.com/hermit-os/gcc.git gcc
ADD --link https://github.com/hermit-os/hermit-playground.git hermit
Expand Down
9 changes: 0 additions & 9 deletions toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ make install-gcc
cd -
fi

cd kernel
cargo xtask build \
--arch x86_64 \
--release \
--no-default-features \
--features pci,smp,acpi,newlib,tcp,dhcpv4
export LDFLAGS_FOR_TARGET="-L$PWD/target/x86_64/release -lhermit"
cd -

if [ ! -d "tmp/newlib" ]; then
mkdir -p tmp/newlib
cd tmp/newlib
Expand Down

0 comments on commit f361354

Please sign in to comment.