Skip to contentSkip to conversation

sdcard_image-rpi.bbclass: Remove redundant RPI_KERNEL_VERSION

PATCH In review Jonathan Liu 4 participants 4 messages Oct 6, 2016 – Oct 14, 2016 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdcard_image-rpi.bbclass: Remove redundant RPI_KERNEL_VERSION

The value of the RPI_KERNEL_VERSION can change between None and the kernel version which can result in taskhash mismatch errors while building images.

The taskhash mismatch errors can be reproduced using:
bitbake -c cleansstate virtual/kernel core-image-minimal && bitbake core-image-minimal

The get_dts() and split_overlays() functions are modified so that the kernel version argument is optional. If the version is not supplied to these functions, they will fallback to the Python equivalent of the expression used for RPI_KERNEL_VERSION.

---
 classes/linux-raspberrypi-base.bbclass | 4 ++--
 classes/sdcard_image-rpi.bbclass       | 8 +++-----
 2 files changed, 5 insertions(+), 7 deletions(-)
classes/linux-raspberrypi-base.bbclass +2 -2
index 930fc44..3a6e33d 100644
@@ -1,6 +1,6 @@
 inherit linux-kernel-base
 
-def get_dts(d, ver):
+def get_dts(d, ver=None):
     import re
 
     staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
@@ -32,7 +32,7 @@ def get_dts(d, ver):
     return dts
 
 
-def split_overlays(d, ver, out):
+def split_overlays(d, out, ver=None):
     dts = get_dts(d, ver)
     if out:
         overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
classes/sdcard_image-rpi.bbclass +3 -5
index 2f0daee..0487ef1 100644
@@ -71,8 +71,6 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
 FATPAYLOAD ?= ""
 
-RPI_KERNEL_VERSION := "${@get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')}"
-
 IMAGE_CMD_rpi-sdimg () {
 
 	# Align partitions
@@ -83,7 +81,7 @@ IMAGE_CMD_rpi-sdimg () {
 	echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
 
 	# Check if we are building with device tree support
-	DTS="${@get_dts(d, '${RPI_KERNEL_VERSION}')}"
+	DTS="${@get_dts(d)}"
 
 	# Initialize sdcard image file
 	dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -104,8 +102,8 @@ IMAGE_CMD_rpi-sdimg () {
 	mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
 	if test -n "${DTS}"; then
 		# 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
-		DT_OVERLAYS="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 0)}"
-		DT_ROOT="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 1)}"
+		DT_OVERLAYS="${@split_overlays(d, 0)}"
+		DT_ROOT="${@split_overlays(d, 1)}"
 
 		# Copy board device trees to root folder
 		for DTB in ${DT_ROOT}; do
Signature · 1 line
2.10.0
#1 lore raw
Quoted 73 lines · Jonathan Liu

The value of the RPI_KERNEL_VERSION can change between None and the kernel version which can result in taskhash mismatch errors while building images.

The taskhash mismatch errors can be reproduced using:
bitbake -c cleansstate virtual/kernel core-image-minimal && bitbake core-image-minimal

The get_dts() and split_overlays() functions are modified so that the kernel version argument is optional. If the version is not supplied to these functions, they will fallback to the Python equivalent of the expression used for RPI_KERNEL_VERSION.

---
 classes/linux-raspberrypi-base.bbclass | 4 ++--
 classes/sdcard_image-rpi.bbclass       | 8 +++-----
 2 files changed, 5 insertions(+), 7 deletions(-)
classes/linux-raspberrypi-base.bbclass +2 -2
index 930fc44..3a6e33d 100644
@@ -1,6 +1,6 @@
 inherit linux-kernel-base
 
-def get_dts(d, ver):
+def get_dts(d, ver=None):
     import re
 
     staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
@@ -32,7 +32,7 @@ def get_dts(d, ver):
     return dts
 
 
-def split_overlays(d, ver, out):
+def split_overlays(d, out, ver=None):
     dts = get_dts(d, ver)
     if out:
         overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
classes/sdcard_image-rpi.bbclass +3 -6
index 2f0daee..0487ef1 100644
@@ -71,8 +71,6 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
 FATPAYLOAD ?= ""
 
-RPI_KERNEL_VERSION := "${@get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')}"
-
 IMAGE_CMD_rpi-sdimg () {
 
        # Align partitions
@@ -83,7 +81,7 @@ IMAGE_CMD_rpi-sdimg () {
        echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
 
        # Check if we are building with device tree support
-       DTS="${@get_dts(d, '${RPI_KERNEL_VERSION}')}"
+       DTS="${@get_dts(d)}"
 
        # Initialize sdcard image file
        dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -104,8 +102,8 @@ IMAGE_CMD_rpi-sdimg () {
        mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
        if test -n "${DTS}"; then
                # 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
-               DT_OVERLAYS="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 0)}"
-               DT_ROOT="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 1)}"
+               DT_OVERLAYS="${@split_overlays(d, 0)}"
+               DT_ROOT="${@split_overlays(d, 1)}"
 
                # Copy board device trees to root folder
                for DTB in ${DT_ROOT}; do
--
Quoted 2 lines

2.10.0

Yes this makes sense - thanks.

Andreas

#2 lore raw
Quoted 71 lines · Andreas Müller
Quoted 70 lines · Jonathan Liu

The value of the RPI_KERNEL_VERSION can change between None and the kernel version which can result in taskhash mismatch errors while building images.

The taskhash mismatch errors can be reproduced using:
bitbake -c cleansstate virtual/kernel core-image-minimal && bitbake core-image-minimal

The get_dts() and split_overlays() functions are modified so that the kernel version argument is optional. If the version is not supplied to these functions, they will fallback to the Python equivalent of the expression used for RPI_KERNEL_VERSION.

---
 classes/linux-raspberrypi-base.bbclass | 4 ++--
 classes/sdcard_image-rpi.bbclass       | 8 +++-----
 2 files changed, 5 insertions(+), 7 deletions(-)
classes/linux-raspberrypi-base.bbclass +2 -2
index 930fc44..3a6e33d 100644
@@ -1,6 +1,6 @@
 inherit linux-kernel-base
 
-def get_dts(d, ver):
+def get_dts(d, ver=None):
     import re
 
     staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
@@ -32,7 +32,7 @@ def get_dts(d, ver):
     return dts
 
 
-def split_overlays(d, ver, out):
+def split_overlays(d, out, ver=None):
     dts = get_dts(d, ver)
     if out:
         overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
classes/sdcard_image-rpi.bbclass +3 -5
index 2f0daee..0487ef1 100644
@@ -71,8 +71,6 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
 FATPAYLOAD ?= ""
 
-RPI_KERNEL_VERSION := "${@get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')}"
-
 IMAGE_CMD_rpi-sdimg () {
 
        # Align partitions
@@ -83,7 +81,7 @@ IMAGE_CMD_rpi-sdimg () {
        echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
 
        # Check if we are building with device tree support
-       DTS="${@get_dts(d, '${RPI_KERNEL_VERSION}')}"
+       DTS="${@get_dts(d)}"
 
        # Initialize sdcard image file
        dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -104,8 +102,8 @@ IMAGE_CMD_rpi-sdimg () {
        mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
        if test -n "${DTS}"; then
                # 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
-               DT_OVERLAYS="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 0)}"
-               DT_ROOT="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 1)}"
+               DT_OVERLAYS="${@split_overlays(d, 0)}"
+               DT_ROOT="${@split_overlays(d, 1)}"
 
Quoted 8 lines
Quoted 5 lines
classes/sdcard_image-rpi.bbclass +0 -1
                # Copy board device trees to root folder
                for DTB in ${DT_ROOT}; do
--

2.10.0

Yes this makes sense - thanks.

Andreas

Good stuff. This explains a lot. Was merged in master. We should backport this in krogoth branch too.

--
Andrei Gherzan

#3 lore raw
In reply to Jonathan Liu
Quoted 7 lines · Jonathan Liu

The value of the RPI_KERNEL_VERSION can change between None and the kernel version which can result in taskhash mismatch errors while building images.

Quoted 7 lines

The taskhash mismatch errors can be reproduced using:
bitbake -c cleansstate virtual/kernel core-image-minimal && bitbake core-image-minimal

The get_dts() and split_overlays() functions are modified so that the kernel version argument is optional. If the version is not supplied to these functions, they will fallback to the Python equivalent of the expression used for RPI_KERNEL_VERSION.

I was able to see this error and was reaching same conclusions. I have staged this patch on kraj/master and will test it out

Quoted 64 lines

---
classes/linux-raspberrypi-base.bbclass | 4 ++--
classes/sdcard_image-rpi.bbclass | 8 +++-----

2 files changed, 5 insertions(+), 7 deletions(-)
classes/linux-raspberrypi-base.bbclass +0 -0
index 930fc44..3a6e33d 100644
@@ -1,6 +1,6 @@

inherit linux-kernel-base

classes/linux-raspberrypi-base.bbclass +2 -2
-def get_dts(d, ver):
+def get_dts(d, ver=None):
    import re
 
    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
@@ -32,7 +32,7 @@ def get_dts(d, ver):
    return dts
 
 
-def split_overlays(d, ver, out):
+def split_overlays(d, out, ver=None):
    dts = get_dts(d, ver)
    if out:
        overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
classes/sdcard_image-rpi.bbclass +0 -0
index 2f0daee..0487ef1 100644
@@ -71,8 +71,6 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.

FATPAYLOAD ?= ""

classes/sdcard_image-rpi.bbclass +0 -2
-RPI_KERNEL_VERSION := "${@get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')}"
-

IMAGE_CMD_rpi-sdimg () {

# Align partitions

classes/sdcard_image-rpi.bbclass +3 -4
@@ -83,7 +81,7 @@ IMAGE_CMD_rpi-sdimg () {
 	echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
 
 	# Check if we are building with device tree support
-	DTS="${@get_dts(d, '${RPI_KERNEL_VERSION}')}"
+	DTS="${@get_dts(d)}"
 
 	# Initialize sdcard image file
 	dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -104,8 +102,8 @@ IMAGE_CMD_rpi-sdimg () {
 	mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
 	if test -n "${DTS}"; then
 		# 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
-		DT_OVERLAYS="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 0)}"
-		DT_ROOT="${@split_overlays(d, '${RPI_KERNEL_VERSION}', 1)}"
+		DT_OVERLAYS="${@split_overlays(d, 0)}"
+		DT_ROOT="${@split_overlays(d, 1)}"
 
 		# Copy board device trees to root folder
 		for DTB in ${DT_ROOT}; do
--

2.10.0