mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
This reverts commit 2e7f3b2b9318d1e5395ad58131eafb873f614326. It was breaking quite common use case that the dtb files are in some subdirectory and then kernel build fails to build them. As reported by khem: http://lists.openembedded.org/pipermail/openembedded-core/2018-July/152578.html me: http://lists.openembedded.org/pipermail/openembedded-core/2018-July/152579.html on raspberrypi3 build: make[3]: *** No rule to make target 'arch/arm/boot/dts/dwc2.dtbo'. Stop. arch/arm/Makefile:345: recipe for target 'dwc2.dtbo' failed make[2]: *** [dwc2.dtbo] Error 2 Makefile:146: recipe for target 'sub-make' failed and trevor on the IRC: 20:35:49 < tlwoerner> the recent 2e7f3b2b9318d1e5395ad58131eafb873f614326 commit in oe-core seems to cause dragonboard-410c's kernel to fail to build 20:36:26 < tlwoerner> for the dragonboard-410c, KERNEL_DEVICETREE is set to "qcom/apq8016-sbc.dtb" but the build failure is: 20:36:37 < tlwoerner> *** No rule to make target 'arch/arm64/boot/dts/dts/qcom/apq8016-sbc.dtb'. Stop. 20:36:44 < tlwoerner> i.e. the "qcom/" is getting removed 20:37:08 < tlwoerner> oops!! 20:37:33 < tlwoerner> wrong copy&paste, the actual error is: 20:37:36 < tlwoerner> *** No rule to make target 'arch/arm64/boot/dts/apq8016-sbc.dtb'. Stop. 20:37:53 < tlwoerner> i.e., the "qcom/" is being stripped out (From OE-Core rev: 0d725c76c113dec441a7319a6ee997e4ae8c4c88) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
113 lines
4.1 KiB
Plaintext
113 lines
4.1 KiB
Plaintext
# Support for device tree generation
|
|
PACKAGES_append = " \
|
|
${KERNEL_PACKAGE_NAME}-devicetree \
|
|
${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \
|
|
"
|
|
FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
|
|
FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
|
|
|
|
# Generate kernel+devicetree bundle
|
|
KERNEL_DEVICETREE_BUNDLE ?= "0"
|
|
|
|
normalize_dtb () {
|
|
DTB="$1"
|
|
if echo ${DTB} | grep -q '/dts/'; then
|
|
bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
|
|
DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
|
|
fi
|
|
echo "${DTB}"
|
|
}
|
|
|
|
get_real_dtb_path_in_kernel () {
|
|
DTB="$1"
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
|
|
if [ ! -e "${DTB_PATH}" ]; then
|
|
DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
|
|
fi
|
|
echo "${DTB_PATH}"
|
|
}
|
|
|
|
do_configure_append() {
|
|
if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
|
|
if echo ${KERNEL_IMAGETYPE_FOR_MAKE} | grep -q 'zImage'; then
|
|
case "${ARCH}" in
|
|
"arm")
|
|
config="${B}/.config"
|
|
if ! grep -q 'CONFIG_ARM_APPENDED_DTB=y' $config; then
|
|
bbwarn 'CONFIG_ARM_APPENDED_DTB is NOT enabled in the kernel. Enabling it to allow the kernel to boot with the Device Tree appended!'
|
|
sed -i "/CONFIG_ARM_APPENDED_DTB[ =]/d" $config
|
|
echo "CONFIG_ARM_APPENDED_DTB=y" >> $config
|
|
echo "# CONFIG_ARM_ATAG_DTB_COMPAT is not set" >> $config
|
|
fi
|
|
;;
|
|
*)
|
|
bberror "KERNEL_DEVICETREE_BUNDLE is not supported for ${ARCH}. Currently it is only supported for 'ARM'."
|
|
esac
|
|
else
|
|
bberror 'The KERNEL_DEVICETREE_BUNDLE requires the KERNEL_IMAGETYPE to contain zImage.'
|
|
fi
|
|
fi
|
|
}
|
|
|
|
do_compile_append() {
|
|
for DTB in ${KERNEL_DEVICETREE}; do
|
|
DTB=`normalize_dtb "${DTB}"`
|
|
oe_runmake ${DTB}
|
|
done
|
|
}
|
|
|
|
do_install_append() {
|
|
for DTB in ${KERNEL_DEVICETREE}; do
|
|
DTB=`normalize_dtb "${DTB}"`
|
|
DTB_EXT=${DTB##*.}
|
|
DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
|
|
DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
|
|
install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
|
|
for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
|
|
symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
|
|
DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
ln -sf ${DTB_BASE_NAME}.${DTB_EXT} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
|
|
|
|
if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
|
|
cat ${D}/${KERNEL_IMAGEDEST}/$type \
|
|
${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} \
|
|
> ${D}/${KERNEL_IMAGEDEST}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
|
fi
|
|
done
|
|
done
|
|
}
|
|
|
|
do_deploy_append() {
|
|
for DTB in ${KERNEL_DEVICETREE}; do
|
|
DTB=`normalize_dtb "${DTB}"`
|
|
DTB_EXT=${DTB##*.}
|
|
DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
|
|
for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
|
|
base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
|
|
symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
|
|
DTB_NAME=`echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
|
|
DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
|
|
install -d ${DEPLOYDIR}
|
|
install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
|
|
ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
|
|
ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_BASE_NAME}.${DTB_EXT}
|
|
|
|
if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
|
|
cat ${DEPLOYDIR}/$type \
|
|
${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
|
|
> ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}.bin
|
|
ln -sf ${DTB_NAME}.${DTB_EXT}.bin ${DEPLOYDIR}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
|
|
|
if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
|
|
cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
|
|
${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
|
|
> ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin
|
|
ln -sf ${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin \
|
|
${DEPLOYDIR}/${type}-initramfs-${DTB_BASE_NAME}.${DTB_EXT}-${MACHINE}.bin
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
}
|