I’m studying how to implement a simple hypervisor in Rust and found rustyvisor. The project seems not active (the last activity is about 3 years ago) and the Travis build failed, but I’ve managed to build it by changing some obsoleted functions and use
cargo xbuild with its target spec json file.
The challenge now is to link the static library
librustyvisor.a (generated by Rust) with the object file
linux.o (generated by C). Basically, the given Makefile looks like that:
obj-m += rustyvisor.o $(rustyvisor)-objs := loader/linux.o target/x86_64-linux/release/librustyvisor.a KDIR := /lib/modules/$(shell uname -r)/build all: $(MAKE) -C $(KDIR) M=$(PWD) modules V=1
Using this file, I’ve managed to generate
rustyvisor.ko but it seems that
librustyvisor.a is not linked: the linked warns that functions (implemented in this library) is undefined.
WARNING: "rustyvisor_core_unload" [/home/ttd/Github/rustyvisor/rustyvisor.ko] undefined! WARNING: "rustyvisor_load" [/home/ttd/Github/rustyvisor/rustyvisor.ko] undefined! WARNING: "rustyvisor_core_load" [/home/ttd/Github/rustyvisor/rustyvisor.ko] undefined! WARNING: "rustyvisor_unload" [/home/ttd/Github/rustyvisor/rustyvisor.ko] undefined!
I’m struggling almost this week-end with this, many thank for any help.
NB0. there is another project rust.ko which implements kernel modules in Rust, its Makefile is quite similar but I cannot even compile its
NB1. I’ve asked a similar question to stackoverflow and someone suggests to decompress
.o files, but I’m not sure if it is a good solution.