classes/kernel-fitimage: make fitimage_emit_section_config more readable

fitimage_emit_section_config() has a number of arguments, add named
variables to make the function a bit more readable.

(From OE-Core rev: a82340eed3165825c129c1f2b1ebf250e0e699c2)

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>
This commit is contained in:
Easwar Hariharan
2020-12-16 18:51:36 -08:00
committed by Richard Purdie
parent be137b8958
commit 77c3e43fc6

View File

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