summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorHerve Jourdain <herve.jourdain@neuf.fr>2016-07-21 06:00:39 +0800
committerAndrei Gherzan <andrei@gherzan.ro>2016-09-21 16:50:32 +0100
commit1a32817fb8a0f50329c43a6f15917ec3d2e0b321 (patch)
treea0519891becb72bf4ccaa327d258afe8d4a5c9f6 /classes
parentd98f2a74db536e1f350ead8723adde47e6ae89d2 (diff)
downloadmeta-raspberrypi-1a32817fb8a0f50329c43a6f15917ec3d2e0b321.tar.gz
sdcard_image-rpi.bbclass: support for .dtbo files for dtb overlays
Kernel 4.4.6+ on RaspberryPi support .dtbo files for overlays, instead of .dtb. Add support for both extensions for overlays (".dtb" and ".dtbo") CAUTION: in IMAGE_CMD_rpi-sdimg, 'TMPDIR' is not set, causing 'STAGING_KERNEL_BUILDDIR' to not be expanded, causing get_dts() to not being able to get the kernel version! To avoid this problem, the kernel version is added in a new variable outside the scope of IMAGE_CMD_rpi-sdimg, and its value passed to get_dts() and split_overlays()! Signed-off-by: Herve Jourdain <herve.jourdain@neuf.fr>
Diffstat (limited to 'classes')
-rw-r--r--classes/sdcard_image-rpi.bbclass15
1 files changed, 9 insertions, 6 deletions
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 388398b..7ab0ca6 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -71,6 +71,8 @@ SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg"
71# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. 71# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
72FATPAYLOAD ?= "" 72FATPAYLOAD ?= ""
73 73
74RPI_KERNEL_VERSION := "${@get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')}"
75
74IMAGE_CMD_rpi-sdimg () { 76IMAGE_CMD_rpi-sdimg () {
75 77
76 # Align partitions 78 # Align partitions
@@ -81,7 +83,7 @@ IMAGE_CMD_rpi-sdimg () {
81 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB" 83 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
82 84
83 # Check if we are building with device tree support 85 # Check if we are building with device tree support
84 DTS="${@get_dts(d, None)}" 86 DTS="${@get_dts(d, '${RPI_KERNEL_VERSION}')}"
85 87
86 # Initialize sdcard image file 88 # Initialize sdcard image file
87 dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE} 89 dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -101,9 +103,9 @@ IMAGE_CMD_rpi-sdimg () {
101 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS 103 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
102 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ 104 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
103 if test -n "${DTS}"; then 105 if test -n "${DTS}"; then
104 # Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' string and will be put in a dedicated folder 106 # Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' (4.1.x) or by '.dtbo' (4.4.9+) string and will be put in a dedicated folder
105 DT_OVERLAYS="${@split_overlays(d, 0)}" 107 DT_OVERLAYS="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 0)}"
106 DT_ROOT="${@split_overlays(d, 1)}" 108 DT_ROOT="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 1)}"
107 109
108 # Copy board device trees to root folder 110 # Copy board device trees to root folder
109 for DTB in ${DT_ROOT}; do 111 for DTB in ${DT_ROOT}; do
@@ -115,9 +117,10 @@ IMAGE_CMD_rpi-sdimg () {
115 # Copy device tree overlays to dedicated folder 117 # Copy device tree overlays to dedicated folder
116 mmd -i ${WORKDIR}/boot.img overlays 118 mmd -i ${WORKDIR}/boot.img overlays
117 for DTB in ${DT_OVERLAYS}; do 119 for DTB in ${DT_OVERLAYS}; do
118 DTB_BASE_NAME=`basename ${DTB} .dtb` 120 DTB_EXT=${DTB##*.}
121 DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
119 122
120 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::overlays/${DTB_BASE_NAME}.dtb 123 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
121 done 124 done
122 fi 125 fi
123 case "${KERNEL_IMAGETYPE}" in 126 case "${KERNEL_IMAGETYPE}" in