setup-gummiboot-conf: add splash file support 19/15919/4
authorMikko Ylinen <mikko.ylinen@intel.com>
Fri, 31 Jan 2014 11:25:25 +0000 (13:25 +0200)
committerMikko Ylinen <mikko.ylinen@intel.com>
Fri, 31 Jan 2014 13:29:34 +0000 (15:29 +0200)
The latest gummiboot supports splash image loading. Each loader
entry can specify the splash image to load using 'splash' parameter.

Add a new option to the script to enable callers to generate splash
enabled entries.

Change-Id: I5c2d997aad869455c9fec9695e5b3664525a89bd
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
setup-gummiboot-conf

index 1fac081..4a84039 100755 (executable)
@@ -101,6 +101,9 @@ Options:
   -f, --force  if the entry already exists - re-write it, if
               <bootdir>/loader/loader.conf does not exist - create one,
               if <bootdir>/<kernel> does not exist - do not fail
+  -s, --splash <file>
+              add a splash field to the entry file. <file> is a
+              mandatory parameter to specify splash image location.
   -h, --help   show this text and exit
 EOF
 }
@@ -120,16 +123,20 @@ add_subcommand()
        fi
 
        local tmp
-       tmp=`getopt -n $PROG -o f,h --long force,help -- "$@"` ||
+       tmp=`getopt -n $PROG -o f,s:,h --long force,splash:,help -- "$@"` ||
                show_add_usage_fail "cannot parse command-line options"
        eval set -- "$tmp"
 
        local force=
+       local splash=
        while true; do
                case "$1" in
                -f|--force)
                        force="-f"
                        ;;
+               -s|--splash)
+                       splash="$2"; shift
+                       ;;
                -h|--help)
                        show_add_usage
                        exit 0
@@ -148,6 +155,9 @@ add_subcommand()
        if [ "$#" -gt 4 ]; then
                show_add_usage_fail "too many arguments: \"$1\""
        fi
+       if [ -n "$splash" ] && ! [ -f "$splash" ]; then
+               show_add_usage_fail "splash file not found: \"$splash\""
+       fi
 
        prepare
 
@@ -192,6 +202,13 @@ add_subcommand()
        options $options
        EOF
 
+       # Add an optional splash image entry if the image file exists
+       if [ -n "$splash" ]; then
+               cp $verbose -- "$splash" "$entries_dir"
+               printf "%s\n" "splash \\loader\\entries\\${splash##*/}" \
+               >> "$entry_path"
+       fi
+
        if [ -n "$verbose" ]; then
                verbose "contents of \"$entry_path\":"
                cat -- "$entry_path" >&2