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