I'm new to Tiny Core and I'm having a bit of trouble compiling a test kernel module.
First, I installed the sources, which completed successfully.
tce-load -iw linux-kernel-sources-env.tcz
Then I ran the script in the description of the kernel sources, which executed successfully.
cliorx linux-kernel-sources-env.sh
I built this simple module/driver and saved it as 'hello.c'.
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL")
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Then I run the below command and try to compile.
cc hello.c -o hello
I get the following error.
hello.c:1:24: fatal error: linux/init.h: No such file or directory
#include <linux/init.h>
^
I also try to build the Makefile below.
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Then I run the following command.
make
I get the following error from the 'make' command.
make -C /lib/modules/3.16.6-tinycore/build M=/home/tc modules
make[1]: Entering directory '/usr/src/linux-3.16.6'
Makefile:358: scripts/Kbuild.include: No such file or directory
Makefile:614: arch/x86/Makefile: No such file or directory
/bin/bash: ./scripts/gcc-goto.sh: No such file or directory
Makefile:755: scripts/Makefile.extrawarn: No such file or directory
make[1]: *** No rule to make target 'scripts/Makefile.extrawarn'. Stop.
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2
Thanks for your help!