Я клонировал набор инструментов Raspberry Pi, используя следующую команду, и добавил путь к инструментам в bashr c
git clone https://github.com/raspberrypi/tools.git --depth=1
echo PATH=$PATH:~raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
source ~/.bashrc
Клонировал исходники ядра Raspberry Pi
git clone --depth=1 https://github.com/raspberrypi/linux
Простой привет world module
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int test_hello_init(void)
{
printk(KERN_INFO"%s: In init\n", __func__);
return 0;
}
static void test_hello_exit(void)
{
printk(KERN_INFO"%s: In exit\n", __func__);
}
module_init(test_hello_init);
module_exit(test_hello_exit);
Makefile
obj-m := hello.o
all:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /home/jamal/raspberrypi/linux M=$(PWD) modules
clean:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /home/jamal/raspberrypi/linux M=$(PWD) clean
Сбой из-за следующей ошибки:
arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
scripts/Makefile.build:309: recipe for target '/home/jamal/Linux_Device_Drivers/hello.o' failed
Раньше это работало, не уверен, что изменилось и теперь я получаю эту ошибку