Skip to content

Commit

Permalink
fix: build kernel directly instead of via hermit-playground
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 ee1311d commit 251b90a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 37 deletions.
14 changes: 0 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ FROM rust:bookworm AS builder
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# gcc Build-Depends:
bison \
git \
flex \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
texinfo \
# libhermit-rs Build-Depends:
cmake \
nasm \
; \
rm -rf /var/lib/apt/lists/*;

Expand All @@ -23,16 +19,6 @@ RUN ./toolchain.sh x86_64-hermit /opt/hermit


FROM rust:bookworm AS toolchain

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# libhermit-rs Build-Depends:
cmake \
nasm \
; \
rm -rf /var/lib/apt/lists/*;

COPY --from=builder /opt/hermit /opt/hermit
ENV PATH=/opt/hermit/bin:$PATH \
LD_LIBRARY_PATH=/opt/hermit/lib:$LD_LIBRARY_PATH
36 changes: 13 additions & 23 deletions toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ cargo update --package time --precise 0.3.11
popd
fi

if [ ! -d "kernel" ]; then
git clone https://github.com/hermit-os/kernel
fi

if [ ! -d "newlib" ]; then
git clone $CLONE_DEPTH -b path2rs https://github.com/hermit-os/newlib.git
fi
Expand Down Expand Up @@ -103,17 +107,16 @@ make install-gcc
cd -
fi

if [ ! -d "tmp/hermit" ]; then
mkdir -p tmp/hermit
cd tmp/hermit
cmake ../../hermit/ \
-DTOOLCHAIN_BIN_DIR=$PREFIX/bin \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBOOTSTRAP=true
make hermit
make hermit_rs-install
cp -r hermit/include $PREFIX/x86_64-hermit

cd kernel
cargo xtask build \
--arch x86_64 \
--release \
--no-default-features \
--features pci,smp,acpi,newlib,tcp,dhcpv4
cp target/x86_64/release/libhermit.a $PREFIX/x86_64-hermit/lib
cd -
fi

if [ ! -d "tmp/newlib" ]; then
mkdir -p tmp/newlib
Expand Down Expand Up @@ -159,17 +162,4 @@ make install
cd -
fi

if [ ! -d "tmp/final" ]; then
mkdir -p tmp/final
cd tmp/final
cmake ../../hermit \
-DTOOLCHAIN_BIN_DIR=$PREFIX/bin \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DMTUNE=native \
-DCMAKE_BUILD_TYPE=Release
make
make install
cd -
fi

cd ..

0 comments on commit 251b90a

Please sign in to comment.