Skip to contentSkip to conversation

Yocto Bug #6945

PATCH Superseded [email protected] 3 participants 7 messages Aug 4, 2015 – Aug 7, 2015

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Yocto Bug #6945

From: He Zhe <[email protected]>

- Add KERNEL_IMAGETYPES to support building packaging and installing
multi types of kernel images, such as zImage uImage, at one time.
- KERNEL_IMAGETYPE works as it did.
- v2: Update with the latest oe-core
- v3: Add KERNEL_IMAGETYPES, leave KERNEL_IMAGETYPE as is.

Thank Richard for his great suggestion.

He Zhe (1):
kernel: Add KERNEL_IMAGETYPES to build multi types of kernel at one
time

 meta/classes/kernel-fitimage.bbclass    |  21 +++---
 meta/classes/kernel-grub.bbclass        |  46 ++++++++----
 meta/classes/kernel-uimage.bbclass      |  22 +++---
 meta/classes/kernel.bbclass             | 128 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  15 ++--
 6 files changed, 159 insertions(+), 74 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH v3 1/1 kernel: Add KERNEL_IMAGETYPES to build multi types of kernel at one time

From: He Zhe <[email protected]>

Add KERNEL_IMAGETYPES to support building packaging and installing multi types of kernel images, such as zImage uImage, at one time. KERNEL_IMAGETYPE works as it did.

Fixes [YOCTO #6945].

---
 meta/classes/kernel-fitimage.bbclass    |  21 +++---
 meta/classes/kernel-grub.bbclass        |  46 ++++++++----
 meta/classes/kernel-uimage.bbclass      |  22 +++---
 meta/classes/kernel.bbclass             | 128 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  15 ++--
 6 files changed, 159 insertions(+), 74 deletions(-)
meta/classes/kernel-fitimage.bbclass +12 -9
index 2a56a54..1b65c0d 100644
@@ -1,8 +1,8 @@
 inherit kernel-uboot
 
 python __anonymous () {
-    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
-    if kerneltype == 'fitImage':
+    kerneltype = d.getVar('KERNEL_IMAGETYPES', True) or ""
+    if 'fitImage' in kerneltype.split():
         depends = d.getVar("DEPENDS", True)
         depends = "%s u-boot-mkimage-native dtc-native" % depends
         d.setVar("DEPENDS", depends)
@@ -10,7 +10,10 @@ python __anonymous () {
 	# Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
 	# to kernel.bbclass . We have to override it, since we pack zImage
 	# (at least for now) into the fitImage .
-        d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+        typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
+        if 'fitImage' in typeformake.split():
+            typeformake.replace('fitImage', 'zImage')
+        d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
 
         image = d.getVar('INITRAMFS_IMAGE', True)
         if image:
@@ -154,7 +157,7 @@ EOF
 }
 
 do_assemble_fitimage() {
-	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+	if test "x${KERNEL_IMAGETYPES}" != "x${KERNEL_IMAGETYPES//fitImage/}" ; then
 		kernelcount=1
 		dtbcount=""
 		rm -f fit-image.its
@@ -217,14 +220,14 @@ addtask assemble_fitimage before do_install after do_compile
 
 kernel_do_deploy_append() {
 	# Update deploy directory
-	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+	if test "x${KERNEL_IMAGETYPES}" != "x${KERNEL_IMAGETYPES//fitImage/}" ; then
 		cd ${B}
 		echo "Copying fit-image.its source file..."
-		its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
-		its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE}
+		its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
+		its_symlink_name=fitImage-its-${MACHINE}
 		install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
-		linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
-		linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE}
+		linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
+		linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
 		install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin
 
 		cd ${DEPLOYDIR}
meta/classes/kernel-grub.bbclass +31 -15

84 lines not on this page · raw message

meta/classes/kernel-uimage.bbclass +12 -10
index f73965b..c60fe5c 100644
@@ -1,23 +1,25 @@
 inherit kernel-uboot
 
 python __anonymous () {
-    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
-    if kerneltype == 'uImage':
+    if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split():
         depends = d.getVar("DEPENDS", True)
         depends = "%s u-boot-mkimage-native" % depends
         d.setVar("DEPENDS", depends)
 
-	# Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
-	# to kernel.bbclass . We override the variable here, since we need
-	# to build uImage using the kernel build system if and only if
-	# KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
-	# the uImage .
-	if d.getVar("KEEPUIMAGE", True) != 'yes':
-            d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+        # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
+        # to kernel.bbclass . We override the variable here, since we need
+        # to build uImage using the kernel build system if and only if
+        # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
+        # the uImage .
+        if d.getVar("KEEPUIMAGE", True) != 'yes':
+            typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
+            if "uImage" in typeformake.split():
+                typeformake.replace('uImage', 'zImage')
+            d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
 }
 
 do_uboot_mkimage() {
-	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
+	if test "x${KERNEL_IMAGETYPES}" != "x${KERNEL_IMAGETYPES//uImage/}" ; then
 		if test "x${KEEPUIMAGE}" != "xyes" ; then
 			uboot_prep_kimage
 
meta/classes/kernel.bbclass +93 -35

202 lines not on this page · raw message

meta/conf/documentation.conf +1 -0
index 075ab6a..b2626e6 100644
@@ -245,6 +245,7 @@ KERNEL_CLASSES[doc] = "A list of classes defining kernel image types that kernel
 KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line arguments the OpenEmbedded build system passes on when compiling the kernel."
 KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions."
 KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
+KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults to KERNEL_IMAGETYPE."
 KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
 KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules"
 KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
meta/recipes-kernel/linux/linux-dtb.inc +10 -5
index ee3a5e1..ee4300e 100644
@@ -25,7 +25,8 @@ do_install_append() {
 				DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
 			fi
 			DTB_BASE_NAME=`basename ${DTB} .dtb`
-			DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+			IMAGE_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | awk -F " " '{print $1}'`
+			DTB_SYMLINK_NAME=`echo ${IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 			DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
 			if [ ! -e "${DTB_PATH}" ]; then
 				DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
@@ -43,8 +44,10 @@ do_deploy_append() {
 				DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
 			fi
 			DTB_BASE_NAME=`basename ${DTB} .dtb`
-			DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+			IMAGE_BASE_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | awk -F " " '{print $1}'`
+			DTB_NAME=`echo ${IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+			IMAGE_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | awk -F " " '{print $1}'`
+			DTB_SYMLINK_NAME=`echo ${IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 			DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
 			if [ ! -e "${DTB_PATH}" ]; then
 				DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
@@ -63,7 +66,8 @@ pkg_postinst_kernel-devicetree () {
 	for DTB_FILE in ${KERNEL_DEVICETREE}
 	do
 		DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
-		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+		IMAGE_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | awk -F " " '{print $1}'`
+		DTB_SYMLINK_NAME=`echo ${IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
 	done
 }
@@ -73,7 +77,8 @@ pkg_postrm_kernel-devicetree () {
 	for DTB_FILE in ${KERNEL_DEVICETREE}
 	do
 		DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
-		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+		IMAGE_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | awk -F " " '{print $1}'`
+		DTB_SYMLINK_NAME=`echo ${IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
 	done
 }
Signature · 1 line
2.1.0
#2 lore raw

Re: [PATCH v3 1/1] kernel: Add KERNEL_IMAGETYPES to build multi types of kernel at one time

Quoted 9 lines · On Tue, 2015-08-04 at 17:17 +0800, [email protected] wrote:

From: He Zhe <[email protected]>

Add KERNEL_IMAGETYPES to support building packaging and installing multi types of kernel images, such as zImage uImage, at one time. KERNEL_IMAGETYPE works as it did.

Fixes [YOCTO #6945].

Quoted 8 lines
---
 meta/classes/kernel-fitimage.bbclass    |  21 +++---
 meta/classes/kernel-grub.bbclass        |  46 ++++++++----
 meta/classes/kernel-uimage.bbclass      |  22 +++---
 meta/classes/kernel.bbclass             | 128 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  15 ++--
 6 files changed, 159 insertions(+), 74 deletions(-)

I put this into master-next just to see what happened. I haven't reviewed the code in more detail as yet. We saw:

https://autobuilder.yoctoproject.org/main/builders/build-appliance/builds/418/steps/BuildImages_1/logs/stdio

as one of the results and I suspect the linux-yocto packaging issue comes from this. This suggests ipk packaging was not tested :(.

Cheers,

Richard

#3 lore raw

Re: [PATCH v3 1/1] kernel: Add KERNEL_IMAGETYPES to build multi types of kernel at one time

Quoted 19 lines · Richard Purdie
Quoted 9 lines · On Tue, 2015-08-04 at 17:17 +0800, [email protected] wrote:

From: He Zhe <[email protected]>

Add KERNEL_IMAGETYPES to support building packaging and installing multi types of kernel images, such as zImage uImage, at one time. KERNEL_IMAGETYPE works as it did.

Fixes [YOCTO #6945].

Quoted 8 lines
---
 meta/classes/kernel-fitimage.bbclass    |  21 +++---
 meta/classes/kernel-grub.bbclass        |  46 ++++++++----
 meta/classes/kernel-uimage.bbclass      |  22 +++---
 meta/classes/kernel.bbclass             | 128 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  15 ++--
 6 files changed, 159 insertions(+), 74 deletions(-)
Quoted 7 lines

I put this into master-next just to see what happened. I haven't reviewed the code in more detail as yet. We saw:

https://autobuilder.yoctoproject.org/main/builders/build-appliance/builds/418/steps/BuildImages_1/logs/stdio

as one of the results and I suspect the linux-yocto packaging issue comes from this. This suggests ipk packaging was not tested :(.

Also, if I have to guess, I think the uboot mkimage failure from:
https://autobuilder.yoctoproject.org/main/builders/nightly-arm64/builds/83/steps/BuildImages/logs/stdio

may be from this patch.

Cheers,

Richard

author
#4 lore raw
In reply to [email protected]

Ping.

Quoted 22 lines · On 08/04/2015 05:17 PM, [email protected] wrote:

From: He Zhe <[email protected]>

- Add KERNEL_IMAGETYPES to support building packaging and installing
multi types of kernel images, such as zImage uImage, at one time.
- KERNEL_IMAGETYPE works as it did.
- v2: Update with the latest oe-core
- v3: Add KERNEL_IMAGETYPES, leave KERNEL_IMAGETYPE as is.

Thank Richard for his great suggestion.

He Zhe (1):
kernel: Add KERNEL_IMAGETYPES to build multi types of kernel at one
time

 meta/classes/kernel-fitimage.bbclass    |  21 +++---
 meta/classes/kernel-grub.bbclass        |  46 ++++++++----
 meta/classes/kernel-uimage.bbclass      |  22 +++---
 meta/classes/kernel.bbclass             | 128 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  15 ++--
 6 files changed, 159 insertions(+), 74 deletions(-)
#5 lore raw
Quoted 1 line · He Zhe

Ping.

Sending these out daily is going to annoy me, please stop doing that.

As mentioned in other emails, I'm travelling at the moment, other people are on vacation (including Bruce) and we're struggling in the patch review and merging, not least due to the other autobuilder failures. This patch is changing a lot of important code and if we screw this up, will annoy a lot of people. It therefore needs careful review which we will get to as soon as we can.

Cheers,

Richard

#6 lore raw
Quoted 11 lines · Richard Purdie
Quoted 1 line · He Zhe

Ping.

Sending these out daily is going to annoy me, please stop doing that.

As mentioned in other emails, I'm travelling at the moment, other people are on vacation (including Bruce) and we're struggling in the patch review and merging, not least due to the other autobuilder failures. This patch is changing a lot of important code and if we screw this up, will annoy a lot of people. It therefore needs careful review which we will get to as soon as we can.

I was going to say something similar.

I'm moving on having a look at this as well, but I'm technically on vacation, so I
end up only with time for a few pressing issues. I have tagged this, and will look once I'm back to my normal setup (and not a small screened travel laptop!).

Cheers,

Bruce

Quoted 10 lines

Cheers,

Richard

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"