Skip to contentSkip to conversation

Yocto Bug #6945

PATCH New [email protected] 1 participant 2 messages Nov 10, 2015

lore
Share & tools
lore
#0 lore raw

v5 cover Yocto Bug #6945

From: He Zhe <[email protected]>

This patch has been discussed previously and modified according to Richard's suggestions, and adjusted against the latest code context.

- 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
- v4: Turn package name to lower case to meet opkg's requrement Modify "if test" in kernel-fitimage.bbclass and kernel-uimage.bbclass

The following changes since commit fc45deac89ef63ca1c44e763c38ced7dfd72cbe1:

build-appliance-image: Update to jethro head revision (2015-11-03 14:03:03 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib zhe/yocto-bug-6945
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=zhe/yocto-bug-6945

for you to fetch changes up to 60c8a07a0e130d056862f6303cac080eb0fbc2d0:

kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time (2015-11-09 04:55:00 -0500)

----------------------------------------------------------------

He Zhe (1):
kernel: Add KERNEL_IMAGETYPES to build multi types 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             | 159 ++++++++++++++++++++++----------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  80 +++++++++-------
 6 files changed, 212 insertions(+), 117 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v5 1/1 kernel: Add KERNEL_IMAGETYPES to build multi types 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             | 159 ++++++++++++++++++++++----------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  80 +++++++++-------
 6 files changed, 212 insertions(+), 117 deletions(-)
meta/classes/kernel-fitimage.bbclass +12 -9
index 2a56a54..e4b48fe 100644
@@ -1,8 +1,8 @@
 inherit kernel-uboot
 
 python __anonymous () {
-    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
-    if kerneltype == 'fitImage':
+    kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or ""
+    if 'fitImage' in kerneltypes.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 echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; 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 echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; 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..a238ce4 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 echo "${KERNEL_IMAGETYPES}" | grep -Pq "\buImage\b"; then
 		if test "x${KEEPUIMAGE}" != "xyes" ; then
 			uboot_prep_kimage
 
meta/classes/kernel.bbclass +109 -50

267 lines not on this page · raw message

meta/conf/documentation.conf +1 -0
index 845559a..2baef96 100644
@@ -247,6 +247,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 +47 -33

103 lines not on this page · raw message

Signature · 1 line
1.9.1