i followed the steps of fishinabarrel/linux-kernel-module-rust: Framework for writing Linux kernel modules in safe Rust (github.com)
but when i perform 'make', it outputs γ
/linux-kernel-module-rust-master/hello-world; cargo build -Z build-std=core,alloc --target=x86_64-linux-kernel
error: failed to run rustc
to learn about target-specific information
Caused by:
process didn't exit successfully: rustc - --crate-name ___ --print=file-names --target x86_64-linux-kernel --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg
(exit status: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "x86_64-linux-kernel". Run rustc --print target-list
for a list of built-in targetsγ
then I modified the Kbulid
< cd $(src); $(CARGO) build -Z build-std=core,alloc --target=x86_64-unknown-linux-gnu
cd $(src); $(CARGO) build -Z build-std=core,alloc --target=x86_64-linux-kernel
i output another new error messages γ
error: failed to run custom build command for linux-kernel-module v0.1.0 (/home/linjia/rcode/linux-kernel-module-rust-master)
Caused by:
process didn't exit successfully: `/home/linjia/rcode/linux-kernel-module-rust-master/hello-world/target/debug/build/linux-kernel-module-9c202ec5f917d
--- stdout
cargo:rerun-if-env-changed=CC
cargo:rerun-if-env-changed=KDIR
cargo:rerun-if-env-changed=c_flags
cargo:rerun-if-changed=src/bindings_helper.h
--- stderr
/lib/modules/5.4.0-135-generic/build/./arch/x86/include/asm/segment.h:266:2: error: expected '(' after 'asm'
/lib/modules/5.4.0-135-generic/build/./arch/x86/include/asm/page_64.h:49:2: error: expected '(' after 'asm'
/lib/modules/5.4.0-135-generic/build/./arch/x86/include/asm/special_insns.h:207:2: error: expected '(' after 'asm'
/lib/modules/5.4.0-135-generic/build/./arch/x86/include/asm/processor.h:786:2: error: expected '(' after 'asm'
/lib/modules/5.4.0-135-generic/build/./arch/x86/include/asm/processor.h:798:2: error: expected '(' after 'asm' γ