]> code.ossystems Code Review - openembedded-core.git/commitdiff
classes/kernel-fitimage: make fitimage_emit_section_config more readable
authorEaswar Hariharan <eahariha@microsoft.com>
Thu, 17 Dec 2020 02:51:36 +0000 (18:51 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 Dec 2020 00:03:01 +0000 (00:03 +0000)
fitimage_emit_section_config() has a number of arguments, add named
variables to make the function a bit more readable.

Signed-off-by: Easwar Hariharan <eahariha@microsoft.com>
Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/kernel-fitimage.bbclass

index f121eee274a53ead0959fdc44e53bb31f9cbecb4..f3d18e22cf7b21cec20fe97b51e04b100d49f598 100644 (file)
@@ -273,6 +273,13 @@ fitimage_emit_section_config() {
                conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
        fi
 
+       its_file="${1}"
+       kernel_id="${2}"
+       dtb_image="${3}"
+       ramdisk_id="${4}"
+       config_id="${5}"
+       default_flag="${6}"
+
        # Test if we have any DTBs at all
        sep=""
        conf_desc=""
@@ -285,49 +292,49 @@ fitimage_emit_section_config() {
 
        # conf node name is selected based on dtb ID if it is present,
        # otherwise its selected based on kernel ID
-       if [ -n "${3}" ]; then
-               conf_node=$conf_node${3}
+       if [ -n "${dtb_image}" ]; then
+               conf_node=$conf_node${dtb_image}
        else
-               conf_node=$conf_node${2}
+               conf_node=$conf_node${kernel_id}
        fi
 
-       if [ -n "${2}" ]; then
+       if [ -n "${kernel_id}" ]; then
                conf_desc="Linux kernel"
                sep=", "
-               kernel_line="kernel = \"kernel@${2}\";"
+               kernel_line="kernel = \"kernel@${kernel_id}\";"
        fi
 
-       if [ -n "${3}" ]; then
+       if [ -n "${dtb_image}" ]; then
                conf_desc="${conf_desc}${sep}FDT blob"
                sep=", "
-               fdt_line="fdt = \"fdt@${3}\";"
+               fdt_line="fdt = \"fdt@${dtb_image}\";"
        fi
 
-       if [ -n "${4}" ]; then
+       if [ -n "${ramdisk_id}" ]; then
                conf_desc="${conf_desc}${sep}ramdisk"
                sep=", "
-               ramdisk_line="ramdisk = \"ramdisk@${4}\";"
+               ramdisk_line="ramdisk = \"ramdisk@${ramdisk_id}\";"
        fi
 
-       if [ -n "${5}" ]; then
+       if [ -n "${config_id}" ]; then
                conf_desc="${conf_desc}${sep}setup"
-               setup_line="setup = \"setup@${5}\";"
+               setup_line="setup = \"setup@${config_id}\";"
        fi
 
-       if [ "${6}" = "1" ]; then
+       if [ "${default_flag}" = "1" ]; then
                # default node is selected based on dtb ID if it is present,
                # otherwise its selected based on kernel ID
-               if [ -n "${3}" ]; then
-                       default_line="default = \"conf@${3}\";"
+               if [ -n "${dtb_image}" ]; then
+                       default_line="default = \"conf@${dtb_image}\";"
                else
-                       default_line="default = \"conf@${2}\";"
+                       default_line="default = \"conf@${kernel_id}\";"
                fi
        fi
 
-       cat << EOF >> ${1}
+       cat << EOF >> ${its_file}
                 ${default_line}
                 $conf_node {
-                       description = "${6} ${conf_desc}";
+                       description = "${default_flag} ${conf_desc}";
                        ${kernel_line}
                        ${fdt_line}
                        ${ramdisk_line}
@@ -342,28 +349,28 @@ EOF
                sign_line="sign-images = "
                sep=""
 
-               if [ -n "${2}" ]; then
+               if [ -n "${kernel_id}" ]; then
                        sign_line="${sign_line}${sep}\"kernel\""
                        sep=", "
                fi
 
-               if [ -n "${3}" ]; then
+               if [ -n "${dtb_image}" ]; then
                        sign_line="${sign_line}${sep}\"fdt\""
                        sep=", "
                fi
 
-               if [ -n "${4}" ]; then
+               if [ -n "${ramdisk_id}" ]; then
                        sign_line="${sign_line}${sep}\"ramdisk\""
                        sep=", "
                fi
 
-               if [ -n "${5}" ]; then
+               if [ -n "${config_id}" ]; then
                        sign_line="${sign_line}${sep}\"setup\""
                fi
 
                sign_line="${sign_line};"
 
-               cat << EOF >> ${1}
+               cat << EOF >> ${its_file}
                         signature@1 {
                                 algo = "${conf_csum},${conf_sign_algo}";
                                 key-name-hint = "${conf_sign_keyname}";
@@ -372,7 +379,7 @@ EOF
 EOF
        fi
 
-       cat << EOF >> ${1}
+       cat << EOF >> ${its_file}
                 };
 EOF
 }