[PATCH v3 3/6] obmc-{init, update}.sh: Cope with alternate RW FS types
Joel Stanley
joel at jms.id.au
Wed Feb 24 10:02:04 AEDT 2016
On Wed, Feb 24, 2016 at 1:15 AM, Andrew Jeffery <andrew at aj.id.au> wrote:
> Busybox's blkid is a little hamstrung, requiring some processing of the
> output to emulate what can be achieved with a couple of options with
> blkid from util-linux.
>
> Similar to findmtd(), the code for probe_fs_type() and blkid_fs_type()
> is duplicated between obmc-{init,update}.sh. Some consideration should
> be given to splitting out common functionality into well-defined
> sourcable scripts.
Why not do that? :)
>
> Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> ---
> .../obmc-phosphor-initfs/files/obmc-init.sh | 15 ++++++++++++++-
> .../obmc-phosphor-initfs/files/obmc-update.sh | 18 +++++++++++++++---
> 2 files changed, 29 insertions(+), 4 deletions(-)
> --- 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
> @@ -35,10 +35,22 @@ findmtd() {
> echo $m
> }
>
> +blkid_fs_type() {
> + # Emulate util-linux's `blkid -s TYPE -o value $1`
Put an example of the input and what you expect as the output in the comment.
> + blkid $1 \
> + | tr ' ' '\n' \
> + | awk -F= '/TYPE/ { print $2 }' \
> + | tr -d '"'
> +}
> +
> +probe_fs_type() {
> + fst=$(blkid_fs_type $1)
> + echo ${fst:=jffs2}
> +}
> +
> rwfs=$(findmtd rwfs)
>
> rwdev=/dev/mtdblock${rwfs#mtd}
> -rwfst=ext4
Would it make sense to do the same as the init case, where you set
rwfst to $(probe_fs_type $rwdev)?
> rwopts=rw
> rorwopts=ro${rwopts#rw}
>
More information about the openbmc
mailing list