From 6e57f2a1ccc5590985b97e1453b7dc3105094275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 9 Aug 2024 16:35:01 +0000 Subject: [PATCH] fix: build kernel directly instead of via hermit-playground MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- Dockerfile | 14 -------------- toolchain.sh | 36 +++++++++++++----------------------- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index cdb01c6..d10018c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM rust:bookworm AS builder RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - # gcc Build-Depends: bison \ git \ flex \ @@ -11,9 +10,6 @@ RUN set -eux; \ libmpc-dev \ libmpfr-dev \ texinfo \ - # libhermit-rs Build-Depends: - cmake \ - nasm \ ; \ rm -rf /var/lib/apt/lists/*; @@ -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 diff --git a/toolchain.sh b/toolchain.sh index 56552aa..eacabe6 100755 --- a/toolchain.sh +++ b/toolchain.sh @@ -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 @@ -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 cd - -fi if [ ! -d "tmp/newlib" ]; then mkdir -p tmp/newlib @@ -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 ..