All right, thanks Adam.
Unfortunately, there's still a problem.
I managed to build and run(!) a simple 'hello.ko'. But, i fail with more complex modules. Building works, but when loading my module with 'insmod' i get faults: Page fault (non-resolved): pfa=9 pc=1011cec Non-resolvable page fault at 9, ip 1011cec.
I'm sure the fault is not caused by my code because there is the same issue with legacy drivers. But, i guess something is wrong with the build process. e.g. let's take CONFIG_TCG_TPM in 'src/l4linux/driver/char/tpm'. This one does build and run successfully when setting CONFIG_TCG_TPM=m in 'obj/l4linux/.config' and than building complete l4linux. But it does not build when going to 'src/l4linux/driver/char/tpm' and 'make -C $L4re/obj/l4linux/arm-mp M=$PWD CROSS_COMPILE=arm-linux-gnueabihf- L4ARCH=arm CONFIG_TCG_TPM=m modules V=1'.
It gets me this output:
make: Entering directory '/home/ba_f/l4re-snapshot-2015123115/obj/l4linux/arm-mp' make -C /home/ba_f/l4re-snapshot-2015123115/src/l4linux O=/home/ba_f/l4re-snapshot-2015123115/obj/l4linux/arm-mp/. modules make -C /home/ba_f/l4re-snapshot-2015123115/obj/l4linux/arm-mp KBUILD_SRC=skins/classic/home/ba_f/l4re-snapshot-2015123115/src/l4linux \ -f /home/ba_f/l4re-snapshot-2015123115/src/l4linux/Makefile modules test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) mkdir -p /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/.tmp_versions ; rm -f /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/.tmp_versions/* make -f /home/ba_f/l4re-snapshot-2015123115/src/l4linux/scripts/Makefile.build obj=/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm arm-linux-gnueabihf-gcc -Wp,-MD,/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/.tpm-interface.o.d -nostdinc -isystem /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/include -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include -Iarch/l4/include/generated/uapi -Iarch/l4/include/generated -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/include -Iinclude -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/uapi -Iarch/l4/include/generated/uapi -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/uapi -Iinclude/generated/uapi -include /home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/linux/kconfig.h -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm -D__KERNEL__ -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/asm/l4-arch -Iarch/l4/include/asm/l4-arch -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/arm/include/generated -Iarch/arm/include/generated -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/arm/include/generated/uapi -Iarch/arm/include/generated/uapi -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/asm/mach-arm/generic
-I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/asm/plat-arm/generic -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/arm/include -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/asm/arch-arm -Iarch/l4/include/asm/arch-arm -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include/asm/orig-arch -Iarch/l4/include/asm/orig-arch -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/l4/include -Iarch/l4/include -I/home/ba_f/l4re-snapshot-2015123115/src/l4linux/arch/arm/include/uapi -I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include/arm/l4f -I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include/arm -I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include/l4f -I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include -I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include/contrib/libstdc++-v3
-I/home/ba_f/l4re-snapshot-2015123115/obj/l4/arm-ca/include/contrib/libio-io -DL4API_l4f -DL4SYS_USE_UTCB_WRAP=1 -DTEXT_OFFSET=0x02000000 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -pipe -msoft-float -DARCH_arm -fno-ipa-sra -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -msoft-float -Uarm -fno-dwarf2-cfi-asm -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(tpm_interface)" -D"KBUILD_MODNAME=KBUILD_STR(tpm)" -c -o /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.o /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:679:5: error: redefinition of ‘tpm_pcr_read’ int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) ^ In file included from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm.h:28:0, from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:33: /home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/linux/tpm.h:54:19: note: previous definition of ‘tpm_pcr_read’ was here static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { ^ /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:714:5: error: redefinition of ‘tpm_pcr_extend’ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) ^ In file included from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm.h:28:0, from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:33: /home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/linux/tpm.h:57:19: note: previous definition of ‘tpm_pcr_extend’ was here static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { ^ /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:804:5: error: redefinition of ‘tpm_send’ int tpm_send(u32 chip_num, void *cmd, size_t buflen) ^ In file included from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm.h:28:0, from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:33: /home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/linux/tpm.h:60:19: note: previous definition of ‘tpm_send’ was here static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { ^ /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:980:5: error: redefinition of ‘tpm_get_random’ int tpm_get_random(u32 chip_num, u8 *out, size_t max) ^ In file included from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm.h:28:0, from /home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.c:33: /home/ba_f/l4re-snapshot-2015123115/src/l4linux/include/linux/tpm.h:63:19: note: previous definition of ‘tpm_get_random’ was here static inline int tpm_get_random(u32 chip_num, u8 *data, size_t max) { ^ /home/ba_f/l4re-snapshot-2015123115/src/l4linux/scripts/Makefile.build:258: recipe for target '/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.o' failed make[3]: *** [/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm/tpm-interface.o] Error 1 /home/ba_f/l4re-snapshot-2015123115/src/l4linux/Makefile:1380: recipe for target '_module_/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm' failed make[2]: *** [_module_/home/ba_f/l4re-snapshot-2015123115/src/l4linux/drivers/char/tpm] Error 2 Makefile:146: recipe for target 'sub-make' failed make[1]: *** [sub-make] Error 2 Makefile:24: recipe for target '__sub-make' failed make: *** [__sub-make] Error 2 make: Leaving directory '/home/ba_f/l4re-snapshot-2015123115/obj/l4linux/arm-mp'
Sorry, for all the shit. Hopefully, you see the problem quick. Guess your more familiar with the build process.
Greets, ba_f
Am 2016-01-06 23:10, schrieb Adam Lackorzynski:
On Wed Jan 06, 2016 at 16:59:11 +0100, ba_f wrote:
Am 2016-01-04 23:37, schrieb Adam Lackorzynski:
On Mon Jan 04, 2016 at 16:08:55 +0100, ba_f wrote:
are there any Makefiles for building a L4Linux Kernel Module? Or can i just cross-compile for my ARCH, although the driver uses L4-IPC?
There's no difference, so the standard way of building a module should just work (make -C ... M=...).
Adam
Hi there,
running in an Error.
$ make -C obj/l4linux/arm-mp M=$PWD ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
make: Entering directory 'obj/l4linux/arm-mp' CC [M] hello.o In file included from src/l4linux/include/asm-generic/int-ll64.h:10:0, from src/l4linux/arch/arm/include/asm/types.h:4, from src/l4linux/include/uapi/linux/types.h:4, from src/l4linux/include/linux/types.h:5, from src/l4linux/include/linux/list.h:4, from src/l4linux/include/linux/module.h:9, from hello.c:11: src/l4linux/include/uapi/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory #include <asm/bitsperlong.h>
The missing header has been generated in 'obj/l4linux/arm-mp/arch/l4/include/generated/asm/bitsperlong.h' but isn't found.
Can i set an include path for Kbuild? Or does this file has to be copied to a proper location?
The ARCH=arm is wrong. L4ARCH=arm is better but you can also just omit it.
Adam