diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-05 10:12:53 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-05 10:12:53 +0000 |
commit | 5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch) | |
tree | 1229a11f725bfa58aa7c57a76898553bb5f6654a /target/linux/ps3/petitboot/base-files/sbin | |
download | openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip |
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ps3/petitboot/base-files/sbin')
-rwxr-xr-x | target/linux/ps3/petitboot/base-files/sbin/initrun | 18 | ||||
-rwxr-xr-x | target/linux/ps3/petitboot/base-files/sbin/ps3-bl-option | 119 |
2 files changed, 137 insertions, 0 deletions
diff --git a/target/linux/ps3/petitboot/base-files/sbin/initrun b/target/linux/ps3/petitboot/base-files/sbin/initrun new file mode 100755 index 000000000..1c3363fcc --- /dev/null +++ b/target/linux/ps3/petitboot/base-files/sbin/initrun @@ -0,0 +1,18 @@ +#!/bin/sh +# Run petitboot at first startup, otherwise run a login. + +sbindir=/usr/sbin +localstatedir=/var/petitboot + +petitboot=$sbindir/petitboot +run_once=$localstatedir/.run-once + +if [ ! -f $run_once -a -x $petitboot ]; then + # quiet console + echo 3 > /proc/sys/kernel/printk + mkdir -p $localstatedir + touch $run_once + exec $petitboot --timeout +fi + +exec /bin/ash --login diff --git a/target/linux/ps3/petitboot/base-files/sbin/ps3-bl-option b/target/linux/ps3/petitboot/base-files/sbin/ps3-bl-option new file mode 100755 index 000000000..972c00ae1 --- /dev/null +++ b/target/linux/ps3/petitboot/base-files/sbin/ps3-bl-option @@ -0,0 +1,119 @@ +#!/bin/sh +# +# Copyright (C) 2008 Sony Computer Entertainment Inc. +# Copyright 2008 Sony Corp. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +usage() { + echo -n " +SYNOPSIS + ps3-bl-option [OPTION] +DESCRIPTION + Get and set PS3 bootloader options in flash. +OPTIONS + -m, --get-video-mode + Get the bootloader video mode. + -M, --set-video-mode value + Set the bootloader video mode. + -o, --get-bootloader-timeout + Get the bootloader timeout in seconds. + -O, --set-bootloader-timeout value + Set the bootloader timeout in seconds. + -p, --get-bootloader-default + Get the default bootloader menu item. + -P, --set-bootloader-default value + Set the default bootloader menu item. + -t, --get-telnet-enabled + Get the telnet enabled flag. + -T, --set-telnet-enabled value + Set the telnet enabled flag. + -h, --help + Print a help message. +SEE ALSO + ps3-flash-util(8) +" +} + +bad_arg() { + echo "ERROR: bad arg" >&2; + usage + exit 1 +} + +if [ "$#" -eq 0 ] ; then + bad_arg +fi + +get_flag() { + flags=`ps3-flash-util --db-print $1 $2` + echo $(( ${flags:-0} & $3 )) +} + +set_flag() { + flags=`ps3-flash-util --db-print $1 $2` + + if [ $4 -eq 0 ]; then + ps3-flash-util --db-write-half $1 $2 $(( ${flags:-0} & ~$3 )) + else + ps3-flash-util --db-write-half $1 $2 $(( ${flags:-0} | $3 )) + fi +} + +# owners +bootloader="3" + +# keys +item="1" +video="2" +flags="3" +timeout="4" + +# flags +telnet="1" + +case "$1" in + -m | --get-video-mode) + ps3-flash-util --db-print ${bootloader} ${video} + ;; + -M | --set-video-mode) + ps3-flash-util --db-write-half ${bootloader} ${video} $2 + ;; + -o | --get-bootloader-timeout) + ps3-flash-util --db-print ${bootloader} ${timeout} + ;; + -O | --set-bootloader-timeout) + 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) + get_flag ${bootloader} ${flags} ${telnet} + ;; + -T | --set-telnet-enabled) + set_flag ${bootloader} ${flags} ${telnet} $2 + ;; + -h | --help) + usage + exit 0 + ;; + *) + bad_arg + ;; +esac |