All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable
@ 2016-06-30 23:50 OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash OpenBMC Patches
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

The underlying storage for a file system can not be updated when it is in use.  The initial solution was to update the flash as the system was being shutdown, with output to the console.

Updates were made to the `init` script that allows the flash to not be used for a given boot but the `update` script was not updated for error handling, and no documentation was provided to prepare the system for this mode.

When combined with openbmc/skeleton#111 this series is intended to address #293 by providing for the flash to be written while running the full stack after a `PrepareForFlash` mode has been initiated.

This also has fixes for saving files fixing #378.

These are the changes in #297 applied to the v1.0-stable branch.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/openbmc/451)
<!-- Reviewable:end -->


https://github.com/openbmc/openbmc/pull/451

Milton Miller (16):
  image_types_uboot: Don't truncate when assembling flash
  initfs: Fix recipe, remove unnecessary class
  initfs: shutdown: comment on update success
  initfs: update: Don't exec sh or sulogin on error just exit 1
  initfs: update: Do not cause an error if no files were saved
  initfs: update: Consistently add ERROR: and print to stderr
  initfs: update: add option to perform checks but skip actual update
  initfs: update: check individual mtd partitions for mounts
  initfs: update: add check for image size vs mtd size
  initfs: update: add --help message
  initfs: init: add file for base options
  image-types_uboot: Package a self contained netboot image
  initfs: update: handle no images to update
  initfs: update: Sanitize whitelist directory entries
  initfs: whitelist: Sanitize obmc events whitelist entry
  initfs: Store whiltelist in a directory of files

 .../obmc-phosphor-image_types_uboot.bbclass        |  20 ++-
 meta-phosphor/classes/obmc-phosphor-initfs.bbclass |   4 -
 .../obmc-phosphor-initfs/files/obmc-init.sh        |  12 +-
 .../obmc-phosphor-initfs/files/obmc-shutdown.sh    |   8 +
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 165 ++++++++++++++++-----
 .../obmc-phosphor-initfs/files/whitelist           |   2 +-
 ...mc-phosphor-init.bb => obmc-phosphor-initfs.bb} |   6 +-
 7 files changed, 166 insertions(+), 51 deletions(-)
 delete mode 100644 meta-phosphor/classes/obmc-phosphor-initfs.bbclass
 rename meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/{obmc-phosphor-init.bb => obmc-phosphor-initfs.bb} (81%)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 02/16] initfs: Fix recipe, remove unnecessary class OpenBMC Patches
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

The generate_flash_image step was creating a file then using dd to
fill in the pieces, but missed adding the conv=notrunc flag, so each
step was shortening the file to its output.

Add the forgotten conversion flag to each dd command.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
index adb86e0..67a389f 100644
--- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
@@ -76,11 +76,11 @@ do_generate_flash() {
        dst="${ddir}/${FLASH_IMAGE_NAME}"
        rm -rf $dst
        mk_nor_image ${dst} ${FLASH_SIZE}
-       dd if=${ddir}/${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
-       dd if=${ddir}/${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
-       dd if=${ddir}/${uinitrd} of=${dst} bs=1k seek=${FLASH_INITRD_OFFSET}
-       dd if=${ddir}/${rootfs} of=${dst} bs=1k seek=${FLASH_ROFS_OFFSET}
-       dd if=${ddir}/${rwfs} of=${dst} bs=1k seek=${FLASH_RWFS_OFFSET}
+       dd if=${ddir}/${uboot} of=${dst} bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET}
+       dd if=${ddir}/${kernel} of=${dst} bs=1k conv=notrunc seek=${FLASH_KERNEL_OFFSET}
+       dd if=${ddir}/${uinitrd} of=${dst} bs=1k conv=notrunc seek=${FLASH_INITRD_OFFSET}
+       dd if=${ddir}/${rootfs} of=${dst} bs=1k conv=notrunc seek=${FLASH_ROFS_OFFSET}
+       dd if=${ddir}/${rwfs} of=${dst} bs=1k conv=notrunc seek=${FLASH_RWFS_OFFSET}
        dstlink="${ddir}/${FLASH_IMAGE_LINK}"
        rm -rf $dstlink
        ln -sf ${FLASH_IMAGE_NAME} $dstlink
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 02/16] initfs: Fix recipe, remove unnecessary class
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 03/16] initfs: shutdown: comment on update success OpenBMC Patches
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Because the recipe was named with trailing part init instead
of initfs, the package didn't match the package name requiring
PROVIDES, RPROVIDES and other bitbake workarounds.  Fix the recipe
name to match the package removing the overly verbose packaging.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 meta-phosphor/classes/obmc-phosphor-initfs.bbclass                    | 4 ----
 .../{obmc-phosphor-init.bb => obmc-phosphor-initfs.bb}                | 1 -
 2 files changed, 5 deletions(-)
 delete mode 100644 meta-phosphor/classes/obmc-phosphor-initfs.bbclass
 rename meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/{obmc-phosphor-init.bb => obmc-phosphor-initfs.bb} (96%)

diff --git a/meta-phosphor/classes/obmc-phosphor-initfs.bbclass b/meta-phosphor/classes/obmc-phosphor-initfs.bbclass
deleted file mode 100644
index de7923e..0000000
--- a/meta-phosphor/classes/obmc-phosphor-initfs.bbclass
+++ /dev/null
@@ -1,4 +0,0 @@
-# Common code for recipes that implement Phosphor OpenBMC filesystem
-
-RPROVIDES_${PN} += "obmc-phosphor-initfs"
-PROVIDES += "obmc-phosphor-initfs"
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
similarity index 96%
rename from meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
rename to meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
index 3fa88c9..f81e21d 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
@@ -3,7 +3,6 @@ DESCRIPTION = "Phosphor OpenBMC filesytem mount reference implementation."
 PR = "r1"
 
 inherit obmc-phosphor-license
-inherit obmc-phosphor-initfs
 
 S = "${WORKDIR}"
 SRC_URI += "file://obmc-init.sh"
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 03/16] initfs: shutdown: comment on update success
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 02/16] initfs: Fix recipe, remove unnecessary class OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1 OpenBMC Patches
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Print an error from the shutdown script when the update fails.

Update is changing to return codes when its preconditions are not
met, so be more verbose about its success to provide a means to
debug flash updates not occurring.

We could add a sulogin or sushell but its not clear what would be
desired here.  If so the message should include "rmdir /oldroot
to get a PID 1 shell" like /takever works in init.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
index 8d5d0c9..8d5c672 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
@@ -44,6 +44,14 @@ then
 	if test -x $update
 	then
 		$update --clean-saved-files
+		remaining=$(ls $image*)
+		if test -n "$remaining"
+		then
+			echo 1>&2 "Flash update failed to flash these images:"
+			echo 1>&2 "$remaining"
+		else
+			echo "Flash update completed."
+		fi
 	else
 		echo 1>&2 "Flash update requested but $update program missing!"
 	fi
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (2 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 03/16] initfs: shutdown: comment on update success OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 05/16] initfs: update: Do not cause an error if no files were saved OpenBMC Patches
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

When update was written it was exec'd from the shutdown script
and hence took over pid 1.  Since exiting in that environment was
a panic situation, the script instead started a rescue shell with
its output presumably on the console.

The calling convention was updated to be a simple invocation in
commit dbacf104885c ("obmc-initfs: run update as a sub-script")
but the error handling was not updated.  That error handling is
now becoming a hindrance to use from additional environments so
change it.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index aa8fd89..f8e551c 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -2,9 +2,6 @@
 
 echo update: "$@"
 
-export PS1=update-sh#\ 
-# exec /bin/sh
-
 cd /
 if ! test -r /proc/mounts || ! test -f /proc/mounts
 then
@@ -21,12 +18,12 @@ then
 	mkdir -p /dev
 	mount -t devtmpfs dev dev
 fi
-while grep mtd /proc/mounts
-do
+
+if grep mtd /proc/mounts
+then
 	echo 1>&2 "Error: A mtd device is mounted."
-	sulogin
-	# exec /bin/sh
-done
+	exit 1
+fi
 
 findmtd() {
 	m=$(grep -xl "$1" /sys/class/mtd/*/name)
@@ -130,7 +127,7 @@ do
 	if test -z "$m"
 	then
 		echo 1>&2  "Unable to find mtd partiton for ${f##*/}."
-		exec /bin/sh
+		exit 1
 	fi
 done
 
@@ -173,11 +170,3 @@ then
 fi
 
 exit
-
-# NOT REACHED without edit
-# NOT REACHED without edit
-
-echo "Flash completed.  Inspect, cleanup and reboot -f to continue."
-
-export PS1=update-sh#\ 
-exec /bin/sh
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 05/16] initfs: update: Do not cause an error if no files were saved
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (3 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1 OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 06/16] initfs: update: Consistently add ERROR: and print to stderr OpenBMC Patches
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

If there were no files in the read-write overlay file system that
were in the persistent file list, then the save directory will
not be created and therefore not exist.  Skip attempting copying
the non-existent directory in that case to avoid the error message.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index f8e551c..f0ca989 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -144,7 +144,7 @@ do
 	flashcp -v $f /dev/$m && rm $f
 done
 
-if test "x$toram" = xy
+if test -d $save -a "x$toram" = xy
 then
 	mkdir -p $upper
 	cp -rp $save/. $upper/
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 06/16] initfs: update: Consistently add ERROR: and print to stderr
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (4 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 05/16] initfs: update: Do not cause an error if no files were saved OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 07/16] initfs: update: add option to perform checks but skip actual update OpenBMC Patches
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Make sure all error messages start with the tag ERROR and its
printed to stderr by creating an echoerr function.

Previously one case had the file descriptors backwards in the
redirection.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index f0ca989..e51dbf8 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -2,6 +2,10 @@
 
 echo update: "$@"
 
+echoerr() {
+	echo 1>&2 "ERROR: $@"
+}
+
 cd /
 if ! test -r /proc/mounts || ! test -f /proc/mounts
 then
@@ -21,7 +25,7 @@ fi
 
 if grep mtd /proc/mounts
 then
-	echo 1>&2 "Error: A mtd device is mounted."
+	echoerr "A mtd device is mounted."
 	exit 1
 fi
 
@@ -90,7 +94,7 @@ do
 		toram=y
 		shift ;;
 	*)
-		echo 2>&1 "Unknown option $1"
+		echoerr "Unknown option $1"
 		exit 1 ;;
 	esac
 done
@@ -126,7 +130,7 @@ do
 	m=$(findmtd ${f#$image})
 	if test -z "$m"
 	then
-		echo 1>&2  "Unable to find mtd partiton for ${f##*/}."
+		echoerr "Unable to find mtd partiton for ${f##*/}."
 		exit 1
 	fi
 done
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 07/16] initfs: update: add option to perform checks but skip actual update
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (5 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 06/16] initfs: update: Consistently add ERROR: and print to stderr OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 08/16] initfs: update: check individual mtd partitions for mounts OpenBMC Patches
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Provide a way to check if update is likely to succeed without
attempting actual updates.

This will check the image names correspond to mtd partition names,
and will be enhanced with additional checking for file size and
individual partition mounts.

This is not called --dry-run because it will still do file save
and restore if those are enabled.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 31 +++++++++++++---------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index e51dbf8..9f5bede 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -61,6 +61,7 @@ upper=$rwdir/cow
 save=/run/save/${upper##*/}
 
 mounted=
+doflash=y
 doclean=
 dosave=y
 dorestore=y
@@ -90,6 +91,9 @@ do
 	--restore-files)
 		dorestore=y
 		shift ;;
+	--no-flash)
+		doflash=
+		shift ;;
 	--copy-files)
 		toram=y
 		shift ;;
@@ -135,18 +139,21 @@ do
 	fi
 done
 
-for f in $image*
-do
-	if test ! -s $f
-	then
-		echo "Skipping empty update of ${f#$image}."
-		rm $f
-		continue
-	fi
-	m=$(findmtd ${f#$image})
-	echo "Updating ${f#$image}..."
-	flashcp -v $f /dev/$m && rm $f
-done
+if test -n "$doflash"
+then
+	for f in $image*
+	do
+		if test ! -s $f
+		then
+			echo "Skipping empty update of ${f#$image}."
+			rm $f
+			continue
+		fi
+		m=$(findmtd ${f#$image})
+		echo "Updating ${f#$image}..."
+		flashcp -v $f /dev/$m && rm $f
+	done
+fi
 
 if test -d $save -a "x$toram" = xy
 then
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 08/16] initfs: update: check individual mtd partitions for mounts
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (6 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 07/16] initfs: update: add option to perform checks but skip actual update OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 09/16] initfs: update: add check for image size vs mtd size OpenBMC Patches
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Instead of checking for any mtd device, only check mtd devices
that are to be updated.  Include child mtd devices when looking
for mounted filesystems.

If this check is suppressed flash updates are suppressed.
Suppressing the check may be useful to verify a update could
succeed at shutdown.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 46 +++++++++++++++++++---
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index 9f5bede..9d3c812 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -23,11 +23,34 @@ then
 	mount -t devtmpfs dev dev
 fi
 
-if grep mtd /proc/mounts
-then
-	echoerr "A mtd device is mounted."
-	exit 1
-fi
+# mtd number N with mtd name Name can be mounted via mtdN, or mtd:Name
+# (with a mtd aware fs) or by /dev/mtdblockN (with a mtd or block fs).
+mtdismounted() {
+	m=${1##mtd}
+	if grep -s "mtdblock$m " /proc/mounts || grep -s "mtd$m " /proc/mounts
+	then
+		return 0
+	fi
+	n=$(cat /sys/class/mtd/mtd$m/name)
+	if test -n "$n" && grep -s "mtd:$n " /proc/mounts
+	then
+		return 0
+	fi
+	return 1
+}
+
+# Detect child partitions when the whole flash is to be updated.
+# Ignore mtdNro and mtdblockN names in the class subsystem directory.
+childmtds() {
+	for m in /sys/class/mtd/$1/mtd*
+	do
+		m=${m##*/}
+		if test "${m%ro}" = "${m#mtdblock}"
+		then
+			echo $m
+		fi
+	done
+}
 
 findmtd() {
 	m=$(grep -xl "$1" /sys/class/mtd/*/name)
@@ -66,6 +89,7 @@ doclean=
 dosave=y
 dorestore=y
 toram=
+checkmount=y
 
 whitelist=/run/initramfs/whitelist
 image=/run/initramfs/image-
@@ -94,6 +118,10 @@ do
 	--no-flash)
 		doflash=
 		shift ;;
+	--ignore-mount)
+		checkmount=
+		doflash=
+		shift ;;
 	--copy-files)
 		toram=y
 		shift ;;
@@ -137,6 +165,14 @@ do
 		echoerr "Unable to find mtd partiton for ${f##*/}."
 		exit 1
 	fi
+	for s in $m $(childmtds $m)
+	do
+		if test -n "$checkmount" && mtdismounted $s
+		then
+			echoerr "Device $s is mounted, ${f##*/} is busy."
+			exit 1
+		fi
+	done
 done
 
 if test -n "$doflash"
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 09/16] initfs: update: add check for image size vs mtd size
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (7 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 08/16] initfs: update: check individual mtd partitions for mounts OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 10/16] initfs: update: add --help message OpenBMC Patches
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

The flashcp command will check the file size vs the partition size,
so add a check when looking at images.

Use stat -L -c "%s" to get the file size, and compare it to the mtd
size from the sysfs size attribute.

If this check is suppressed the enforcement is left to flashcp.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index 9d3c812..fa46635 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -52,6 +52,14 @@ childmtds() {
 	done
 }
 
+toobig() {
+	if test $(stat -L -c "%s" "$1") -gt $(cat /sys/class/mtd/"$2"/size)
+	then
+		return 0
+	fi
+	return 1
+}
+
 findmtd() {
 	m=$(grep -xl "$1" /sys/class/mtd/*/name)
 	m=${m%/name}
@@ -89,6 +97,7 @@ doclean=
 dosave=y
 dorestore=y
 toram=
+checksize=y
 checkmount=y
 
 whitelist=/run/initramfs/whitelist
@@ -118,6 +127,9 @@ do
 	--no-flash)
 		doflash=
 		shift ;;
+	--ignore-size)
+		checksize=
+		shift ;;
 	--ignore-mount)
 		checkmount=
 		doflash=
@@ -165,6 +177,11 @@ do
 		echoerr "Unable to find mtd partiton for ${f##*/}."
 		exit 1
 	fi
+	if test -n "$checksize" && toobig "$f" "$m"
+	then
+		echoerr "Image ${f##*/} too big for $m."
+		exit 1
+	fi
 	for s in $m $(childmtds $m)
 	do
 		if test -n "$checkmount" && mtdismounted $s
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 10/16] initfs: update: add --help message
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (8 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 09/16] initfs: update: add check for image size vs mtd size OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 11/16] initfs: init: add file for base options OpenBMC Patches
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Now that update is intended for use at runtime and not just by
the init and shutdown scripts, add a short help message listing
the options so people don't have to understand how to read shell.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh        | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index fa46635..268c6ad 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -106,6 +106,24 @@ image=/run/initramfs/image-
 while test "$1" != "${1#-}"
 do
 	case "$1" in
+	--help)
+		cat <<HERE
+Usage: $0 [options] -- Write images in /run/initramfs to flash (/dev/mtd*)
+    --help                    Show this message
+    --no-flash                Don't attempt to write images to flash
+    --ignore-size             Don't compare image size to mtd device size
+    --ignore-mount            Don't check if destination is mounted
+    --save-files              Copy whitelisted files to save directory in RAM
+    --no-save-files           Don't copy whitelisted files to save directory
+    --copy-files              Copy files from save directory to rwfs mountpoint
+    --restore-files           Restore files from save directory to rwfs layer
+    --no-restore-files        Don't restore saved files from ram to rwfs layer
+    --clean-saved-files       Delete saved whitelisted files from RAM
+    --no-clean-saved-files    Retain saved whitelisted files in RAM
+HERE
+
+	    exit 0 ;;
+
 	--no-clean-saved-files)
 		doclean=
 		shift ;;
@@ -138,7 +156,7 @@ do
 		toram=y
 		shift ;;
 	*)
-		echoerr "Unknown option $1"
+		echoerr "Unknown option $1.  Try $0 --help."
 		exit 1 ;;
 	esac
 done
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 11/16] initfs: init: add file for base options
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (9 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 10/16] initfs: update: add --help message OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 12/16] image-types_uboot: Package a self contained netboot image OpenBMC Patches
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Allow an initrd image to include options for init while still allowing
additional options to come from the kernel command line and/or u-boot
environment variables.

This will allow building a netboot image that can specify to run
from RAM while allowing the command line to initiate debug or skip
copying files from the read-write overlay file system.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index c37b3d5..70af93d 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -184,6 +184,7 @@ fsckbase=/sbin/fsck.
 fsck=$fsckbase$rwfst
 fsckopts=-a
 optfile=/run/initramfs/init-options
+optbase=/run/initramfs/init-options-base
 urlfile=/run/initramfs/init-download-url
 update=/run/initramfs/update
 
@@ -192,9 +193,16 @@ then
 	cp /${optfile##*/} $optfile
 fi
 
+if test -e /${optbase##*/}
+then
+	cp /${optbase##*/} $optbase
+else
+	touch $optbase
+fi
+
 if test ! -f $optfile
 then
-	cat /proc/cmdline > $optfile
+	cat /proc/cmdline $optbase > $optfile
 	get_fw_env_var openbmcinit >> $optfile
 	get_fw_env_var openbmconce >> $optfile
 fi
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 12/16] image-types_uboot: Package a self contained netboot image
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (10 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 11/16] initfs: init: add file for base options OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 13/16] initfs: update: handle no images to update OpenBMC Patches
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Create a cpio containing the base read-only image, and create a
single combined initramfs image consisting of the image-rofs
and the existing initramfs.

There has been a desire to have a self contained netboot image present
for developer testing and experimentation.   The init script already
supports having the rofs layer sourced from a file packaged into the
initramfs, and will use it if found.

While this image will not fit in the current flash layout in
the initrd space, it will load over the network.  This method
leaves the squashfs compressed in RAM, decompreses is invoked as
needed at runtime, trading boot time and memory space for runtime
decompress on demand.  This will also give similar file access
overheads and performance to reading the data from flash.

Because the rofs is already compressed with xz compression,
don't try to compress this cpio (the cpio packaging adds about 40
bytes of ascii before and after, plus some alignment padding).
Because the kernel requires uncompressed cpios to appear on a
4-byte boundary with 0 byte fill between archives, place this
cpio first in the combined image.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
index 67a389f..dd990bc 100644
--- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
@@ -51,6 +51,8 @@ do_generate_flash() {
        uinitrd="${initrd}.u-boot"
        rootfs="${IMAGE_LINK_NAME}.${IMAGE_BASETYPE}"
        rwfs="rwfs.${OVERLAY_BASETYPE}"
+       rofsimg=rofs.${IMAGE_BASETYPE}.cpio
+       netimg=initramfs-netboot.cpio
 
        if [ ! -f $ddir/$kernel ]; then
               bbfatal "Kernel file ${ddir}/${kernel} does not exist"
@@ -94,4 +96,12 @@ do_generate_flash() {
 
        tar -h -cvf ${ddir}/${MACHINE}-${DATETIME}.all.tar -C ${ddir} image-bmc
        tar -h -cvf ${ddir}/${MACHINE}-${DATETIME}.tar -C ${ddir} image-u-boot image-kernel image-initramfs image-rofs image-rwfs
+
+       # Package the root image (rofs layer) with the initramfs for net booting.
+       # Uses the symlink above to get the desired name in the cpio
+       ( cd $ddir && echo image-rofs | cpio -oHnewc -L > ${rofsimg} )
+       # Prepend the rofs cpio -- being uncompressed it must be 4-byte aligned
+       cat ${ddir}/${rofsimg} ${ddir}/${initrd} > ${ddir}/${netimg}
+       oe_mkimage  "${netimg}" "${INITRD_CTYPE}"
+
 }
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 13/16] initfs: update: handle no images to update
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (11 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 12/16] image-types_uboot: Package a self contained netboot image OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 14/16] initfs: update: Sanitize whitelist directory entries OpenBMC Patches
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Notify the user if image wildcard expansion fails instead of printing
message about failing to find partition to flash.

The update script errors with the message that it can't figure out what
partition to flash for /run/initramfs/image-* if there are no images
pending.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh               | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index 268c6ad..97d4402 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -102,6 +102,7 @@ checkmount=y
 
 whitelist=/run/initramfs/whitelist
 image=/run/initramfs/image-
+imglist=
 
 while test "$1" != "${1#-}"
 do
@@ -187,7 +188,15 @@ then
 	fi
 fi
 
-for f in $image*
+imglist=$(echo $image*)
+if test "$imglist" = "$image*" -a ! -e "$imglist"
+then
+	# shell didn't expand the wildcard, so no files exist
+	echo "No images found to update."
+	imglist=
+fi
+
+for f in $imglist
 do
 	m=$(findmtd ${f#$image})
 	if test -z "$m"
@@ -212,7 +221,7 @@ done
 
 if test -n "$doflash"
 then
-	for f in $image*
+	for f in $imglist
 	do
 		if test ! -s $f
 		then
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 14/16] initfs: update: Sanitize whitelist directory entries
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (12 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 13/16] initfs: update: handle no images to update OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 15/16] initfs: whitelist: Sanitize obmc events whitelist entry OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 16/16] initfs: Store whiltelist in a directory of files OpenBMC Patches
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Repeatedly strip trailing "/" and "/." from whitelist entries
and fail if an entry includes "/../", ends with "/..", or doesn't
start with a "/".  Also use the entries quoted to avoid any glob.

It was noticed the save code was saving directories that ended
in "/" into a subdirectory of the last component name.  This was
traced the the code creating the directory just stripping the last
"/" and then copying to the directory.

Choose to sanitize the entry where possible for ease of use verses
a small performance penalty.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../obmc-phosphor-initfs/files/obmc-update.sh             | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index 97d4402..f0c41a7 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -173,13 +173,24 @@ then
 
 	while read f
 	do
-		if ! test -e $upper/$f
+		# Entries shall start with /, no trailing /.. or embedded /../
+		if test "/${f#/}" != "$f" -o "${f%/..}" != "${f#*/../}"
+		then
+			echo 1>&2 "WARNING: Skipping bad whitelist entry $f."
+			continue
+		fi
+		if ! test -e "$upper/$f"
 		then
 			continue
 		fi
 		d="$save/$f"
+		while test "${d%/}" != "${d%/.}"
+		do
+			d="${d%/.}"
+			d="${d%/}"
+		done
 		mkdir -p "${d%/*}"
-		cp -rp $upper/$f "${d%/*}/"
+		cp -rp "$upper/$f" "${d%/*}/"
 	done < $whitelist
 
 	if test -n "$mounted"
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 15/16] initfs: whitelist: Sanitize obmc events whitelist entry
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (13 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 14/16] initfs: update: Sanitize whitelist directory entries OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  2016-06-30 23:50 ` [PATCH openbmc 16/16] initfs: Store whiltelist in a directory of files OpenBMC Patches
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Remove the trailing / so that the update script doesn't have to loop.

It was determined the trailing slash confused the code that makes
the save subdirectory.  The update script was fixed but this removes
the extra work needed.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
index 603cec7..c35a552 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
@@ -6,4 +6,4 @@
 /etc/group
 /etc/shadow
 /etc/gshadow
-/var/lib/obmc/events/
+/var/lib/obmc/events
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH openbmc 16/16] initfs: Store whiltelist in a directory of files
  2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
                   ` (14 preceding siblings ...)
  2016-06-30 23:50 ` [PATCH openbmc 15/16] initfs: whitelist: Sanitize obmc events whitelist entry OpenBMC Patches
@ 2016-06-30 23:50 ` OpenBMC Patches
  15 siblings, 0 replies; 17+ messages in thread
From: OpenBMC Patches @ 2016-06-30 23:50 UTC (permalink / raw)
  To: openbmc

From: Milton Miller <miltonm@us.ibm.com>

Change the whiltelist definition to be files in a directory instead
of a single file.  This will allow us to store which files should
be saved in individual recipes and also supports comments in the
whitelist.

The actual split into separate files is deferred for prototyping
what assistance classes should look like to make the whitelist
(eg systemd service files); also the packages will need to be
added to the package list for the initramfs image.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh | 2 +-
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh      | 6 ++++--
 .../recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb   | 5 +++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 70af93d..1f54d39 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -18,7 +18,7 @@ fi
 
 mkdir -p $rodir $rwdir
 
-cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs
+cp -rp init shutdown update whitelist.d bin sbin usr lib etc var run/initramfs
 
 # To start a interactive shell with job control at this point, run
 # getty 38400 ttyS4
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index f0c41a7..b061e26 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -100,7 +100,7 @@ toram=
 checksize=y
 checkmount=y
 
-whitelist=/run/initramfs/whitelist
+whitelist=/run/initramfs/whitelist.d/
 image=/run/initramfs/image-
 imglist=
 
@@ -191,7 +191,9 @@ then
 		done
 		mkdir -p "${d%/*}"
 		cp -rp "$upper/$f" "${d%/*}/"
-	done < $whitelist
+	done << HERE
+$(grep -v ^# $whitelist*)
+HERE
 
 	if test -n "$mounted"
 	then
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
index f81e21d..70b6686 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-initfs.bb
@@ -21,10 +21,11 @@ do_install() {
         install -m 0755 ${WORKDIR}/obmc-init.sh ${D}/init
         install -m 0755 ${WORKDIR}/obmc-shutdown.sh ${D}/shutdown
         install -m 0755 ${WORKDIR}/obmc-update.sh ${D}/update
-        install -m 0644 ${WORKDIR}/whitelist ${D}/whitelist
+        install -d ${D}/whitelist.d
+        install -m 0644 ${WORKDIR}/whitelist ${D}/whitelist.d/whitelist
         install -d ${D}/dev
         mknod -m 622 ${D}/dev/console c 5 1
 }
 
-FILES_${PN} += " /init /shutdown /update /whitelist /dev "
+FILES_${PN} += " /init /shutdown /update /whitelist.d/whitelist /dev "
 FILES_${PN} += " /init-options /init-download-url "
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-06-30 23:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 02/16] initfs: Fix recipe, remove unnecessary class OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 03/16] initfs: shutdown: comment on update success OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1 OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 05/16] initfs: update: Do not cause an error if no files were saved OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 06/16] initfs: update: Consistently add ERROR: and print to stderr OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 07/16] initfs: update: add option to perform checks but skip actual update OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 08/16] initfs: update: check individual mtd partitions for mounts OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 09/16] initfs: update: add check for image size vs mtd size OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 10/16] initfs: update: add --help message OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 11/16] initfs: init: add file for base options OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 12/16] image-types_uboot: Package a self contained netboot image OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 13/16] initfs: update: handle no images to update OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 14/16] initfs: update: Sanitize whitelist directory entries OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 15/16] initfs: whitelist: Sanitize obmc events whitelist entry OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 16/16] initfs: Store whiltelist in a directory of files OpenBMC Patches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.