public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Paul Eggleton" <paul.eggleton@linux.microsoft.com>
To: openembedded-core@lists.openembedded.org
Cc: Usama Arif <usama.arif@arm.com>
Subject: [PATCH 2/8] classes/kernel-fitimage: make fitimage_emit_section_config more readable
Date: Wed, 16 Dec 2020 18:51:36 -0800	[thread overview]
Message-ID: <b04aaf22ed12c9a61ce6323446f332c2fd2386fc.1608173226.git.paul.eggleton@linux.microsoft.com> (raw)
In-Reply-To: <cover.1608173226.git.paul.eggleton@linux.microsoft.com>

From: Easwar Hariharan <eahariha@microsoft.com>

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>
---
 meta/classes/kernel-fitimage.bbclass | 53 ++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index f121eee..f3d18e2 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -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
 }
-- 
1.8.3.1


  parent reply	other threads:[~2020-12-17  2:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17  2:51 [PATCH 0/8] kernel-fitimage extensions Paul Eggleton
2020-12-17  2:51 ` [PATCH 1/8] classes/kernel-fitimage: add variable for description Paul Eggleton
2020-12-17  2:51 ` Paul Eggleton [this message]
2020-12-17  2:51 ` [PATCH 3/8] classes/kernel-fitimage: allow substituting mkimage command Paul Eggleton
2020-12-17  2:51 ` [PATCH 4/8] classes/kernel-fitimage: add ability to add additional signing options Paul Eggleton
2020-12-17  2:51 ` [PATCH 5/8] classes/kernel-fitimage: add ability to sign individual images Paul Eggleton
2020-12-17  2:51 ` [PATCH 6/8] oe-selftest: move FIT image tests to their own module Paul Eggleton
2020-12-17  2:51 ` [PATCH 7/8] oe-selftest: fitimage: Test for FIT_DESC Paul Eggleton
2020-12-17  2:51 ` [PATCH 8/8] oe-selftest: fitimage: add test for signing FIT images Paul Eggleton
2021-01-01 13:33 ` [PATCH 0/8] kernel-fitimage extensions Usama Arif

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b04aaf22ed12c9a61ce6323446f332c2fd2386fc.1608173226.git.paul.eggleton@linux.microsoft.com \
    --to=paul.eggleton@linux.microsoft.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=usama.arif@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox