Patchwork [2/2] code cleanup for INITRD variable handing

login
register
mail settings
Submitter Nitin A Kamble
Date Aug. 5, 2014, 9:39 p.m.
Message ID <e02335b6134805d1806b77cba830c134231bd925.1407274547.git.nitin.a.kamble@intel.com>
Download mbox | patch
Permalink /patch/77335/
State Accepted
Commit bfa36a21885acba472c27358270cbffeb282d1dd
Headers show

Comments

Nitin A Kamble - Aug. 5, 2014, 9:39 p.m.
From: Nitin A Kamble <nitin.a.kamble@intel.com>

* Remove an unnecessary check
* Instead of ignoring, report the errors

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
---
 meta/classes/boot-directdisk.bbclass | 4 +++-
 meta/classes/bootimg.bbclass         | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
Darren Hart - Aug. 5, 2014, 10:35 p.m.
On 8/5/14, 14:39, "Kamble, Nitin A" <nitin.a.kamble@intel.com> wrote:

>From: Nitin A Kamble <nitin.a.kamble@intel.com>
>
>* Remove an unnecessary check
>* Instead of ignoring, report the errors

This isn't enough to ask for a resend, but please be a bit more explicit
in what is going on in future commit messages, for example:

INITRD: Cleanup file tests and report errors

The null string test (-n) is no longer necessary as it is inherent in the
for loop.

If the INITRD file element is missing or of zero size, abort with bbfatal.

>
>Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>

Reviewed-by: Darren Hart <dvhart@linux.intel.com>


>---
> meta/classes/boot-directdisk.bbclass | 4 +++-
> meta/classes/bootimg.bbclass         | 2 ++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/meta/classes/boot-directdisk.bbclass
>b/meta/classes/boot-directdisk.bbclass
>index 995d3e7..5107d7f 100644
>--- a/meta/classes/boot-directdisk.bbclass
>+++ b/meta/classes/boot-directdisk.bbclass
>@@ -76,8 +76,10 @@ boot_direct_populate() {
> 		rm -f $dest/initrd
> 		for fs in ${INITRD}
> 		do
>-			if [ -n "${fs}" ] && [ -s "${fs}" ]; then
>+			if [ -s "${fs}" ]; then
> 				cat ${fs} >> $dest/initrd
>+			else
>+				bbfatal "${fs} is invalid. initrd image creation failed."
> 			fi
> 		done
> 		chmod 0644 $dest/initrd
>diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
>index 7b3ce65..859d517 100644
>--- a/meta/classes/bootimg.bbclass
>+++ b/meta/classes/bootimg.bbclass
>@@ -75,6 +75,8 @@ populate() {
> 		do
> 			if [ -s "${fs}" ]; then
> 				cat ${fs} >> ${DEST}/initrd
>+			else
>+				bbfatal "${fs} is invalid. initrd image creation failed."
> 			fi
> 		done
> 		chmod 0644 ${DEST}/initrd
>-- 
>1.8.1.4
>
>

Patch

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 995d3e7..5107d7f 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -76,8 +76,10 @@  boot_direct_populate() {
 		rm -f $dest/initrd
 		for fs in ${INITRD}
 		do
-			if [ -n "${fs}" ] && [ -s "${fs}" ]; then
+			if [ -s "${fs}" ]; then
 				cat ${fs} >> $dest/initrd
+			else
+				bbfatal "${fs} is invalid. initrd image creation failed."
 			fi
 		done
 		chmod 0644 $dest/initrd
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index 7b3ce65..859d517 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -75,6 +75,8 @@  populate() {
 		do
 			if [ -s "${fs}" ]; then
 				cat ${fs} >> ${DEST}/initrd
+			else
+				bbfatal "${fs} is invalid. initrd image creation failed."
 			fi
 		done
 		chmod 0644 ${DEST}/initrd