Kernel Module for Linaro build

Hi,

We are trying to build a basic “Hello world” kernel module using 4.4.23-linaro-lt-qcom kernel version on the DragonBoard 410c.

This is the code :

#include <linux/init.h>
#include <linux/module.h>

static int hello_init(void)
}
printk(KERN_ALERT “TEST : Hello world, this is Miri\n”);
return 0;
}

static void hello_exit(void)
{
printk(KERNEL_ALERT “TEST : goodbye from miri\n”);
}

module_init(hello_init);
module_exit(hello_exit);

and the Makefile:

obj-m += Hello.o

KDIR = /usr/src/linux-headers-4.4.23-linaro-lt-qcom
all:
$(MAKE) -C $(KDIR) SUBDIR=$(PWD) modules
clean:
rm -rf *.o *.ko .mod. *.symvers *.order

also tried adding this :

CC = aarch64-linux-gnu-gcc

No luck…

The error is :

root@linaro-alip:/home/linaro/modules# make
make -C /usr/src/linux-headers-4.4.23-linaro-lt-qcom SUBDIR=/home/linaro/modules modules
make[1]: Entering directory ‘/usr/src/linux-headers-4.4.23-linaro-lt-qcom’
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
HOSTCC scripts/sortextable
scripts/sortextable.c:31:32: fatal error: tools/be_byteshift.h: No such file or directory
#include <tools/be_byteshift.h>
^
compilation terminated.
scripts/Makefile.host:91: recipe for target ‘scripts/sortextable’ failed
make[2]: *** [scripts/sortextable] Error 1
Makefile:555: recipe for target ‘scripts’ failed
make[1]: *** [scripts] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.4.23-linaro-lt-qcom’
Makefile:7: recipe for target ‘all’ failed
make: *** [all] Error 2

If we try make scripts from the kernel directory it also fails.

What is the correct way to build a kernel module for this setup?
Has anyone encountered same problem?

Thanks,
Miri and Lior
(We are CS students who are using the Dragonboard 410c for a university project)

were you successful in building kernel module for dragonboard 410c.
I tried to compile basic module on dragonboard. but i got errors

Please provide more information when reporting errors. Build logs, boot
logs, … anything that we can use to help you!

Thx

vijay, if you are using the Debian build and trying to build the kernel module on the Dragonboard, it doesn’t work. There are x86 binaries in the kernel tree that doesn’t execute on the ARM processor. Even after replacing them with proper ARM binaries it didn’t work. The only way I have found to work is to compile the kernel module on my PC directly in the kernel source tree.

This was mentioned in another thread as well.

BR,
Nicklas