summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-dtb.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-dtb.inc')
-rw-r--r--meta/recipes-kernel/linux/linux-dtb.inc69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
new file mode 100644
index 0000000000..6b8f1a54b8
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -0,0 +1,69 @@
1# Support for device tree generation
2FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
3
4python __anonymous () {
5 d.appendVar("PACKAGES", " kernel-devicetree")
6}
7
8do_install_append() {
9 if test -n "${KERNEL_DEVICETREE}"; then
10 for DTB in ${KERNEL_DEVICETREE}; do
11 if echo ${DTB} | grep -q '/dts/'; then
12 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
13 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
14 fi
15 DTB_BASE_NAME=`basename ${DTB} .dtb`
16 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
17 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
18 DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
19 oe_runmake ${DTB}
20 if [ ! -e "${DTB_PATH}" ]; then
21 DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
22 fi
23 install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
24 done
25 fi
26}
27
28do_deploy_append() {
29 if test -n "${KERNEL_DEVICETREE}"; then
30 for DTB in ${KERNEL_DEVICETREE}; do
31 if echo ${DTB} | grep -q '/dts/'; then
32 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
33 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
34 fi
35 DTB_BASE_NAME=`basename ${DTB} .dtb`
36 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
37 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
38 DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
39 if [ ! -e "${DTB_PATH}" ]; then
40 DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
41 fi
42 install -d ${DEPLOYDIR}
43 install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
44 cd ${DEPLOYDIR}
45 ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
46 cd -
47 done
48 fi
49}
50
51pkg_postinst_kernel-devicetree () {
52 cd /${KERNEL_IMAGEDEST}
53 for DTB_FILE in ${KERNEL_DEVICETREE}
54 do
55 DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
56 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
57 update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
58 done
59}
60
61pkg_postrm_kernel-devicetree () {
62 cd /${KERNEL_IMAGEDEST}
63 for DTB_FILE in ${KERNEL_DEVICETREE}
64 do
65 DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
66 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
67 update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
68 done
69}