Skip to contentSkip to conversation

Yocto Bug #6945

PATCH Superseded [email protected] 1 participant 4 messages May 12, 2016 – May 19, 2016

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Yocto Bug #6945

From: He Zhe <[email protected]>

This has been reviewed several rounds and no more comments are provided so far. Here are the brief history. More details can be found in the previous threads.

v1 to v2:
- Change KERNEL_OUTPUT to KERNEL_OUTPUT_DIR and update comments
- Update related doc files
- Replace all KERNEL_ALT_IMAGETYPEs with KERNEL_IMAGETYPES
- Link built vmlinuz to boot directory for reference

v2 to v3:
- Merge existing KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES in order that users can still use the old variables.
- Run oe_rummake in a loop for every types so that we can add different configurations to them easily in the future.
- Warn, intead of die, users if one of the types are over the size limit.
- Remove the replacement of KERNEL_ALT_IMAGETYPE in v2.
- Remove the doc parts. They will be submitted yocto-docs later.
- Change some grep usage to make it more clear.
- Correct a typo.

v3 to v4:
- Adjust according to the latest code context

The following changes since commit 7ca60ec8bff7656b4e52f5a4d238913e851da089:

test-empty-image: Fix LIC_FILES_CHKSUM typo (2016-05-06 10:48:06 +0100)

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/?h=zhe%2Fyocto-bug-6945

for you to fetch changes up to 1f37fe5af2c41d0a4e1aa5543466a48d3ae41ddc:

kernel: Make symbol link to vmlinuz in boot directory (2016-05-11 04:05:08 -0400)

----------------------------------------------------------------
He Zhe (2):
kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
kernel: Make symbol link to vmlinuz in boot directory

 meta/classes/kernel-fitimage.bbclass      |  20 ++++++++-------
 meta/classes/kernel-grub.bbclass          |  44 +++++++++++++++++++++-----------
 meta/classes/kernel-uimage.bbclass        |  22 ++++++++--------
 meta/classes/kernel.bbclass               | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------
 meta/conf/documentation.conf              |   3 ++-
 meta/recipes-kernel/linux/linux-dtb.inc   |  49 ++++++++++++++++++++++--------------
 meta/recipes-kernel/linux/linux-yocto.inc |   2 +-
 7 files changed, 218 insertions(+), 109 deletions(-)
Signature · 1 line
2.8.1
#1 lore raw

PATCH v4 1/2 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 and KERNEL_ALT_IMAGETYPE work as before.

---
 meta/classes/kernel-fitimage.bbclass    |  20 ++--
 meta/classes/kernel-grub.bbclass        |  44 +++++---
 meta/classes/kernel-uimage.bbclass      |  22 ++--
 meta/classes/kernel.bbclass             | 174 +++++++++++++++++++++++---------
 meta/conf/documentation.conf            |   1 +
 meta/recipes-kernel/linux/linux-dtb.inc |  49 +++++----
 6 files changed, 208 insertions(+), 102 deletions(-)
meta/classes/kernel-fitimage.bbclass +11 -9
index 809bd4d..86a8ff8 100644
@@ -1,8 +1,8 @@
 inherit kernel-uboot uboot-sign
 
 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,9 @@ 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():
+            d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage'))
 
         image = d.getVar('INITRAMFS_IMAGE', True)
         if image:
@@ -187,7 +189,7 @@ EOF
 }
 
 do_assemble_fitimage() {
-	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
 		kernelcount=1
 		dtbcount=""
 		rm -f fit-image.its arch/${ARCH}/boot/fitImage
@@ -265,14 +267,14 @@ addtask assemble_fitimage before do_install after do_compile
 kernel_do_deploy[vardepsexclude] = "DATETIME"
 kernel_do_deploy_append() {
 	# Update deploy directory
-	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+	if echo ${KERNEL_IMAGETYPES} | grep -wq "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 +29 -15

82 lines not on this page · raw message

meta/classes/kernel-uimage.bbclass +12 -10
index de7ca38..2a187f5 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", "vmlinux")
+        # 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', 'vmlinux')
+            d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
 }
 
 do_uboot_mkimage() {
-	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
+	if echo "${KERNEL_IMAGETYPES}" | grep -wq "uImage"; then
 		if test "x${KEEPUIMAGE}" != "xyes" ; then
 			uboot_prep_kimage
 
meta/classes/kernel.bbclass +125 -49

279 lines not on this page · raw message

meta/conf/documentation.conf +1 -0
index 4234d75..dcc324c 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 +30 -19

70 lines not on this page · raw message

Signature · 1 line
2.8.1
#2 lore raw

PATCH v4 2/2 kernel: Make symbol link to vmlinuz in boot directory

In reply to [email protected]

From: He Zhe <[email protected]>

Rename do_kernel_link_vmlinux to do_kernel_link_images and make a symbol link to vmlinuz(if exists) for reference in arch/$arch/boot directory.

---
 meta/classes/kernel.bbclass               | 13 ++++++++-----
 meta/conf/documentation.conf              |  2 +-
 meta/recipes-kernel/linux/linux-yocto.inc |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)
meta/classes/kernel.bbclass +8 -5
index 775c827..28d0936 100644
@@ -474,15 +474,18 @@ python split_kernel_packages () {
 }
 
 # Many scripts want to look in arch/$arch/boot for the bootable
-# image. This poses a problem for vmlinux based booting. This 
-# task arranges to have vmlinux appear in the normalized directory
-# location.
-do_kernel_link_vmlinux() {
+# image. This poses a problem for vmlinux and vmlinuz based
+# booting. This task arranges to have vmlinux and vmlinuz appear
+# in the normalized directory location.
+do_kernel_link_images() {
 	if [ ! -d "${B}/arch/${ARCH}/boot" ]; then
 		mkdir ${B}/arch/${ARCH}/boot
 	fi
 	cd ${B}/arch/${ARCH}/boot
 	ln -sf ../../../vmlinux
+	if [ -f ../../../vmlinuz ]; then
+		ln -sf ../../../vmlinuz
+	fi
 }
 
 do_strip() {
@@ -512,7 +515,7 @@ do_strip() {
 }
 do_strip[dirs] = "${B}"
 
-addtask do_strip before do_sizecheck after do_kernel_link_vmlinux
+addtask do_strip before do_sizecheck after do_kernel_link_images
 
 # Support checking the kernel size since some kernels need to reside in partitions
 # with a fixed length or there is a limit in transferring the kernel to memory
meta/conf/documentation.conf +1 -1
index dcc324c..c0025f5 100644
@@ -28,7 +28,7 @@ do_install_ptest_base[doc] = "Copies the runtime test suite files from the compi
 do_kernel_checkout[doc] = "Checks out source/meta branches for a linux-yocto style kernel"
 do_kernel_configcheck[doc] = "Validates the kernel configuration for a linux-yocto style kernel"
 do_kernel_configme[doc] = "Assembles the kernel configuration for a linux-yocto style kernel"
-do_kernel_link_vmlinux[doc] = "Creates a symbolic link in arch/$arch/boot for vmlinux kernel images"
+do_kernel_link_images[doc] = "Creates a symbolic link in arch/$arch/boot for vmlinux and vmlinuz kernel images"
 do_listtasks[doc] = "Lists all defined tasks for a target"
 do_menuconfig[doc] = "Runs 'make menuconfig' for the kernel"
 do_package[doc] = "Analyzes the content of the holding area and splits it into subsets based on available packages and files"
meta/recipes-kernel/linux/linux-yocto.inc +1 -1
index 6b161fc..fd68786 100644
@@ -52,6 +52,6 @@ do_install_append(){
 }
 
 # extra tasks
-addtask kernel_link_vmlinux after do_compile before do_install
+addtask kernel_link_images after do_compile before do_install
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
Signature · 1 line
2.8.1
author
#3 lore raw
In reply to [email protected]

Ping.

Quoted 50 lines · On 05/12/2016 05:48 PM, [email protected] wrote:

From: He Zhe <[email protected]>

This has been reviewed several rounds and no more comments are provided so far. Here are the brief history. More details can be found in the previous threads.

v1 to v2:
- Change KERNEL_OUTPUT to KERNEL_OUTPUT_DIR and update comments
- Update related doc files
- Replace all KERNEL_ALT_IMAGETYPEs with KERNEL_IMAGETYPES
- Link built vmlinuz to boot directory for reference

v2 to v3:
- Merge existing KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES in order that users can still use the old variables.
- Run oe_rummake in a loop for every types so that we can add different configurations to them easily in the future.
- Warn, intead of die, users if one of the types are over the size limit.
- Remove the replacement of KERNEL_ALT_IMAGETYPE in v2.
- Remove the doc parts. They will be submitted yocto-docs later.
- Change some grep usage to make it more clear.
- Correct a typo.

v3 to v4:
- Adjust according to the latest code context

The following changes since commit 7ca60ec8bff7656b4e52f5a4d238913e851da089:

test-empty-image: Fix LIC_FILES_CHKSUM typo (2016-05-06 10:48:06 +0100)

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/?h=zhe%2Fyocto-bug-6945

for you to fetch changes up to 1f37fe5af2c41d0a4e1aa5543466a48d3ae41ddc:

kernel: Make symbol link to vmlinuz in boot directory (2016-05-11 04:05:08 -0400)

----------------------------------------------------------------
He Zhe (2):
kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
kernel: Make symbol link to vmlinuz in boot directory

 meta/classes/kernel-fitimage.bbclass      |  20 ++++++++-------
 meta/classes/kernel-grub.bbclass          |  44 +++++++++++++++++++++-----------
 meta/classes/kernel-uimage.bbclass        |  22 ++++++++--------
 meta/classes/kernel.bbclass               | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------
 meta/conf/documentation.conf              |   3 ++-
 meta/recipes-kernel/linux/linux-dtb.inc   |  49 ++++++++++++++++++++++--------------
 meta/recipes-kernel/linux/linux-yocto.inc |   2 +-
 7 files changed, 218 insertions(+), 109 deletions(-)