]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel.bbclass: introduce INITRAMFS_IMAGE_NAME
authorMing Liu <peter.x.liu@external.atlascopco.com>
Thu, 30 Mar 2017 07:59:58 +0000 (09:59 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 31 Mar 2017 11:29:03 +0000 (12:29 +0100)
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>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/kernel-fitimage.bbclass
meta/classes/kernel.bbclass

index 8ae2eb6df570de004c19a6283ca2b8486a193a69..2630b473168ef029334235e06c546b130d26053d 100644 (file)
@@ -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
 
index 91c260a1b9e76ca9e02a59f74fc805893fc18fd2..b7f5fce360d932693f709db976bb01b9483e3933 100644 (file)
@@ -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