cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
1,842 Views
Registered: ‎09-18-2018

bc: command not found on Petalinux build

Jump to solution

Hello,

 

I am using Petalinux 2018.2 on an Ubuntu 2016.10 to build a linux system for a ZCU102 board. When adding a custom kernel module (via petalinux-create) to the project, it fails building. See the following build output:

me@VM1:~/path/to/project$ petalinux-build  
[INFO] building project 
[INFO] sourcing bitbake 
INFO: bitbake petalinux-user-image 
Loading cache: 100% |####################################################################################| Time: 0:00:00 
Loaded 3438 entries from dependency cache. 
Parsing recipes: 100% |##################################################################################| Time: 0:00:03 
Parsing of 2553 .bb files complete (2514 cached, 39 parsed). 3442 targets, 139 skipped, 0 masked, 0 errors. 
NOTE: Resolving any missing task queue dependencies 
Initialising tasks: 100% |###############################################################################| Time: 0:00:05 
Checking sstate mirror object availability: 100% |#######################################################| Time: 0:00:09 
NOTE: Executing SetScene Tasks 
NOTE: Executing RunQueue Tasks 
ERROR: mymodule-1.0-r0 do_compile: oe_runmake failed 
ERROR: mymodule-1.0-r0 do_compile: Function failed: do_compile (log file is located at /path/to/project/build/tmp/work/plnx_zynqmp-xilinx-linux/mymodule/1.0-r0/temp/log.do_compile.8626) 
ERROR: Logfile of failure stored in: /path/to/project/build/tmp/work/plnx_zynqmp-xilinx-linux/mymodule/1.0-r0/temp/log.do_compile.8626 
Log data follows: 
| DEBUG: Executing shell function do_compile 
| NOTE: make -j 4 KERNEL_src=/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source O=/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-build-artifacts KERNEL_PATH=/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source KERNEL_VERSION=4.14.0-xilinx-v2018.2 CC=aarch64-xilinx-linux-gcc   -fuse-ld=bfd LD=aarch64-xilinx-linux-ld.bfd   AR=aarch64-xilinx-linux-ar  O=/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-build-artifacts KBUILD_EXTRA_SYMBOLS= 
| make -C /path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source M= CFLAGS_M
ODULE=-D“CUSTOM_FLAG_zynq“ modules 
| make[1]: Entering directory '/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source' 
| make[2]: Entering directory '/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-build-artifacts' 
|   CHK     include/config/kernel.release 
|   GEN     ./Makefile 
|   CHK     include/generated/uapi/linux/version.h 
|   CHK     include/generated/utsrelease.h 
|   Using /path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source as source for kernel 
|   CHK     scripts/mod/devicetable-offsets.h 
|   CHK     include/generated/timeconst.h 
| /bin/sh: bc: command not found 
|   CHK     include/generated/bounds.h 
| make[3]: *** [/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source/./Kbuild:43: include/generated/timeconst.h] Error 1 
| make[3]: *** Waiting for unfinished jobs.... 
| make[2]: *** [/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source/Makefile:1069: prepare0] Error 2 
| make[2]: Leaving directory '/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-build-artifacts' 
| make[1]: *** [Makefile:146: sub-make] Error 2 
| make[1]: Leaving directory '/path/to/project/build/tmp/work-shared/plnx-zynqmp/kernel-source' 
| make: *** [Makefile:10: module] Error 2 
| ERROR: oe_runmake failed 
| WARNING: /path/to/project/build/tmp/work/plnx_zynqmp-xilinx-linux/mymodule/1.0-r0/temp/run.do_compile.8626:1 exit 1 from 'exit 1' 
| ERROR: Function failed: do_compile (log file is located at /path/to/project/build/tmp/work/plnx_zynqmp-xilinx-linux/mymodule/1.0-r0/temp/log.do_compile.8626) 
ERROR: Task (/path/to/project/project-spec/meta-user/recipes-modules/mymodule/mymodule
.bb:do_compile) failed with exit code '1' 
NOTE: Tasks Summary: Attempted 3040 tasks of which 3018 didn't need to be rerun and 1 failed. 

Summary: 1 task failed: 
 /path/to/project/project-spec/meta-user/recipes-modules/mymodule/mymodule.bb:do_compile 
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

I have no idea why it says "bc: command not found", since bc is installed and available in bash (which is the shell linked from /bin/sh). It seems to be included from timeconst.h within the kernel, but why is it failing now?

I was able to build the Petalinux project before inserting the module and its sources, so the Petalinux-system itself showed to be working.

Also when only building the module only (using petalinux-build -c modulename), the same error occurs.

The log.do_compile logfile given has no further lines besides what is already in the paste above.

The kernel module is known good, since it builds without error against the most current linux-xlnx kernel from Github when using a standalone build of the kernel and module without Petalinux. But I would like to include it into the Petalinux build process.

Is this a general issue with Petalinux?

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Voyager
Voyager
1,692 Views
Registered: ‎10-21-2015
$ cat project-spec/meta-user/recipes-modules/mymodule/mymodule.bb 
SUMMARY = "Recipe for  build an external mymodule kernel module"
SECTION = "PETALINUX/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bc486525c72fbd315bb32bb1efb11255"

inherit module

SRC_URI = "file://Makefile \
           file://mymodule.c \
           file://COPYING \
          "

S = "${WORKDIR}"
# The inherit of module.bbclass will automatically name module packages with # "kernel-module-" prefix as required by the oe-core build environment. 

 

$ cat project-spec/meta-user/recipes-modules/mymodule/files/Makefile

obj-m += mymodule.o mymodule-objs := mymodule_core.o includedFile1.o includedFile2.o
SRC := $(shell pwd) module: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) clean

Could you try to build your module again with the above?

View solution in original post

6 Replies
Highlighted
Voyager
Voyager
1,796 Views
Registered: ‎10-21-2015

Hi

$ petalinux-build -c "-e virtual/kernel" | grep ^DEPENDS=
DEPENDS="  xz-native bc-native virtual/aarch64-xilinx-linux-binutils virtual/aarch64-xilinx-linux-gcc kmod-native bc-native lzop-native libgcc u-boot-mkimage-native dtc-native"

Could you check whether DEPENDS include bc-native?

If it exists not, add the following to project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend 

DEPENDS += "bc-native"

 

0 Kudos
Highlighted
Visitor
Visitor
1,744 Views
Registered: ‎09-18-2018

Hi, thanks for your help!

DPENDS already includes bc-native twice like in your example:

$ petalinux-build -c "-e virtual/kernel" | grep ^DEPENDS=
DEPENDS="  xz-native bc-native virtual/aarch64-xilinx-linux-binutils virtual/aarch64-xilinx-linux-gcc kmod-native bc-native lzop-native libgcc u-boot-mkimage-native dtc-native"                                                                
ERROR: Failed to build -e virtual/kernel     
0 Kudos
Highlighted
Voyager
Voyager
1,722 Views
Registered: ‎10-21-2015

 

Could you show your recipe(bb file) and Makefile?

0 Kudos
Highlighted
Visitor
Visitor
1,700 Views
Registered: ‎09-18-2018

For the module itself:

$ cat project-spec/meta-user/recipes-modules/mymodule/mymodule.bb 
SUMMARY = "Recipe for  build an external mymodule kernel module"
SECTION = "PETALINUX/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bc486525c72fbd315bb32bb1efb11255"

inherit module

SRC_URI = "file://Makefile \
           file://mymodule.c \
           file://COPYING \
          "

S = "${WORKDIR}"
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.

The Makefile for the module:

$ cat project-spec/meta-user/recipes-modules/mymodule/files/Makefile

obj-m += mmymodule.o mymodule-objs := mymodule.o includedFile1.o includedFile2.o
module: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) CFLAGS_MODULE=-D"MODULE_ARCH_zynq" modules modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) clean

 

0 Kudos
Highlighted
Voyager
Voyager
1,693 Views
Registered: ‎10-21-2015
$ cat project-spec/meta-user/recipes-modules/mymodule/mymodule.bb 
SUMMARY = "Recipe for  build an external mymodule kernel module"
SECTION = "PETALINUX/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bc486525c72fbd315bb32bb1efb11255"

inherit module

SRC_URI = "file://Makefile \
           file://mymodule.c \
           file://COPYING \
          "

S = "${WORKDIR}"
# The inherit of module.bbclass will automatically name module packages with # "kernel-module-" prefix as required by the oe-core build environment. 

 

$ cat project-spec/meta-user/recipes-modules/mymodule/files/Makefile

obj-m += mymodule.o mymodule-objs := mymodule_core.o includedFile1.o includedFile2.o
SRC := $(shell pwd) module: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) clean

Could you try to build your module again with the above?

View solution in original post

Highlighted
Visitor
Visitor
1,668 Views
Registered: ‎09-18-2018

Thanks a lot for your advice! It is building now, as a single component and all together with petalinux-build.

This line seems to have fixed it:

SRC := $(shell pwd)

 

(at the moment it cannot be inserted due to "Operation not permitted" using insmod or modprobe, but that seems to be a different topic.)

0 Kudos