Adding new dts to Raspberry Yocto project - yocto

I have an experimental hardware connected to Raspberry's GPIO lines, and related dts file has been created. In Raspbian, the kernel module and dtbo (overlay) works well i.e. the hardware can be controlled.
Now I have tried to port this to Yocto 2.7.1 using Jumpnowtek's meta-rpi layer [x]. The kernel module porting was otherwise successful (at least, I did not get any complains during compilation), but I haven't been able to add the dts file to system such, that it would be automatically compiled to dtbo and added to /boot/overlays -directory.
[x] https://jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
I have created a linux-raspberrypi_4.19.bbappend recipe as follows:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://newlayer.dts"
RPI_KERNEL_DEVICETREE_OVERLAYS_append = " overlays/newlayer.dtbo "
do_compile_prepend() {
sed -i '/dtbo-$(CONFIG_ARCH_BCM2835) += \\/a newlayer.dtbo \\' ${S}/arch/${ARCH}/boot/dts/overlays/Makefile
cp ${WORKDIR}/newlayer.dts ${S}/arch/${ARCH}/boot/dts/overlays/
}
When I execute the "bitbake console-image", I get following error:
| make[3]: *** No rule to make target 'arch/arm/boot/dts/overlays/newlayer.dtbo'. Stop.
| make[2]: *** [arch/arm/Makefile:345: overlays/newlayer.dtbo] Error 2
| make[1]: *** [Makefile:146: sub-make] Error 2
| make: *** [Makefile:24: __sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
If I don't add the "RPI_KERNEL_DEVICETREE_OVERLAYS_append" line, I don't get any error message, but the dts file won't be compiled either. It seems, that contents of the mentioned variable control, which dts files will be compiled.
Any help is welcome.

Related

/bin/sh: 1: cc: not found while compiling u-boot on YOCTO

I need help on creating a custom u-boot recipe for custom board.
I made a custom recipe for u-boot with our custom u-boot source and defconfig
While building iam getting the following error
ERROR: u-boot-cal-1.0-r1 do_compile: oe_runmake failed
ERROR: u-boot-cal-1.0-r1 do_compile: Execution of '/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/run.do_compile.8827' failed with exit code 1
ERROR: Logfile of failure stored in: /media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/log.do_compile.8827
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4
| HOSTCC scripts/basic/fixdep
| /bin/sh: 1: cc: not found
| make[2]: *** [scripts/Makefile.host:95: scripts/basic/fixdep] Error 127
| make[1]: *** [Makefile:488: scripts_basic] Error 2
| make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
| make: *** Waiting for unfinished jobs....
| CFGCHK u-boot.cfg
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/build/tmp/work/iec61850_module-poky-linux-gnueabi/u-boot-cal/1.0-r1/temp/run.do_compile.8827' failed with exit code 1
ERROR: Task (/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/meta-iec61850_module/recipes-bsp/u-boot/u-boot-cal.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 580 tasks of which 579 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/media/calixto-systems/cal_linux/Sethu/yocto/yocto-secure/iec61850_module/iec61850_module3.1/meta-iec61850_module/recipes-bsp/u-boot/u-boot-cal.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
What all things i have to consider while writing a u-boot recipe.
The below lines are my recipe for u-boot
DESCRIPTION = "u-boot bootloader for Calixto devices"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
#SRC_URI[md5sum] = "454a496b2ec8fa2cf60f6b2cba299b10"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
BRANCH ?= "2019.01"
UBOOT_GIT_PROTOCOL = "https"
S = "${WORKDIR}/git"
SRC_URI = "git://sethucalixto#bitbucket.org/calixtolinuxplatform/calixto-am335x-uboot.git;protocol=${UBOOT_GIT_PROTOCOL};branch=${BRANCH}; \
file://am335x_iec61850_module_defconfig"
DEPENDS += "dtc-native bc-native lzop-native flex-native bison-native python3-setuptools-native"
COMPATIBLE_MACHINE = "iec61850-module"
SRCREV = "b96e9f6aed2c0a6cbf08c3f31b917694cc1f1b14"
Have a look at the u-boot recipe in OE-Core. In particular you probably need the EXTRA_OEMAKE lines from u-boot.inc to setup the compiler/linker correctly.

Update custom device tree on yocto

I am using the sama5d27-wlsom1-ek board for my demo and I am trying to make changes to the device tree.
So far I have compiled core-image-minimal and find my dtb files are generated in
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/build/arch/arm/boot/dts
folder.
Also I find many different dts files in
build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/arch/arm/boot/dts
But where does my machine get device tree files if they are generated inside the build folder and if I use my custom dts file how do I update them?
I want to build the image using my custom.dts file where I enable certain peripherals and disable the ones not required. (A test to customize dtb's in future).
I tried different methods found here
How to use an own device tree and modified kernel config in Yocto?
as well as
Quick rebuild of device tree only with Yocto/bitbake?
I created a new meta-local layer and added it to bblayer
followed by recipetool command to add my dts file to the new layer. Added KERNEL_DEVICETREE += "custom.dtb" to the .bbappend file generated inside meta-local and then run bitbake build image command so far
But, I seem to run into the following errors when I try to build the image.
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 3474 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:00
Parsing of 2309 .bb files complete (2307 cached, 2 parsed). 3476 targets, 358 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.46.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "sama5d27-wlsom1-ek-sd"
DISTRO = "poky-atmel"
DISTRO_VERSION = "3.1.7"
TUNE_FEATURES = "arm vfp cortexa5 neon vfpv4 thumb callconvention-hard"
TARGET_FPU = "hard"
meta
meta-poky
meta-yocto-bsp = "dunfell:97a9f30f1c457c55bf0c791d0466ff8620110a49"
meta-oe
meta-networking
meta-webserver
meta-python
meta-initramfs = "dunfell:2915810edbb6599051e30efb3b7f805665ddcc23"
meta-atmel = "dunfell:d6e30f2c0e3592ed11f3a4c8380a14d0a9066ba6"
meta-multimedia = "dunfell:2915810edbb6599051e30efb3b7f805665ddcc23"
meta-aws = "dunfell:2e2a1c65603dc5d11349e25dc9470a65cbeb8e65"
meta-freshair
meta-local
workspace = "dunfell:97a9f30f1c457c55bf0c791d0466ff8620110a49"
Initialising tasks: 100% |#######################################| Time: 0:00:04
Sstate summary: Wanted 294 Found 262 Missed 32 Current 2095 (89% match, 98% complete)
NOTE: Executing Tasks
ERROR: linux-at91-5.4+gitAUTOINC+3dba8c9991-r0 do_compile: oe_runmake failed
ERROR: linux-at91-5.4+gitAUTOINC+3dba8c9991-r0 do_compile: Execution of '/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/temp/run.do_compile.57871' failed with exit code 1:
GEN Makefile
CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/atomic/check-atomics.sh
CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/checksyscalls.sh
CHK include/generated/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
make[2]: *** No rule to make target 'arch/arm/boot/dts/new_name.dtb'. Stop.
make[1]: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:1265: new_name.dtb] Error 2
make: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:179: sub-make] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/temp/log.do_compile.57871
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: KBUILD_BUILD_TIMESTAMP: Thu Jan 14 12:54:56 UTC 2021
| NOTE: make -j 12 HOSTCC=gcc -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc -E HOSTCXX=g++ -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 zImage CC=arm-poky-linux-gnueabi-gcc -mno-thumb-interwork -marm -fuse-ld=bfd -fmacro-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source=/usr/src/kernel LD=arm-poky-linux-gnueabi-ld.bfd
| GEN Makefile
| CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/atomic/check-atomics.sh
| CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/checksyscalls.sh
| CHK include/generated/compile.h
| Kernel: arch/arm/boot/Image is ready
| Kernel: arch/arm/boot/zImage is ready
| NOTE: make -j 12 HOSTCC=gcc -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc -E HOSTCXX=g++ -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 at91-sama5d27_wlsom1_ek.dtb CC=arm-poky-linux-gnueabi-gcc -mno-thumb-interwork -marm -fuse-ld=bfd -fmacro-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source=/usr/src/kernel LD=arm-poky-linux-gnueabi-ld.bfd
| NOTE: make -j 12 HOSTCC=gcc -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc -E HOSTCXX=g++ -isystem/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -L/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 new_name.dtb CC=arm-poky-linux-gnueabi-gcc -mno-thumb-interwork -marm -fuse-ld=bfd -fmacro-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0=/usr/src/debug/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0 -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source=/usr/src/kernel LD=arm-poky-linux-gnueabi-ld.bfd
| make[2]: *** No rule to make target 'arch/arm/boot/dts/new_name.dtb'. Stop.
| make[1]: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:1265: new_name.dtb] Error 2
| make: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:179: sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/temp/run.do_compile.57871' failed with exit code 1:
| GEN Makefile
| CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/atomic/check-atomics.sh
| CALL /home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/scripts/checksyscalls.sh
| CHK include/generated/compile.h
| Kernel: arch/arm/boot/Image is ready
| Kernel: arch/arm/boot/zImage is ready
| make[2]: *** No rule to make target 'arch/arm/boot/dts/new_name.dtb'. Stop.
| make[1]: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:1265: new_name.dtb] Error 2
| make: *** [/home/fakhruddin/workspace/Freshair/my_dir/poky/build/tmp/work-shared/sama5d27-wlsom1-ek-sd/kernel-source/Makefile:179: sub-make] Error 2
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/fakhruddin/workspace/Freshair/my_dir/poky/../meta-atmel/recipes-kernel/linux/linux-at91_5.4.81.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6463 tasks of which 6457 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/fakhruddin/workspace/Freshair/my_dir/poky/../meta-atmel/recipes-kernel/linux/linux-at91_5.4.81.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
Please help and let me know if I missed any required information from my side.
Thank you and Regards,
Sohil
Linux kernel devices trees are located in :
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/git/arch/arm/boot/dts
Note that sources are in git and final build is in build.
You have to make sure that new_name.dtb present in the main Makefile:
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/git/arch/arm/boot/dts/Makfile
+dtb-$(CONFIG_SOC_AT91SAM9) += new_name.dtb
Now the new device tree must be added to the KERNEL_DEVICETREE variable and that tells Yocto what Kernel device trees to build and ship into the boot partition so that u-boot load one of them into RAM while booting the board:
KERNEL_DEVICETREE += "new_name.dtb"
Now, after you understand how device tree are placed in the kernel, you can make this automatic, you create a bbappend recipe to your linux-at91 kernel main recipe and add your custom device tree there.
meta-local/
recipes-kernel/
linux/
files/
new_custom.dts
linux-at91_%.bbappend
Now, you need to copy your new dts file before compiling the kernel (do_compile) , the best moment is after do_configure:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://new_custom.dts"
do_configure_append(){
cp ${WORKDIR}/new_custom.dts ${S}/arch/arm/boot/dts
echo "dtb-$(CONFIG_SOC_AT91SAM9) += new_dts.dtb" >> ${S}/arch/arm/boot/dts/Makefile
}
Now, your new device tree will be compiled, and any compilation errors may be due to syntax error.
After knowing that the device tree is compiled and added to KERNEL_DEVICETREE, this means that it is present in the boot partition along side with all other device trees also in KERNEL_DEVICETREE variable, but u-boot loads only one of them in the RAM before loading the Linux kernel, and that device tree is set in your u-boot target defconfig file present in:
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/u-boot-.../<version>/git/configs/your_machine_defconfig
you can find your_machine_defconfig in UBOOT_CONFIG variable in your machine configuration file which is located in your board's BSP layer:
meta-<board>/conf/machine/<board>.conf
After locating the defconfig you can find a variable DEFAULT_FDT_FILE.
At first, do not change it, just build your image, and pause at uboot stage and printenv to see the fdt_file variable and set it to your new_name.dtb file and saveenv to save it for every boot.
If that is okay, you can now patch your uboot defconfig file to set the new device tree file.
Yocto tip:
${WORKDIR} in the Kernel recipe points to:
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/
${S} point to the git directory under ${WORKDIR}
/tmp/work/sama5d27_wlsom1_ek_sd-poky-linux-gnueabi/linux-at91/5.4+gitAUTOINC+3dba8c9991-r0/git
that's why I copied the new device tree from ${WORKDIR}
I'd suggest using devtool modify linux-at91 to modify the linux kernel source-tree. This will create a linux-at91 folder in your ${TOPDIR}/workspace/sources/linux-at91. If you don't know your ${TOPDIR}, try to use bitbake -e <recipe-name> | grep "TOPDIR". bitbake -e will print your entire metadata for that recipe, here you can use grep to find the assignments of different variables. (like your KERNEL_DEVICETREE)
${TOPDIR}/workspace/sources/linux-at91
This will be the source tree for your linux-at91 recipe.
Copy your dts files into ${TOPDIR}/workspace/sources/linux-at91/arch/arm/boot/dts.
Modify the Makefile to include your dts, as pointed out by #BelHadjSalem TALEL (Thanks!).
Commit these changes and generate a patch.
In your own layer, under recipes-kernel/linux-at91/linux-at91 place this patch file. Add recipes-kernel/linux-at91/linux-at91.bbappend to include this patch as below:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-add-dts-file.patch"
Now to build your custom-machine, add conf/machine/custom-machine.conf and add an entry for your custom KERNEL_DEVICETREE like shown here
# This will inherit your base machine
require conf/machine/sama5d27-wlsom1-ek-sd.conf
KERNEL_DEVICETREE = "your-dts-file.dtb"
Overall, your layer will have following files:
- conf/layer.conf
- conf/machine/custom-machine.conf (Contains the above settings)
- recipes-kernel/linux-at91/linux-at91/0001-add-dts-file.patch
- recipes-kernel/linux-at91/linux-at91/linux-at91.bbappend
Just for information on great response by #BelHadjSalem: instead of manually copying dts file by 'do_configure_append', we can use subdir too.
so instead of
do_configure_append() {
cp ${WORKDIR}/new_custom.dts ${S}/arch/arm/boot/dts
}
just we need:
SRC_URI_append = " file://new_custom.dts;subdir=git/arch/arm/boot/dts"

Yocto Build Dependency on Debian Package

I am working on migrating from Debian to Yocto. As a result, many of the proprietary packages I am writing recipes for have dependencies on Debian libraries which do not appear to be available directly in Yocto. This might be a rookie question, but I'm trying to figure out how to do this.
Below, I have one of my recipe for a Makefile C project that was generated with recipetool create:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
# debian/copyright
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=some-hash"
SRC_URI = "git://git#my-project.git;protocol=ssh"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "<...>"
S = "${WORKDIR}/git"
DEPENDS = "systemd"
# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the
# recipe automatically - you will need to examine the Makefile yourself and ensure
# that the appropriate arguments are passed in.
do_compile () {
oe_runmake my-project
}
As you can see, I have specified a dependency on systemd. However, the dependency I really think I need is the Debian package libsystemd.
Whenever I bitbake this recipe, I get the following:
NOTE: Executing Tasks
ERROR: <recipe-name> do_compile: oe_runmake failed
ERROR: <recipe-name> do_compile: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
CC file-name.c
../file-name.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
6 | #include <systemd/sd-daemon.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:93: build/file-name.o] Error 1
make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
make: *** [Makefile:72: some-recipe] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/log.do_compile.13271
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 24 my-project
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-project] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-recipe] Error 2
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/mitch/bin/yocto/project-name/layers/meta-project/recipes-main/my-recipe/my-recipe_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2166 tasks of which 2163 didn't need to be rerun and 1 failed.
To summarize, what this looks like is my project requires libraries provided by systemd. What am I missing here that would allow me to get this project to build? Is there a way to build it?
Okay, so I guess I was overthinking this. Yocto uses your system to compile the project. So, all I needed to do was provide the systemd header files on my host machine. Since I am running Ubuntu, installing libsystemd-dev on my host fixed the issue. I think that the DEPENDS on systemd will still be required for running on the Yocto system.

Kernel compilation fails due to PF_MAX > 44

I have a QEMU VM running an image of the Linux kernel 4.14.78.
On the host machine (a server with 96 cores), I am trying to compile a new update for the kernel with some changes I have made.
To make this process faster, I was using the host machine to compile for the target VM.
To do that I follow these steps:
copy the /boot/config-4.14.78 file from VM to host
put the copied file into the kernel source-code root directory, renaming it to .config in my
run make clean to clean it
run make menuconfig just to update the configs
run make -j$(nproc)
However, I am getting this error:
AS arch/x86/purgatory/setup-x86_64.o
CC arch/x86/purgatory/sha256.o
AS arch/x86/purgatory/entry64.o
CC arch/x86/purgatory/string.o
In file included from scripts/selinux/mdp/mdp.c:49:
./security/selinux/include/classmap.h:245:2: error: #error New address family defined, please update secclass_map.
245 | #error New address family defined, please update secclass_map.
| ^~~~~
make[3]: *** [scripts/Makefile.host:102: scripts/selinux/mdp/mdp] Error 1
make[2]: *** [scripts/Makefile.build:587: scripts/selinux/mdp] Error 2
make[2]: *** Waiting for unfinished jobs....
In file included from scripts/selinux/genheaders/genheaders.c:19:
./security/selinux/include/classmap.h:245:2: error: #error New address family defined, please update secclass_map.
245 | #error New address family defined, please update secclass_map.
| ^~~~~
CHK scripts/mod/devicetable-offsets.h
make[3]: *** [scripts/Makefile.host:102: scripts/selinux/genheaders/genheaders] Error 1
make[2]: *** [scripts/Makefile.build:587: scripts/selinux/genheaders] Error 2
make[1]: *** [scripts/Makefile.build:587: scripts/selinux] Error 2
make[1]: *** Waiting for unfinished jobs....
I have checked what causes this, and turns out that it is because of the:
include/linux/socket.h:211:#define AF_MAX 44 /* For now.. */
include/linux/socket.h:260:#define PF_MAX AF_MAX
Then, I followed this solution to print out the definition of PF_MAX at preprocessing time, and turns out that the PF_MAX is 45:
In file included from scripts/selinux/mdp/mdp.c:49:
./security/selinux/include/classmap.h:247:9: note: #pragma message: 45
247 | #pragma message(STRING(PF_MAX))
| ^~~~~~~
./security/selinux/include/classmap.h:250:2: error: #error New address family defined, please update secclass_map.
250 | #error New address family defined, please update secclass_map.
| ^~~~~
This 45 makes no sense for me, because I just checked that it is supposed to be 44.
I wonder if the build is considering the host machine instead of the target?
P.S.: These steps works fine on my local machine, which is a 8-cores machine, look the kernel version:
uname -a
Linux campes-note 5.4.86 #1 SMP Fri Jan 1 16:26:25 -03 2021 x86_64 x86_64 x86_64 GNU/Linux
UPDATE 1:
I tried to compile the kernel without any of my changes, following th above steps mentioned, and it did not compile as well, I get the same error.
UPDATE 2:
I found out that somehow, the compilation is looking at the host /usr/src/linux-headers-x.x.x files.
Instead, it should point to the same version as the target.
For that, I tried to follow this tutorial but I did not success. I am having a problem in one of the steps stated on this tutorial.
(Gathered from the now removed comments)
I have tried myself to build myself v4.14.78 followed by the latest available v4.14.214. I have found that former fails while the latter builds. So, I have bisected down to v4.14.116 that first builds correctly. Then I simple looked into the changes and found commit 760f8522ce08 ("selinux: use kernel linux/socket.h for genheaders and mdp") in the Linux stable tree which fixes the issue.
You may try to cherry-pick it to your branch and compile again.

why u-boot source code remove while compiling?

I am perorming following steps for compiling source code locally. i am using poky version pyro of yocto. but after successfully clean the source code, while compiling source code is remove and error is display.
step 1
bitbake -v -c clean u-boot
step 2
bitbake -v u-boot
------------------------------Eroor-------------------------------
make: *** No rule to make target 'am335x_boneblack_config'. Stop.
make: Leaving directory '/u-boot/u-boot_v2017.01/u-boot_src'
ERROR: u-boot-1_2017.01-r0 do_compile: oe_runmake failed
ERROR: u-boot-1_2017.01-r0 do_compile: Function failed: do_compile (log file is located at /PYRO_BUILD/tmp/work/beaglebone-poky-linux-gnueabi/u-boot/1_2017.01-r0/temp/log.do_compile.10915)
ERROR: Logfile of failure stored in: /PYRO_BUILD/tmp/work/beaglebone-poky-linux-gnueabi/u-boot/1_2017.01-r0/temp/log.do_compile.10915
how should i resolve it?
make: *** No rule to make target 'am335x_boneblack_config'. Stop.
make: Leaving directory
'//src_bsp/u-boot/u-boot_v2017.01/u-boot_src'
From above error, It seems that you have uboot code locally at '//u-boot/u-boot_v2017.01/u-boot_src' which gets deleted on compiling(bitbake -v u-boot).
Try using EXTERNALSRC instead of S to specify path to u-boot source code as follows :
inherit externalsrc
EXTERNALSRC = "/<workspace>/u-boot/u-boot_v2017.01/u-boot_src"
EXTERNALSRC_BUILD = "/<workspace>/u-boot/u-boot_v2017.01/u-boot_src"