diff options
Diffstat (limited to 'meta/classes/kernel-devicetree.bbclass')
| -rw-r--r-- | meta/classes/kernel-devicetree.bbclass | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass deleted file mode 100644 index b2117de805..0000000000 --- a/meta/classes/kernel-devicetree.bbclass +++ /dev/null | |||
| @@ -1,119 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | # Support for device tree generation | ||
| 8 | python () { | ||
| 9 | if not bb.data.inherits_class('nopackages', d): | ||
| 10 | d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree") | ||
| 11 | if d.getVar('KERNEL_DEVICETREE_BUNDLE') == '1': | ||
| 12 | d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle") | ||
| 13 | } | ||
| 14 | |||
| 15 | FILES:${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo" | ||
| 16 | FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin" | ||
| 17 | |||
| 18 | # Generate kernel+devicetree bundle | ||
| 19 | KERNEL_DEVICETREE_BUNDLE ?= "0" | ||
| 20 | |||
| 21 | # dtc flags passed via DTC_FLAGS env variable | ||
| 22 | KERNEL_DTC_FLAGS ?= "" | ||
| 23 | |||
| 24 | normalize_dtb () { | ||
| 25 | dtb="$1" | ||
| 26 | if echo $dtb | grep -q '/dts/'; then | ||
| 27 | bbwarn "$dtb contains the full path to the the dts file, but only the dtb name should be used." | ||
| 28 | dtb=`basename $dtb | sed 's,\.dts$,.dtb,g'` | ||
| 29 | fi | ||
| 30 | echo "$dtb" | ||
| 31 | } | ||
| 32 | |||
| 33 | get_real_dtb_path_in_kernel () { | ||
| 34 | dtb="$1" | ||
| 35 | dtb_path="${B}/arch/${ARCH}/boot/dts/$dtb" | ||
| 36 | if [ ! -e "$dtb_path" ]; then | ||
| 37 | dtb_path="${B}/arch/${ARCH}/boot/$dtb" | ||
| 38 | fi | ||
| 39 | echo "$dtb_path" | ||
| 40 | } | ||
| 41 | |||
| 42 | do_configure:append() { | ||
| 43 | if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then | ||
| 44 | if echo ${KERNEL_IMAGETYPE_FOR_MAKE} | grep -q 'zImage'; then | ||
| 45 | case "${ARCH}" in | ||
| 46 | "arm") | ||
| 47 | config="${B}/.config" | ||
| 48 | if ! grep -q 'CONFIG_ARM_APPENDED_DTB=y' $config; then | ||
| 49 | bbwarn 'CONFIG_ARM_APPENDED_DTB is NOT enabled in the kernel. Enabling it to allow the kernel to boot with the Device Tree appended!' | ||
| 50 | sed -i "/CONFIG_ARM_APPENDED_DTB[ =]/d" $config | ||
| 51 | echo "CONFIG_ARM_APPENDED_DTB=y" >> $config | ||
| 52 | echo "# CONFIG_ARM_ATAG_DTB_COMPAT is not set" >> $config | ||
| 53 | fi | ||
| 54 | ;; | ||
| 55 | *) | ||
| 56 | bberror "KERNEL_DEVICETREE_BUNDLE is not supported for ${ARCH}. Currently it is only supported for 'ARM'." | ||
| 57 | esac | ||
| 58 | else | ||
| 59 | bberror 'The KERNEL_DEVICETREE_BUNDLE requires the KERNEL_IMAGETYPE to contain zImage.' | ||
| 60 | fi | ||
| 61 | fi | ||
| 62 | } | ||
| 63 | |||
| 64 | do_compile:append() { | ||
| 65 | if [ -n "${KERNEL_DTC_FLAGS}" ]; then | ||
| 66 | export DTC_FLAGS="${KERNEL_DTC_FLAGS}" | ||
| 67 | fi | ||
| 68 | |||
| 69 | for dtbf in ${KERNEL_DEVICETREE}; do | ||
| 70 | dtb=`normalize_dtb "$dtbf"` | ||
| 71 | oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} | ||
| 72 | done | ||
| 73 | } | ||
| 74 | |||
| 75 | do_install:append() { | ||
| 76 | for dtbf in ${KERNEL_DEVICETREE}; do | ||
| 77 | dtb=`normalize_dtb "$dtbf"` | ||
| 78 | dtb_ext=${dtb##*.} | ||
| 79 | dtb_base_name=`basename $dtb .$dtb_ext` | ||
| 80 | dtb_path=`get_real_dtb_path_in_kernel "$dtb"` | ||
| 81 | install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext | ||
| 82 | done | ||
| 83 | } | ||
| 84 | |||
| 85 | do_deploy:append() { | ||
| 86 | for dtbf in ${KERNEL_DEVICETREE}; do | ||
| 87 | dtb=`normalize_dtb "$dtbf"` | ||
| 88 | dtb_ext=${dtb##*.} | ||
| 89 | dtb_base_name=`basename $dtb .$dtb_ext` | ||
| 90 | install -d $deployDir | ||
| 91 | install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext | ||
| 92 | if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then | ||
| 93 | ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext | ||
| 94 | fi | ||
| 95 | if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then | ||
| 96 | ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext | ||
| 97 | fi | ||
| 98 | for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do | ||
| 99 | if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then | ||
| 100 | cat ${D}/${KERNEL_IMAGEDEST}/$type \ | ||
| 101 | $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ | ||
| 102 | > $deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} | ||
| 103 | if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then | ||
| 104 | ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \ | ||
| 105 | $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} | ||
| 106 | fi | ||
| 107 | if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then | ||
| 108 | cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \ | ||
| 109 | $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ | ||
| 110 | > $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} | ||
| 111 | if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then | ||
| 112 | ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \ | ||
| 113 | $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} | ||
| 114 | fi | ||
| 115 | fi | ||
| 116 | fi | ||
| 117 | done | ||
| 118 | done | ||
| 119 | } | ||
