Skip to content

Commit 59ebcc3

Browse files
mkchaurasmpe
authored andcommitted
rust: Support for rust enable builds
Enabling ppc64le rust build support. Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
1 parent 9dc6913 commit 59ebcc3

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

build/scripts/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ if [[ "$task" == "kernel" ]]; then
177177
if [[ -n "$LLVM" ]]; then
178178
cmd+="-e LLVM=$LLVM "
179179
fi
180+
181+
if [[ -n "$RUST" ]]; then
182+
cmd+="-e RUST=$RUST "
183+
fi
180184
fi
181185

182186
if [[ "$task" == "ppctests" ]]; then

build/scripts/container-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ rc=0
4040

4141
if [[ "$1" == "kernel" ]]; then
4242
cc="${CROSS_COMPILE}gcc"
43+
44+
# As rust is supported via LLVM
45+
if [[ -n "$RUST" ]]; then
46+
LLVM=1
47+
fi
48+
4349
if [[ -n "$CLANG" || -n "$LLVM" ]]; then
4450
cc="clang"
4551
fi
@@ -68,6 +74,11 @@ if [[ "$1" == "kernel" ]]; then
6874
(set -x; make $verbose $quiet $llvm "$cc" $DEFCONFIG)
6975
fi
7076

77+
if [[ -n "$RUST" ]]; then
78+
echo "Enabling RUST...!!!"
79+
(set -x; make $verbose $quiet $llvm "$cc" rustavailable)
80+
fi
81+
7182
if [[ -n "$MERGE_CONFIG" ]]; then
7283
echo "## MERGE_CONFIG = $MERGE_CONFIG"
7384

build/ubuntu/Dockerfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ RUN apt-get -q -y update && \
1515
DEBIAN_FRONTEND=noninteractive \
1616
apt-get -q -y install --no-install-recommends \
1717
bc \
18+
bindgen \
1819
bison \
1920
bsdmainutils \
2021
bzip2 \
2122
ca-certificates \
2223
ccache \
2324
cpio \
2425
crossbuild-essential-powerpc \
26+
curl \
2527
gcc-multilib-powerpc-linux-gnu \
2628
dwarves \
2729
file \
@@ -37,6 +39,8 @@ RUN apt-get -q -y update && \
3739
libfuse-dev \
3840
liblz4-tool \
3941
libssl-dev \
42+
lld \
43+
llvm \
4044
lzop \
4145
make \
4246
openssl \
@@ -45,11 +49,23 @@ RUN apt-get -q -y update && \
4549
u-boot-tools \
4650
rename \
4751
rsync \
52+
rustc \
53+
rustfmt \
54+
rust-clippy \
55+
rust-src \
4856
sparse \
4957
xz-utils \
5058
$(/tmp/packages.sh) && \
5159
rm -rf /var/lib/apt/lists/* /tmp/packages.sh /var/cache/* /var/log/dpkg.log
52-
60+
ENV RUSTUP_HOME=/opt/rustup
61+
ENV CARGO_HOME=/opt/cargo
62+
ENV PATH="/opt/cargo/bin:${PATH}"
63+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
64+
sh -s -- -y --no-modify-path
65+
RUN rustup toolchain install nightly-2026-01-28 \
66+
&& rustup default nightly-2026-01-28 \
67+
&& rustup component add rust-src --toolchain nightly-2026-01-28 \
68+
&& cargo install --locked bindgen-cli
5369
COPY ubuntu/make-links.sh /tmp/make-links.sh
5470
RUN /tmp/make-links.sh ${compiler_version} && rm /tmp/make-links.sh
5571

0 commit comments

Comments
 (0)