ps3: Updates for ps3-bl-option

Update the ps3 bootloader helper script ps3-bl-option.

 o Add new option --set-bootloader-timeout.
 o Use generic name 'bootloader'.
 o General format cleanup.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17300 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Geoff Levand 2009-08-18 21:48:38 +00:00
parent 3f063c39b8
commit 25780bc555
1 changed files with 52 additions and 46 deletions

View File

@ -18,44 +18,43 @@
# #
usage() { usage() {
echo "" >&2 echo -n "
echo "SYNOPSIS" >&2 SYNOPSIS
echo " bl-option [OPTION]" >&2 ps3-bl-option [OPTION]
echo "" >&2 DESCRIPTION
echo "DESCRIPTION" >&2 Get and set PS3 bootloader options in flash.
echo " Get and set PS3 bootloader options in flash." >&2 OPTIONS
echo "" >&2 -m, --get-video-mode
echo "OPTIONS" >&2 Get the bootloader video mode.
echo " -m, --get-video-mode" >&2 -M, --set-video-mode value
echo " Get the bootloader video mode." >&2 Set the bootloader video mode.
echo "" >&2 -o, --get-bootloader-timeout
echo " -M, --set-video-mode value" >&2 Get the bootloader timeout in seconds.
echo " Set the bootloader video mode." >&2 -O, --set-bootloader-timeout value
echo "" >&2 Set the bootloader timeout in seconds.
echo " -p, --get-petitboot-default" >&2 -p, --get-bootloader-default
echo " Get the default Petitboot menu item." >&2 Get the default bootloader menu item.
echo "" >&2 -P, --set-bootloader-default value
echo " -P, --set-petitboot-default value" >&2 Set the default bootloader menu item.
echo " Set the default Petitboot menu item." >&2 -t, --get-telnet-enabled
echo "" >&2 Get the telnet enabled flag.
echo " -t, --get-telnet-enabled" >&2 -T, --set-telnet-enabled value
echo " Get the telnet enabled flag." >&2 Set the telnet enabled flag.
echo "" >&2 -h, --help
echo " -T, --set-telnet-enabled value" >&2 Print a help message.
echo " Set the telnet enabled flag." >&2 SEE ALSO
echo "" >&2 ps3-flash-util(8)
echo " -h, --help" >&2 "
echo " Print a help message." >&2 }
echo "" >&2
echo "SEE ALSO" >&2 bad_arg() {
echo " ps3-flash-util(8)" >&2 echo "ERROR: bad arg" >&2;
echo "" >&2 usage
exit 1 exit 1
} }
if [ "$#" -eq 0 ] ; then if [ "$#" -eq 0 ] ; then
echo "ERROR: bad arg" >&2; bad_arg
usage
fi fi
get_flag() { get_flag() {
@ -74,40 +73,47 @@ set_flag() {
} }
# owners # owners
petitboot="3" bootloader="3"
# keys # keys
menu="1" item="1"
video="2" video="2"
flags="3" flags="3"
timeout="4"
# flags # flags
telnet="1" telnet="1"
case "$1" in case "$1" in
-m | --get-video-mode) -m | --get-video-mode)
ps3-flash-util --db-print ${petitboot} ${video} ps3-flash-util --db-print ${bootloader} ${video}
;; ;;
-M | --set-video-mode) -M | --set-video-mode)
ps3-flash-util --db-write-half ${petitboot} ${video} $2 ps3-flash-util --db-write-half ${bootloader} ${video} $2
;; ;;
-p | --get-petitboot-default) -o | --get-bootloader-timeout)
ps3-flash-util --db-print ${petitboot} ${menu} ps3-flash-util --db-print ${bootloader} ${timeout}
;; ;;
-P | --set-petitboot-default) -O | --set-bootloader-timeout)
ps3-flash-util --db-write-word ${petitboot} ${menu} $2 ps3-flash-util --db-write-half ${bootloader} ${timeout} $2
;;
-p | --get-bootloader-default)
ps3-flash-util --db-print ${bootloader} ${item}
;;
-P | --set-bootloader-default)
ps3-flash-util --db-write-word ${bootloader} ${item} $2
;; ;;
-t | --get-telnet-enabled) -t | --get-telnet-enabled)
get_flag ${petitboot} ${flags} ${telnet} get_flag ${bootloader} ${flags} ${telnet}
;; ;;
-T | --set-telnet-enabled) -T | --set-telnet-enabled)
set_flag ${petitboot} ${flags} ${telnet} $2 set_flag ${bootloader} ${flags} ${telnet} $2
;; ;;
-h | --help) -h | --help)
usage usage
exit 0
;; ;;
*) *)
echo "ERROR: bad arg $1" >&2; bad_arg
usage
;; ;;
esac esac