diff --git a/build/scripts/build.sh b/build/scripts/build.sh index 2f0d942..f93babe 100755 --- a/build/scripts/build.sh +++ b/build/scripts/build.sh @@ -177,6 +177,10 @@ if [[ "$task" == "kernel" ]]; then if [[ -n "$LLVM" ]]; then cmd+="-e LLVM=$LLVM " fi + + if [[ -n "$RUST" ]]; then + cmd+="-e RUST=$RUST " + fi fi if [[ "$task" == "ppctests" ]]; then diff --git a/build/scripts/container-build.sh b/build/scripts/container-build.sh index de7a059..d9f9ac6 100755 --- a/build/scripts/container-build.sh +++ b/build/scripts/container-build.sh @@ -40,6 +40,12 @@ rc=0 if [[ "$1" == "kernel" ]]; then cc="${CROSS_COMPILE}gcc" + + # As rust is supported via LLVM + if [[ -n "$RUST" ]]; then + LLVM=1 + fi + if [[ -n "$CLANG" || -n "$LLVM" ]]; then cc="clang" fi @@ -68,6 +74,11 @@ if [[ "$1" == "kernel" ]]; then (set -x; make $verbose $quiet $llvm "$cc" $DEFCONFIG) fi + if [[ -n "$RUST" ]]; then + echo "Enabling RUST...!!!" + (set -x; make $verbose $quiet $llvm "$cc" rustavailable) + fi + if [[ -n "$MERGE_CONFIG" ]]; then echo "## MERGE_CONFIG = $MERGE_CONFIG" diff --git a/build/ubuntu/Dockerfile b/build/ubuntu/Dockerfile index 6d34556..9fda169 100644 --- a/build/ubuntu/Dockerfile +++ b/build/ubuntu/Dockerfile @@ -15,6 +15,7 @@ RUN apt-get -q -y update && \ DEBIAN_FRONTEND=noninteractive \ apt-get -q -y install --no-install-recommends \ bc \ + bindgen \ bison \ bsdmainutils \ bzip2 \ @@ -22,6 +23,7 @@ RUN apt-get -q -y update && \ ccache \ cpio \ crossbuild-essential-powerpc \ + curl \ gcc-multilib-powerpc-linux-gnu \ dwarves \ file \ @@ -37,6 +39,8 @@ RUN apt-get -q -y update && \ libfuse-dev \ liblz4-tool \ libssl-dev \ + lld \ + llvm \ lzop \ make \ openssl \ @@ -45,11 +49,23 @@ RUN apt-get -q -y update && \ u-boot-tools \ rename \ rsync \ + rustc \ + rustfmt \ + rust-clippy \ + rust-src \ sparse \ xz-utils \ $(/tmp/packages.sh) && \ rm -rf /var/lib/apt/lists/* /tmp/packages.sh /var/cache/* /var/log/dpkg.log - +ENV RUSTUP_HOME=/opt/rustup +ENV CARGO_HOME=/opt/cargo +ENV PATH="/opt/cargo/bin:${PATH}" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --no-modify-path +RUN rustup toolchain install nightly-2026-01-28 \ + && rustup default nightly-2026-01-28 \ + && rustup component add rust-src --toolchain nightly-2026-01-28 \ + && cargo install --locked bindgen-cli COPY ubuntu/make-links.sh /tmp/make-links.sh RUN /tmp/make-links.sh ${compiler_version} && rm /tmp/make-links.sh