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 9, 2024
1 parent 326cae9 commit 97ab14d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
14 changes: 12 additions & 2 deletions 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#hermit-c /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 @@ -20,9 +30,9 @@ RUN set -eux; \

WORKDIR /root

COPY --link --from=kernel /kernel/libhermit.a ./kernel/libhermit.a
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/kernel.git#hermit-c kernel
ADD --link https://github.com/hermit-os/newlib.git newlib
ADD --link https://github.com/hermit-os/pthread-embedded.git pte
ADD --link ./toolchain.sh ./toolchain.sh
Expand Down
10 changes: 1 addition & 9 deletions toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ make install-gcc
cd -
fi

cd kernel
cargo xtask build \
--artifact-dir . \
--arch x86_64 \
--release \
--no-default-features \
--features pci,smp,acpi,newlib,tcp,dhcpv4
export LDFLAGS_FOR_TARGET=-L$PWD
cd -
export LDFLAGS_FOR_TARGET=-L/root/kernel

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

0 comments on commit 97ab14d

Please sign in to comment.