[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5448/8267] kernel.bbclass: introduce INITRAMFS_IMAGE_NAME



commit c09a0631b5b9d9d2a271771918fb003f5a9700f6
Author: Ming Liu <peter x liu external atlascopco com>
Date:   Thu Mar 30 09:59:58 2017 +0200

    kernel.bbclass: introduce INITRAMFS_IMAGE_NAME
    
    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.
    
    (From OE-Core rev: e788fb2b894852f71b1c545abde71b45b9f230dc)
    
    Signed-off-by: Ming Liu <peter x liu external atlascopco com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 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 8ae2eb6..2630b47 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -370,7 +370,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}"
@@ -459,11 +459,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 91c260a..b7f5fce 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]