Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build kernel directly instead of via hermit-playground #39

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ..