Skip to content

Instantly share code, notes, and snippets.

@pranav083
Last active April 7, 2025 23:30
Show Gist options
  • Save pranav083/9dd30f1aef00cf9ec5a43d6c59b99b2d to your computer and use it in GitHub Desktop.
Save pranav083/9dd30f1aef00cf9ec5a43d6c59b99b2d to your computer and use it in GitHub Desktop.
testing kernel with rust
export PATH=~/kernel-tools/llvm-19.1.7-rust-1.86.0-x86_64/bin:$PATH
export LIBCLANG_PATH=~/kernel-tools/llvm-19.1.7-rust-1.86.0-x86_64/lib/libclang.so
echo "export PATH=$llvm_prefix/bin:\$PATH" >> ~/.bashrc
echo "export LIBCLANG_PATH=$llvm_prefix/lib" >> ~/.bashrc
export PATH=$llvm_prefix/bin:$PATH
export RUSTC=/home/pranav/kernel-tools/llvm-19.1.7-rust-1.86.0-x86_64/bin/rustc
export BINDGEN=/home/pranav/kernel-tools/llvm-19.1.7-rust-1.86.0-x86_64/bin/bindgen
export PATH=/home/pranav/kernel-tools/llvm-19.1.7-rust-1.86.0-x86_64/bin:$PATH
source ~/.bashrc
@pranav083
Copy link
Author

@pranav083
Copy link
Author

pranav083 commented Apr 7, 2025

https://hackerbikepacker.com/rust-in-linux-kernel-configuration

avoid this line from above setup

rustup override set $(scripts/min-tool-version.sh rustc)

rust@linuxrust:~/linux$ make LLVM=1 rustavailable
Rust is available!
rust@linuxrust:~/linux$ clang --version
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /lib/llvm-18/bin
rust@linuxrust:~/linux$ rustc -vV
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1
rust@linuxrust:~/linux$ 

make LLVM=1 KCFLAGS="-Wno-frame-larger-than" -j$(nproc) > build.log 2> error.log

rest follow from the above build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment