All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] [V3] Fix some issues of kernel/image recipes
@ 2017-03-21 14:34 liu.ming50
  2017-03-21 14:34 ` [PATCH 1/4] kernel.bbclass: fix some incorrect inter-task dependencies liu.ming50
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: liu.ming50 @ 2017-03-21 14:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

The changes in V3:
1 Drop one patch which is problematic.
2 Change a conditional checking line in kernel-initramfs.bb:
From: "if type != 'vmlinux' or d.getVar('KERNEL_IMAGETYPE') == 'vmlinux':"
To: "if type != 'vmlinux' or 'vmlinux' in (d.getVar('KERNEL_IMAGETYPE') or ""):"

provided that KERNEL_IMAGETYPE might be extended in machine confs.

Ming Liu (4):
  kernel.bbclass: fix some incorrect inter-task dependencies
  kernel.bbclass: introduce INITRAMFS_IMAGE_NAME
  image.bbclass: remove initramfs bundle related code
  kernel-initramfs: add recipe

 meta/classes/image.bbclass                    |  13 ----
 meta/classes/kernel-fitimage.bbclass          |  10 +--
 meta/classes/kernel.bbclass                   |  26 +++----
 meta/recipes-kernel/linux/kernel-initramfs.bb | 100 ++++++++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto.inc     |   1 -
 5 files changed, 119 insertions(+), 31 deletions(-)
 create mode 100644 meta/recipes-kernel/linux/kernel-initramfs.bb

-- 
2.7.4



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] kernel.bbclass: fix some incorrect inter-task dependencies
  2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
@ 2017-03-21 14:34 ` liu.ming50
  2017-03-21 14:34 ` [PATCH 2/4] kernel.bbclass: introduce INITRAMFS_IMAGE_NAME liu.ming50
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: liu.ming50 @ 2017-03-21 14:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <peter.x.liu@external.atlascopco.com>

- Move the addtask statment that kernel_link_images needs run after
  do_compile from linux-yocto.inc to kernel.bbclass. Or else the recipes
  that inheriting kernel.bbclass might run into implicit dependency
  issues.
- Fix a typo, "addtask do_strip" should be "addtask strip".
- Remove some redundant addtask statments, when "addtask A after B" is
  set, then "addtask B before A" is not needed.

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
---
 meta/classes/kernel.bbclass               | 5 +++--
 meta/recipes-kernel/linux/linux-yocto.inc | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 1e0646a..d39fa24 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -538,6 +538,7 @@ do_kernel_link_images() {
 		ln -sf ../../../vmlinuz.bin
 	fi
 }
+addtask kernel_link_images after do_compile
 
 do_strip() {
 	if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then
@@ -566,7 +567,7 @@ do_strip() {
 }
 do_strip[dirs] = "${B}"
 
-addtask do_strip before do_sizecheck after do_kernel_link_images
+addtask 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
@@ -586,7 +587,7 @@ do_sizecheck() {
 }
 do_sizecheck[dirs] = "${B}"
 
-addtask sizecheck before do_install after do_strip
+addtask sizecheck before do_install
 
 KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
 # Don't include the DATETIME variable in the sstate package signatures
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 556546f..637506a 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -65,6 +65,5 @@ do_install_append(){
 
 # extra tasks
 addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
-addtask kernel_link_images after do_compile before do_strip
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] kernel.bbclass: introduce INITRAMFS_IMAGE_NAME
  2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
  2017-03-21 14:34 ` [PATCH 1/4] kernel.bbclass: fix some incorrect inter-task dependencies liu.ming50
@ 2017-03-21 14:34 ` liu.ming50
  2017-03-21 14:34 ` [PATCH 3/4] image.bbclass: remove initramfs bundle related code liu.ming50
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: liu.ming50 @ 2017-03-21 14:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <peter.x.liu@external.atlascopco.com>

It defaults to ${INITRAMFS_IMAGE}-${MACHINE} if INITRAMFS_IMAGE is not
empty.

This allows the end users to be able to override the initramfs image
name with a customized value.

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
---
 meta/classes/kernel-fitimage.bbclass | 10 +++++-----
 meta/classes/kernel.bbclass          | 21 +++++++++++----------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index f9702f8..1be9022 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -362,7 +362,7 @@ fitimage_assemble() {
 	if [ "x${ramdiskcount}" = "x1" ] ; then
 		# Find and use the first initramfs image archive type we find
 		for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz cpio; do
-			initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${img}"
+			initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
 			echo "Using $initramfs_path"
 			if [ -e "${initramfs_path}" ]; then
 				fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
@@ -445,11 +445,11 @@ kernel_do_deploy_append() {
 
 		if [ -n "${INITRAMFS_IMAGE}" ]; then
 			echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
-			its_initramfs_base_name="fitImage-its-${INITRAMFS_IMAGE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
-			its_initramfs_symlink_name=fitImage-its-${INITRAMFS_IMAGE}-${MACHINE}
+			its_initramfs_base_name="fitImage-its-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
+			its_initramfs_symlink_name=fitImage-its-${INITRAMFS_IMAGE_NAME}
 			install -m 0644 fit-image-${INITRAMFS_IMAGE}.its ${DEPLOYDIR}/${its_initramfs_base_name}.its
-			fit_initramfs_base_name="fitImage-${INITRAMFS_IMAGE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
-			fit_initramfs_symlink_name=fitImage-${INITRAMFS_IMAGE}-${MACHINE}
+			fit_initramfs_base_name="fitImage-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
+			fit_initramfs_symlink_name=fitImage-${INITRAMFS_IMAGE_NAME}
 			install -m 0644 arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} ${DEPLOYDIR}/${fit_initramfs_base_name}.bin
 		fi
 
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index d39fa24..8feb2c1 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -16,6 +16,7 @@ INHIBIT_DEFAULT_DEPS = "1"
 
 KERNEL_IMAGETYPE ?= "zImage"
 INITRAMFS_IMAGE ?= ""
+INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
 INITRAMFS_TASK ?= ""
 INITRAMFS_IMAGE_BUNDLE ?= ""
 
@@ -167,34 +168,34 @@ copy_initramfs() {
 	# In case the directory is not created yet from the first pass compile:
 	mkdir -p ${B}/usr
 	# Find and use the first initramfs image archive type we find
-	rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
+	rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
 	for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do
-		if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
-			cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img ${B}/usr/.
+		if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then
+			cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/.
 			case $img in
 			*gz)
 				echo "gzip decompressing image"
-				gunzip -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
+				gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
 				break
 				;;
 			*lz4)
 				echo "lz4 decompressing image"
-				lz4 -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
+				lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
 				break
 				;;
 			*lzo)
 				echo "lzo decompressing image"
-				lzop -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
+				lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
 				break
 				;;
 			*lzma)
 				echo "lzma decompressing image"
-				lzma -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
+				lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
 				break
 				;;
 			*xz)
 				echo "xz decompressing image"
-				xz -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
+				xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
 				break
 				;;
 			esac
@@ -222,7 +223,7 @@ do_bundle_initramfs () {
 				tmp_path=$tmp_path" "$type"##"
 			fi
 		done
-		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
+		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
 		kernel_do_compile
 		# Restoring kernel image
 		for tp in $tmp_path ; do
@@ -261,7 +262,7 @@ kernel_do_compile() {
 		# The old style way of copying an prebuilt image and building it
 		# is turned on via INTIRAMFS_TASK != ""
 		copy_initramfs
-		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
+		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
 	fi
 	for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
 		oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] image.bbclass: remove initramfs bundle related code
  2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
  2017-03-21 14:34 ` [PATCH 1/4] kernel.bbclass: fix some incorrect inter-task dependencies liu.ming50
  2017-03-21 14:34 ` [PATCH 2/4] kernel.bbclass: introduce INITRAMFS_IMAGE_NAME liu.ming50
@ 2017-03-21 14:34 ` liu.ming50
  2017-03-21 14:34 ` [PATCH 4/4] kernel-initramfs: add recipe liu.ming50
  2017-03-22 11:13 ` [PATCH 0/4] [V3] Fix some issues of kernel/image recipes Burton, Ross
  4 siblings, 0 replies; 7+ messages in thread
From: liu.ming50 @ 2017-03-21 14:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <peter.x.liu@external.atlascopco.com>

The original purpose of these code was to repackage initramfs bundled
kernel before image do_build, but it does not really work because the
initramfs bundled kernel images are not packaged at all after commit
a49569e3a7534779bbe3f01a0647fd076c95798d:
[ kernel.bbclass: do not copy bundled initramfs to /boot ]

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
---
 meta/classes/image.bbclass | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 405fd73..bc00884 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -184,10 +184,6 @@ python () {
     d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
 
     check_image_features(d)
-    initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
-    if initramfs_image != "":
-        d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" %  d.getVar('PN'))
-        d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image)
 }
 
 IMAGE_CLASSES += "image_types"
@@ -608,12 +604,3 @@ do_packagedata[noexec] = "1"
 do_package_write_ipk[noexec] = "1"
 do_package_write_deb[noexec] = "1"
 do_package_write_rpm[noexec] = "1"
-
-# Allow the kernel to be repacked with the initramfs and boot image file as a single file
-do_bundle_initramfs[depends] += "virtual/kernel:do_bundle_initramfs"
-do_bundle_initramfs[nostamp] = "1"
-do_bundle_initramfs[noexec] = "1"
-do_bundle_initramfs () {
-	:
-}
-addtask bundle_initramfs after do_image_complete
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] kernel-initramfs: add recipe
  2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
                   ` (2 preceding siblings ...)
  2017-03-21 14:34 ` [PATCH 3/4] image.bbclass: remove initramfs bundle related code liu.ming50
@ 2017-03-21 14:34 ` liu.ming50
  2017-03-22  4:50   ` Ming Liu
  2017-03-22 11:13 ` [PATCH 0/4] [V3] Fix some issues of kernel/image recipes Burton, Ross
  4 siblings, 1 reply; 7+ messages in thread
From: liu.ming50 @ 2017-03-21 14:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <peter.x.liu@external.atlascopco.com>

To implement initramfs bundled kernel packaging.

The kernel images are copied from DEPLOY_DIR_IMAGE, and a list of
packages will be generated according to KERNEL_IMAGETYPES setting.

For instance:
For KERNEL_IMAGETYPES = "bzImage vmlinux"

the generated packages would be:
- kernel-initramfs (Base package, RDEPENDS on kernel-initramfs-image)
- kernel-initramfs-image (Image package, RDEPENDS on all sub images)
- kernel-initramfs-image-bzimage (Contains bzImage image)
- kernel-initramfs-vmlinux (Contains vmlinux image)

This recipe would be skipped if INITRAMFS_IMAGE_BUNDLE or
INITRAMFS_IMAGE is not being set correctly.

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
---
 meta/recipes-kernel/linux/kernel-initramfs.bb | 100 ++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 meta/recipes-kernel/linux/kernel-initramfs.bb

diff --git a/meta/recipes-kernel/linux/kernel-initramfs.bb b/meta/recipes-kernel/linux/kernel-initramfs.bb
new file mode 100644
index 0000000..91ea55e
--- /dev/null
+++ b/meta/recipes-kernel/linux/kernel-initramfs.bb
@@ -0,0 +1,100 @@
+SUMMARY = "Initramfs bundled kernel images"
+DESCRIPTION = "When built, it packages initramfs bundled kernel images of the \
+preferred virtual/kernel provider."
+SECTION = "kernel"
+LICENSE = "GPLv2"
+
+inherit linux-kernel-base
+
+# Whilst not a module, this ensures we don't get multilib extended. (which would make no sense)
+inherit module-base
+
+S = "${STAGING_KERNEL_DIR}"
+B = "${WORKDIR}/build"
+
+# we dont need the default dependencies.
+INHIBIT_DEFAULT_DEPS = "1"
+
+KERNEL_ALT_IMAGETYPE ??= ""
+KERNEL_IMAGETYPES_append = " vmlinux"
+KERNEL_IMAGETYPE ?= "zImage"
+KERNEL_IMAGEDEST ?= "boot"
+KERNEL_VERSION = "${@['1.0.0', get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')][get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}') != None]}"
+KERNEL_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
+KERNEL_PRIORITY ?= "${@int(d.getVar('KERNEL_VERSION').split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
+                       int(d.getVar('KERNEL_VERSION').split('-')[0].split('+')[0].split('.')[1]) * 100 + \
+                       int(d.getVar('KERNEL_VERSION').split('-')[0].split('+')[0].split('.')[-1])}"
+
+PACKAGES = "${PN} ${PN}-image"
+
+FILES_${PN} = ""
+FILES_${PN}-image = ""
+RDEPENDS_${PN} = "${PN}-image"
+PKG_${PN} = "${PN}-${KERNEL_PKG_NAME}"
+PKG_${PN}-image = "${PN}-image-${KERNEL_PKG_NAME}"
+RPROVIDES_${PN} += "${PN}-${KERNEL_VERSION}"
+ALLOW_EMPTY_${PN} = "1"
+ALLOW_EMPTY_${PN}-image = "1"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+PACKAGES_DYNAMIC = "^kernel-initramfs-image-.*"
+
+python __anonymous () {
+    # Skip processing of this recipe if INITRAMFS_IMAGE or INITRAMFS_IMAGE_BUNDLE
+    # is not set correctly, to avoid generating only empty packages which makes
+    # no sense.
+    if not d.getVar('INITRAMFS_IMAGE') or d.getVar('INITRAMFS_IMAGE_BUNDLE') != '1':
+        raise bb.parse.SkipPackage("Set INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE to enable it")
+
+    # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
+    types = set((d.getVar('KERNEL_IMAGETYPES') or "").split())
+    types.add(d.getVar('KERNEL_IMAGETYPE') or "")
+    types.add(d.getVar('KERNEL_ALT_IMAGETYPE') or "")
+    types = ' '.join(sorted(types)).strip()
+    d.setVar('KERNEL_IMAGETYPES', types)
+
+    for type in types.split():
+        pn = d.getVar('PN')
+        imagedest = d.getVar('KERNEL_IMAGEDEST')
+        if type == "vmlinux":
+            typelower = type.lower()
+        else:
+            typelower = "image-%s" % type.lower()
+
+        d.appendVar('PACKAGES', ' %s-%s' % (pn, typelower))
+        if type != 'vmlinux' or 'vmlinux' in (d.getVar('KERNEL_IMAGETYPE') or ""):
+            d.appendVar('RDEPENDS_%s-image' % pn, ' %s-%s' % (pn, typelower))
+
+        d.setVar('FILES_%s-%s' % (pn, typelower), '/%s/%s-initramfs-${KERNEL_VERSION}' % (imagedest, type))
+        d.setVar('PKG_%s-%s' % ( pn, typelower), '%s-%s-${KERNEL_PKG_NAME}' % (pn, typelower))
+
+        priority = d.getVar('KERNEL_PRIORITY')
+        postinst = '#!/bin/sh\nupdate-alternatives --install /%s/%s-initramfs %s-initramfs %s-initramfs-${KERNEL_VERSION} %s || true\n' % (imagedest, type, type, type, priority)
+        d.setVar('pkg_postinst_%s-%s' % (pn, typelower), postinst)
+
+        postrm = '#!/bin/sh\nupdate-alternatives --remove %s-initramfs %s-initramfs-${KERNEL_VERSION} || true\n' % (type, type)
+        d.setVar('pkg_postrm_%s-%s' % (pn, typelower), postrm)
+}
+
+# Need the output of deploy.
+do_install[depends] += "virtual/kernel:do_deploy"
+
+# We only need the packaging tasks - disable the rest
+do_fetch[noexec] = "1"
+do_unpack[noexec] = "1"
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
+
+do_install() {
+	if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
+		echo "Copying initramfs bundled kernel images from ${DEPLOY_DIR_IMAGE}..."
+		install -d ${D}/${KERNEL_IMAGEDEST}
+		for type in ${KERNEL_IMAGETYPES}; do
+			echo "Copying initramfs bundled kernel image: $type-initramfs-${MACHINE}.bin"
+			install -m 0644 ${DEPLOY_DIR_IMAGE}/$type-initramfs-${MACHINE}.bin ${D}/${KERNEL_IMAGEDEST}/$type-initramfs-${KERNEL_VERSION}
+		done
+	fi
+}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/4] kernel-initramfs: add recipe
  2017-03-21 14:34 ` [PATCH 4/4] kernel-initramfs: add recipe liu.ming50
@ 2017-03-22  4:50   ` Ming Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Ming Liu @ 2017-03-22  4:50 UTC (permalink / raw)
  To: OE-core

[-- Attachment #1: Type: text/plain, Size: 6148 bytes --]

This patch needs to be adjusted, please ignore this patch set 3, will send
a V4 soon.

//Ming Liu

2017-03-21 15:34 GMT+01:00 <liu.ming50@gmail.com>:

> From: Ming Liu <peter.x.liu@external.atlascopco.com>
>
> To implement initramfs bundled kernel packaging.
>
> The kernel images are copied from DEPLOY_DIR_IMAGE, and a list of
> packages will be generated according to KERNEL_IMAGETYPES setting.
>
> For instance:
> For KERNEL_IMAGETYPES = "bzImage vmlinux"
>
> the generated packages would be:
> - kernel-initramfs (Base package, RDEPENDS on kernel-initramfs-image)
> - kernel-initramfs-image (Image package, RDEPENDS on all sub images)
> - kernel-initramfs-image-bzimage (Contains bzImage image)
> - kernel-initramfs-vmlinux (Contains vmlinux image)
>
> This recipe would be skipped if INITRAMFS_IMAGE_BUNDLE or
> INITRAMFS_IMAGE is not being set correctly.
>
> Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
> ---
>  meta/recipes-kernel/linux/kernel-initramfs.bb | 100
> ++++++++++++++++++++++++++
>  1 file changed, 100 insertions(+)
>  create mode 100644 meta/recipes-kernel/linux/kernel-initramfs.bb
>
> diff --git a/meta/recipes-kernel/linux/kernel-initramfs.bb
> b/meta/recipes-kernel/linux/kernel-initramfs.bb
> new file mode 100644
> index 0000000..91ea55e
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/kernel-initramfs.bb
> @@ -0,0 +1,100 @@
> +SUMMARY = "Initramfs bundled kernel images"
> +DESCRIPTION = "When built, it packages initramfs bundled kernel images of
> the \
> +preferred virtual/kernel provider."
> +SECTION = "kernel"
> +LICENSE = "GPLv2"
> +
> +inherit linux-kernel-base
> +
> +# Whilst not a module, this ensures we don't get multilib extended.
> (which would make no sense)
> +inherit module-base
> +
> +S = "${STAGING_KERNEL_DIR}"
> +B = "${WORKDIR}/build"
> +
> +# we dont need the default dependencies.
> +INHIBIT_DEFAULT_DEPS = "1"
> +
> +KERNEL_ALT_IMAGETYPE ??= ""
> +KERNEL_IMAGETYPES_append = " vmlinux"
> +KERNEL_IMAGETYPE ?= "zImage"
> +KERNEL_IMAGEDEST ?= "boot"
> +KERNEL_VERSION = "${@['1.0.0', get_kernelversion_file('${
> STAGING_KERNEL_BUILDDIR}')][get_kernelversion_file('${STAGING_KERNEL_BUILDDIR}')
> != None]}"
> +KERNEL_PKG_NAME = "${@legitimize_package_name(d.
> getVar('KERNEL_VERSION'))}"
> +KERNEL_PRIORITY ?= "${@int(d.getVar('KERNEL_
> VERSION').split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
> +                       int(d.getVar('KERNEL_VERSION')
> .split('-')[0].split('+')[0].split('.')[1]) * 100 + \
> +                       int(d.getVar('KERNEL_VERSION')
> .split('-')[0].split('+')[0].split('.')[-1])}"
> +
> +PACKAGES = "${PN} ${PN}-image"
> +
> +FILES_${PN} = ""
> +FILES_${PN}-image = ""
> +RDEPENDS_${PN} = "${PN}-image"
> +PKG_${PN} = "${PN}-${KERNEL_PKG_NAME}"
> +PKG_${PN}-image = "${PN}-image-${KERNEL_PKG_NAME}"
> +RPROVIDES_${PN} += "${PN}-${KERNEL_VERSION}"
> +ALLOW_EMPTY_${PN} = "1"
> +ALLOW_EMPTY_${PN}-image = "1"
> +
> +PACKAGE_ARCH = "${MACHINE_ARCH}"
> +
> +PACKAGES_DYNAMIC = "^kernel-initramfs-image-.*"
> +
> +python __anonymous () {
> +    # Skip processing of this recipe if INITRAMFS_IMAGE or
> INITRAMFS_IMAGE_BUNDLE
> +    # is not set correctly, to avoid generating only empty packages which
> makes
> +    # no sense.
> +    if not d.getVar('INITRAMFS_IMAGE') or d.getVar('INITRAMFS_IMAGE_BUNDLE')
> != '1':
> +        raise bb.parse.SkipPackage("Set INITRAMFS_IMAGE and
> INITRAMFS_IMAGE_BUNDLE to enable it")
> +
> +    # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into
> KERNEL_IMAGETYPES
> +    types = set((d.getVar('KERNEL_IMAGETYPES') or "").split())
> +    types.add(d.getVar('KERNEL_IMAGETYPE') or "")
> +    types.add(d.getVar('KERNEL_ALT_IMAGETYPE') or "")
> +    types = ' '.join(sorted(types)).strip()
> +    d.setVar('KERNEL_IMAGETYPES', types)
> +
> +    for type in types.split():
> +        pn = d.getVar('PN')
> +        imagedest = d.getVar('KERNEL_IMAGEDEST')
> +        if type == "vmlinux":
> +            typelower = type.lower()
> +        else:
> +            typelower = "image-%s" % type.lower()
> +
> +        d.appendVar('PACKAGES', ' %s-%s' % (pn, typelower))
> +        if type != 'vmlinux' or 'vmlinux' in
> (d.getVar('KERNEL_IMAGETYPE') or ""):
> +            d.appendVar('RDEPENDS_%s-image' % pn, ' %s-%s' % (pn,
> typelower))
> +
> +        d.setVar('FILES_%s-%s' % (pn, typelower),
> '/%s/%s-initramfs-${KERNEL_VERSION}' % (imagedest, type))
> +        d.setVar('PKG_%s-%s' % ( pn, typelower),
> '%s-%s-${KERNEL_PKG_NAME}' % (pn, typelower))
> +
> +        priority = d.getVar('KERNEL_PRIORITY')
> +        postinst = '#!/bin/sh\nupdate-alternatives --install
> /%s/%s-initramfs %s-initramfs %s-initramfs-${KERNEL_VERSION} %s || true\n'
> % (imagedest, type, type, type, priority)
> +        d.setVar('pkg_postinst_%s-%s' % (pn, typelower), postinst)
> +
> +        postrm = '#!/bin/sh\nupdate-alternatives --remove %s-initramfs
> %s-initramfs-${KERNEL_VERSION} || true\n' % (type, type)
> +        d.setVar('pkg_postrm_%s-%s' % (pn, typelower), postrm)
> +}
> +
> +# Need the output of deploy.
> +do_install[depends] += "virtual/kernel:do_deploy"
> +
> +# We only need the packaging tasks - disable the rest
> +do_fetch[noexec] = "1"
> +do_unpack[noexec] = "1"
> +do_patch[noexec] = "1"
> +do_configure[noexec] = "1"
> +do_compile[noexec] = "1"
> +do_populate_sysroot[noexec] = "1"
> +
> +do_install() {
> +       if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" =
> x1 ]; then
> +               echo "Copying initramfs bundled kernel images from
> ${DEPLOY_DIR_IMAGE}..."
> +               install -d ${D}/${KERNEL_IMAGEDEST}
> +               for type in ${KERNEL_IMAGETYPES}; do
> +                       echo "Copying initramfs bundled kernel image:
> $type-initramfs-${MACHINE}.bin"
> +                       install -m 0644 ${DEPLOY_DIR_IMAGE}/$type-initramfs-${MACHINE}.bin
> ${D}/${KERNEL_IMAGEDEST}/$type-initramfs-${KERNEL_VERSION}
> +               done
> +       fi
> +}
> --
> 2.7.4
>
>

[-- Attachment #2: Type: text/html, Size: 8321 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] [V3] Fix some issues of kernel/image recipes
  2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
                   ` (3 preceding siblings ...)
  2017-03-21 14:34 ` [PATCH 4/4] kernel-initramfs: add recipe liu.ming50
@ 2017-03-22 11:13 ` Burton, Ross
  4 siblings, 0 replies; 7+ messages in thread
From: Burton, Ross @ 2017-03-22 11:13 UTC (permalink / raw)
  To: Ming Liu; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On 21 March 2017 at 14:34, <liu.ming50@gmail.com> wrote:

>
> The changes in V3:
> 1 Drop one patch which is problematic.
> 2 Change a conditional checking line in kernel-initramfs.bb:
> From: "if type != 'vmlinux' or d.getVar('KERNEL_IMAGETYPE') == 'vmlinux':"
> To: "if type != 'vmlinux' or 'vmlinux' in (d.getVar('KERNEL_IMAGETYPE') or
> ""):"


To avoid confusion can you please ensure all the messages, not just the
cover letter, get the V3 prefix.  Git can do this for you with
--subject-prefix.

Ross

[-- Attachment #2: Type: text/html, Size: 1031 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-22 11:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 14:34 [PATCH 0/4] [V3] Fix some issues of kernel/image recipes liu.ming50
2017-03-21 14:34 ` [PATCH 1/4] kernel.bbclass: fix some incorrect inter-task dependencies liu.ming50
2017-03-21 14:34 ` [PATCH 2/4] kernel.bbclass: introduce INITRAMFS_IMAGE_NAME liu.ming50
2017-03-21 14:34 ` [PATCH 3/4] image.bbclass: remove initramfs bundle related code liu.ming50
2017-03-21 14:34 ` [PATCH 4/4] kernel-initramfs: add recipe liu.ming50
2017-03-22  4:50   ` Ming Liu
2017-03-22 11:13 ` [PATCH 0/4] [V3] Fix some issues of kernel/image recipes Burton, Ross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.