cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tejaallani
Observer
Observer
1,758 Views
Registered: ‎05-08-2018

Unable to build kernel module petalinux 2016.4

Jump to solution

Hi,

 

      I am using petalinux 2016.4 sdk for building kernel image. I want to add custom kernel module. I was able to build kernel without enabling the module. If I add custom module I am getting an error. Below are the steps I have used

 

 

$petalinux-create -t modules -n platform-api

 

>added my platform-api.c and platform-api.h files to the modules directory (<work_space>/project-spec/meta-user/recipes-modules/platform-api/)

 

$petalinux-config -c rootfs

 

>enabled the module

 

>Edited the makefile as below

obj-m := platform-api.o

ccflags-y := -I/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/project-spec/meta-user/recipes-modules/platform-api/platform-api

SRC := $(shell pwd)

all:
	$(MAKE) -C $(KERNEL_SRC) M=$(SRC)

modules_install:
	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

clean:
	rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
	rm -f Module.markers Module.symvers modules.order
	rm -rf .tmp_versions Modules.symvers

>Edited the platform-api.bb file as below

SUMMARY = "Recipe for  build an external platform-api Linux kernel module"
SECTION = "PETALINUX/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"

inherit module

SRC_URI = "file://Makefile \
           file://platform-api.c \
           file://platform-api.h \
	   file://COPYING \
          "

S = "${WORKDIR}"

inherit module
EXTRA_OEMAKE = 'KERNEL_src="${STAGING_KERNEL_DIR}" \
                O=${STAGING_KERNEL_BUILDDIR} \
                '
# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.

$petalinux-build

 

>I get the following error

testuser@testpc5:~/xilinx_sdk_work_spaces/xilinx-zc702-2016.4$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
Loading cache: 100% |#############################################################################################################| ETA:  00:00:00
Loaded 2941 entries from dependency cache.
Parsing recipes: 100% |###########################################################################################################| Time: 00:00:01
Parsing of 2328 .bb files complete (2294 cached, 34 parsed). 2943 targets, 196 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing RunQueue
NOTE: Checking sstate mirror object availability (for 79 objects)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: platform-api-1.0-r0 do_compile: oe_runmake failed
ERROR: platform-api-1.0-r0 do_compile: Function failed: do_compile (log file is located at /home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0/temp/log.do_compile.12731)
ERROR: Logfile of failure stored in: /home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0/temp/log.do_compile.12731
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4 KERNEL_src=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work-shared/plnx_arm/kernel-source O=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work-shared/plnx_arm/kernel-build-artifacts KERNEL_PATH=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work-shared/plnx_arm/kernel-source KERNEL_VERSION=4.6.0-xilinx CC=arm-linux-gnueabihf-gcc  -mno-thumb-interwork -marm -fuse-ld=bfd LD=arm-linux-gnueabihf-ld.bfd   AR=arm-linux-gnueabihf-ar  O=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work-shared/plnx_arm/kernel-build-artifacts
| make -C  M=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0
| make[1]: *** M=/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0: No such file or directory.  Stop.
| Makefile:8: recipe for target 'all' failed
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| ERROR: Function failed: do_compile (log file is located at /home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0/temp/log.do_compile.12731)
ERROR: Task 411 (/home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/project-spec/meta-user/recipes-modules/platform-api/platform-api.bb, do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1596 tasks of which 1591 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:

Summary: 1 task failed:
  /home/testuser/xilinx_sdk_work_spaces/xilinx-zc702-2016.4/project-spec/meta-user/recipes-modules/platform-api/platform-api.bb, do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: Failed to build project

The folder <workspace>/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/platform-api/1.0-r0 exists. I am not able to proceed further. Any help would be appreciated.

 

Thanks

0 Kudos
Reply
1 Solution

Accepted Solutions
tejaallani
Observer
Observer
1,862 Views
Registered: ‎05-08-2018

Okay, so I found out it is due to typo in .bb file

 

EXTRA_OEMAKE = 'KERNEL_src="${STAGING_KERNEL_DIR}" \
                O=${STAGING_KERNEL_BUILDDIR} \
                '

Changed KERNEL_src to KERNEL_SRC and now it works.

View solution in original post

0 Kudos
Reply
1 Reply
tejaallani
Observer
Observer
1,863 Views
Registered: ‎05-08-2018

Okay, so I found out it is due to typo in .bb file

 

EXTRA_OEMAKE = 'KERNEL_src="${STAGING_KERNEL_DIR}" \
                O=${STAGING_KERNEL_BUILDDIR} \
                '

Changed KERNEL_src to KERNEL_SRC and now it works.

View solution in original post

0 Kudos
Reply