diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-kernel/linux/linux-dtb.inc | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-kernel/linux/linux-dtb.inc')
-rw-r--r-- | meta/recipes-kernel/linux/linux-dtb.inc | 69 |
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 | ||
2 | FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*" | ||
3 | |||
4 | python __anonymous () { | ||
5 | d.appendVar("PACKAGES", " kernel-devicetree") | ||
6 | } | ||
7 | |||
8 | do_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 | |||
28 | do_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 | |||
51 | pkg_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 | |||
61 | pkg_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 | } | ||