-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error "asm/types.h: No such file or directory" when compiling with riscv64-unknown-elf-gcc #44
Comments
I am no expert in kernel modules, but I think you need to link to the kernel where you want to install your module, i.e., the kernel tree in this repo. Now you are probably using your host kernel header files:
|
Good catch @Moschn! |
Hi @Moschn, I think I managed to compile my kernel module. What I did was the following:
The
but created the .o file. The "implicit declaration" of "printk()" is a little bit disturbing but in at least one other thread that I found, a user with a similar problem with the "printk()" had his module working without a problem. So I decided to go ahead and test it.
Thank you in advance for your response and time. Kind regards, |
I managed to load the
My Makefile as stated above is the following:
Any ideas on what I might be doing wrong? Thank you for the support. Kind regards, |
I think you have to compile a kernel module differently. I know this kernel module works and is crosscompiled for a Linux kernel image. Maybe take a look at their makefile |
Hi @Moschn, in the link you provided me, they are compiling against the Linux kernel source tree (that's why they have the To be honest I don't see any kernel source tree inside the Ariane SDK. Where is your kernel tree in this repo? My current Makefile is the following (I tried to adjust it to the linked example):
Thank you for your time. Kind regards, |
The linux tree is downloaded by buildroot during build. LINUXSRC probably has to point at the root of the linux tree |
The linux tree is in |
I was able to solve my issue and produce a working .ko through this informative guide on how to cross-compile an LKM: https://www.kernel.org/doc/Documentation/kbuild/modules.txt Thank you for your help @Moschn! I am closing this thread. |
|
Huh, how did you?
I still get:
And no, installing the host system’s kernel headers won’t help here… |
my
|
Athanasios Moschos dixit:
make -C $(KDIR) ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- M=$(PWD)
Ah, thanks. This was missing from all the documents, but I found
similar indication, but several more variables passed, probably
cargo-culted, in OpenWrt-near documentation.
bye,
//mirabilos
--
When he found out that the m68k port was in a pretty bad shape, he did
not, like many before him, shrug and move on; instead, he took it upon
himself to start compiling things, just so he could compile his shell.
How's that for dedication. -- Wouter, about my Debian/m68k revival
|
Update security island reset interface
Hi,
I am trying to build a simple Linux Kernel Module that will use the printk() in order to print from inside the kernel.
At the moment I am trying to compile this example.
The make file I am using is the following:
As you can see the gcc I am using is the riscv64-unknown-elf-gcc, after building the Ariane SDK tools.
When I am executing
make all
, I get the following error:I am using Centos 7 and the Linux kernel is
Linux 3.10.0-1127.19.1.el7.x86_64
.How can I solve this error?
I believe it might have to do with the Linux header files, but I don't know how to proceed.
Any response would be really helpful. Thank you in advance for your responses.
Kind regards,
Nassos
The text was updated successfully, but these errors were encountered: