I tried to build my first kernel module for Linux builded from scratch. My problem is when I use make:
`
make ARCH=arm CROSS_COMIPLE=arm-cortex_a8-linux-gnueabi- -C ~/Desktop/LFS_v2/linux-3.5.3/ M=$pwd modules
`
I get:
`
cc1: error: unrecognized command line option ‘-mlittle-endian’
cc1: error: unrecognized command line option ‘-mno-thumb-interwork’
kernel/bounds.c:1:0: error: unknown ABI (aapcs-linux) for -mabi= switch
kernel/bounds.c:1:0: error: bad value (armv5t) for -march= switch
kernel/bounds.c:1:0: error: bad value (strongarm) for -mtune= switch
make[1]: *** [kernel/bounds.s] Błąd 1
make: *** [prepare0] Błąd 2
`
I run make command from directory with module C file and Makefile.
My module is simple example from book which only prints messages so it should be ok.
My Makefile has just one line:``
`
obj-m += first_module.o
`
I read that it is often problem with cross compiler.
Kernel compilation was previously made with the same CROSS_COMPILE parameter. And that cross compiler still exist and arm-cortex_a8-linux-gnueabi- is recognized command in terminal.
Because I’m not sure what are the paths in -C and M parameters: In my -C is path to directory where are kernel sources unpacked. M is like you see, pwd, and this directory is just next to linux-3.5.3 (from -C).
I don’t know if it is important, but at the beginning I didn’t know where to put first_module.c and Makefile files. So I put it first into kernel sources directory. That caused overwriting of original Makefile. So I restored that file from originally downloaded kernel tar.gz archive. I don’t know if sometimes that Makefile wasn’t changed when I was configuring kernel before building some time ago and now there is something wrong.
ARCH, CROSS_COMPILE and that what is with ‘make’ command I get.
SYSROOTS is general path for easier creating KERNELDIR path and for easier adding path to cross-compiler?
I tried to create my own Linux. This is what I do with kernel sources, maybe I missed something, but this Linux starts on Beagle:
`
make mrproper
make ARCH=arm omap2plus_defconfig
make ARCH=arm menuconfig (changes only in Initial RAM filesystem and RAM disk() and USB Network Adapter Driver)
make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi- modules (looks familiar :D)
make ARCH=arm INSTALL_MOD_PATH=/home/valdez/Desktop/LFS_v3/target modules_install
`
and after creating ramdisk:
make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi- uImage
I tried all procedure again from downloading kernel sources to that module compilation but have the same error.
Anyone see my mistake?