pax_global_header00006660000000000000000000000064111027021630014503gustar00rootroot0000000000000052 comment=739f30f10622e86b97c074a05f93f4fc732f5c4c ps3-utils-2.3/000077500000000000000000000000001110270216300132125ustar00rootroot00000000000000ps3-utils-2.3/.gitignore000066400000000000000000000013301110270216300151770ustar00rootroot00000000000000# # NOTE! Don't add files that are generated in specific # subdirectories here. Add them in the ".gitignore" file # in that subdirectory instead. # # Normal rules # .* *.o *.a *.s *.i *.lst # # Top-level generic files # tags TAGS # # bootstrap generated files # aclocal.m4 autom4te.cache config.guess config.h.in config.sub config.sub.orig configure.ac configure depcomp install-sh ltmain.sh missing Makefile.in # # configure generated files # Makefile config.h config.log config.status libtool stamp-h1 # # make generated files # *.lo *.la ps3-boot-game-os ps3-dump-bootloader ps3-flash-util ps3-rtc-init ps3-video-mode ps3-boot-game-os.8 ps3-dump-bootloader.8 ps3-flash-util.8 ps3-rtc-init.8 ps3-utils.8 ps3-video-mode.8 ps3-utils-2.3/COPYING000066400000000000000000000431311110270216300142470ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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; either version 2 of the License, or (at your option) any later version. 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ps3-utils-2.3/INSTALL000066400000000000000000000154671110270216300142600ustar00rootroot00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Type `make install' to install the programs and any data files and documentation. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. ps3-utils-2.3/Makefile.am000066400000000000000000000067771110270216300152670ustar00rootroot00000000000000# # Copyright 2007 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 # if COND_DEBUG extra_cppflags = -DDEBUG else extra_cppflags = -DNDEBUG endif SUBDIRS = lib composed_bin_scripts = bin_SCRIPTS = $(composed_bin_scripts) composed_sbin_scripts = \ ps3-boot-game-os \ ps3-dump-bootloader \ ps3-rtc-init sbin_SCRIPTS = $(composed_sbin_scripts) composed_mans = \ ps3-boot-game-os.8 \ ps3-dump-bootloader.8 \ ps3-flash-util.8 \ ps3-rtc-init.8 \ ps3-utils.8 \ ps3-video-mode.8 man_MANS = $(composed_mans) AM_CPPFLAGS = -I$(srcdir)/lib AM_CFLAGS = $(extra_cppflags) \ -g \ -Wall \ -W \ -Wunused \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wmissing-declarations \ -Wredundant-decls \ -Winline AM_LDFLAGS = -Llib bin_PROGRAMS = ps3-video-mode sbin_PROGRAMS = ps3-flash-util ps3_flash_util_DEPENDENCIES = Makefile ps3_flash_util_SOURCES = ps3-flash-util.c ps3_flash_util_LDADD = -lps3-utils ps3_video_mode_DEPENDENCIES = Makefile ps3_video_mode_SOURCES = ps3-video-mode.c ps3_video_mode_LDADD = -lps3-utils edit = sed \ -e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \ -e 's|@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|g' \ -e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \ -e 's|@libexecdir\@|$(libexecdir)|g' \ -e 's|@datadir\@|$(pkgdatadir)|g' \ -e 's|@prefix\@|$(prefix)|g' ps3-boot-game-os: Makefile $(srcdir)/ps3-boot-game-os.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp chmod +x $@.tmp mv $@.tmp $@ ps3-dump-bootloader: Makefile $(srcdir)/ps3-dump-bootloader.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp chmod +x $@.tmp mv $@.tmp $@ ps3-rtc-init: Makefile $(srcdir)/ps3-rtc-init.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp chmod +x $@.tmp mv $@.tmp $@ ps3-boot-game-os.8: Makefile $(srcdir)/ps3-boot-game-os.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ ps3-dump-bootloader.8: Makefile $(srcdir)/ps3-dump-bootloader.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ ps3-flash-util.8: Makefile $(srcdir)/ps3-flash-util.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ ps3-rtc-init.8: Makefile $(srcdir)/ps3-rtc-init.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ ps3-utils.8: Makefile $(srcdir)/ps3-utils.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ ps3-video-mode.8: Makefile $(srcdir)/ps3-video-mode.8.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp groff -Cz -man $@.tmp mv $@.tmp $@ composed_files = $(composed_mans) $(composed_bin_scripts) \ $(composed_sbin_scripts) EXTRA_DIST = bootstrap configure.ac.in $(addsuffix .in, $(composed_files)) MAINTAINERCLEANFILES = aclocal.m4 config.* configure configure.ac depcomp \ install-sh ltmain.sh Makefile.in missing $(PACKAGE)-*.gz CLEANFILES = $(composed_files) $(addsuffix .tmp, $(composed_files)) ps3-utils-2.3/bootstrap000077500000000000000000000036431110270216300151630ustar00rootroot00000000000000#! /bin/bash # bootstrap -- Use this script to create generated files from a VCS checkout # # 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; either version 2, or (at your option) # any later version. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. version= if [ "$1" ]; then version=$1 elif head=$(git rev-parse --short --verify HEAD 2>/dev/null); then # If available, use the git commit revision for the package version. months="Jan:01 Feb:02 Mar:03 Apr:04 May:05 Jun:06 Jul:07 Aug:08 \ Sep:09 Oct:10 Nov:11 Dec:12" # Add a date prefix for easy reading. date=$(git-log --pretty=format:"%cD" -1 HEAD) # date='Fri, 2 Aug 2007 19:36:06 -0700' date=${date##*, } date=${date% [0-9][0-9]:*} day=${date%* [A-Z][a-z][a-z] *} year=${date##* [A-Z][a-z][a-z] 20} month=${date##${day} } month=${month%% 20${year}} month=${months##*${month}:} month=${month%% *} [ ! ${day#[0-9][0-9]} ] || day="0$day" version=$(printf '%s.%s.%s-%s%s' ${year} ${month} ${day} g ${head}) # Add a '-dirty' postfix for uncommitted changes. if git diff-index HEAD | read dummy; then version=`printf '%s%s' ${version} -dirty` fi else # Default to date and time. version="dev-$(date +%y.%m.%d-%H.%M.%S)" fi set -x sed -e s,@version@,${version},g configure.ac.in > configure.ac aclocal libtoolize --force --copy autoheader automake --foreign --add-missing --copy autoconf pushd lib> /dev/null && ./bootstrap ${version} ; popd > /dev/null ps3-utils-2.3/configure.ac.in000066400000000000000000000021311110270216300161020ustar00rootroot00000000000000# # Copyright 2007 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 # AC_INIT([ps3-utils], [@version@], [Geoff Levand ]) AC_PREFIX_DEFAULT([/usr/local]) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [enable debugging support])]) AM_CONDITIONAL([COND_DEBUG], [test "x${enable_debug}" = "xyes"]) AC_PROG_LIBTOOL AM_INIT_AUTOMAKE AC_SUBST([DESTDIR]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_SUBDIRS([lib]) AC_OUTPUT ps3-utils-2.3/lib/000077500000000000000000000000001110270216300137605ustar00rootroot00000000000000ps3-utils-2.3/lib/COPYING000066400000000000000000000431311110270216300150150ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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; either version 2 of the License, or (at your option) any later version. 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ps3-utils-2.3/lib/INSTALL000066400000000000000000000166541110270216300150250ustar00rootroot00000000000000Installation notes ================== When cross compiling you can define the DESTDIR make variable to relocate install objects into an RPM staging area or a target NFS file system on the host. If building from sources checked out from VCS you must run the bootstrap script once after each checkout or update. native build example -------------------- 1. $ ./bootstrap # for VCS sources only 2. $ ./configure 3. $ make 4. $ make install cross build example ------------------- 1. $ ./bootstrap # for VCS sources only 2. $ ./configure DESTDIR=${target_root} --host=ppu 3. $ make 4. $ make install Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Type `make install' to install the programs and any data files and documentation. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. ps3-utils-2.3/lib/Makefile.am000066400000000000000000000033111110270216300160120ustar00rootroot00000000000000# # Copyright 2007 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 # if COND_DEBUG extra_cppflags = -DDEBUG else extra_cppflags = -DNDEBUG endif include_HEADERS = ps3-flash.h ps3-av.h AM_CFLAGS = $(extra_cppflags) \ -g \ -Wall \ -W \ -Wunused \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wmissing-declarations \ -Wredundant-decls \ -Winline lib_LTLIBRARIES = libps3-utils.la # version-info rules (current:revision:age): # * If the library source code has changed since the last release, then # increment revision. # * If any interfaces have been added, removed, or changed since the # last release, then increment current and set revision to 0. # * If any interfaces have been added since the last release, then # increment age. # * If any interfaces have been removed since the last release, then # set age to 0. libps3_utils_la_DEPENDENCIES = Makefile libps3_utils_la_SOURCES = flash.c flash-db.c libps3_utils_la_LDFLAGS = -version-info 2:0:0 ${EXTRA_LDFLAGS} EXTRA_DIST = bootstrap configure.ac.in MAINTAINERCLEANFILES = aclocal.m4 config.* configure configure.ac Makefile.in ps3-utils-2.3/lib/bootstrap000077500000000000000000000035401110270216300157250ustar00rootroot00000000000000#! /bin/bash # bootstrap -- Use this script to create generated files from a VCS checkout # # 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; either version 2, or (at your option) # any later version. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. version= if [ "$1" ]; then version=$1 elif head=$(git rev-parse --short --verify HEAD 2>/dev/null); then # If available, use the git commit revision for the package version. months="Jan:01 Feb:02 Mar:03 Apr:04 May:05 Jun:06 Jul:07 Aug:08 \ Sep:09 Oct:10 Nov:11 Dec:12" # Add a date prefix for easy reading. date=$(git-log --pretty=format:"%cD" -1 HEAD) # date='Fri, 2 Aug 2007 19:36:06 -0700' date=${date##*, } date=${date% [0-9][0-9]:*} day=${date%* [A-Z][a-z][a-z] *} year=${date##* [A-Z][a-z][a-z] 20} month=${date##${day} } month=${month%% 20${year}} month=${months##*${month}:} month=${month%% *} [ ! ${day#[0-9][0-9]} ] || day="0$day" version=$(printf '%s.%s.%s-%s%s' ${year} ${month} ${day} g ${head}) # Add a '-dirty' postfix for uncommitted changes. if git diff-index HEAD | read dummy; then version=`printf '%s%s' ${version} -dirty` fi else # Default to date and time. version="dev-$(date +%y.%m.%d-%H.%M.%S)" fi set -x sed -e s,@version@,${version},g configure.ac.in > configure.ac aclocal libtoolize --force --copy autoheader automake --foreign --add-missing --copy autoconf ps3-utils-2.3/lib/configure.ac.in000066400000000000000000000024311110270216300166530ustar00rootroot00000000000000# # Copyright 2007 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 # AC_INIT([libps3-utils], [@version@], [Geoff Levand ]) AC_PREFIX_DEFAULT([/usr/local]) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [enable debugging support])]) AM_CONDITIONAL([COND_DEBUG], [test "x${enable_debug}" = "xyes"]) AC_PROG_LIBTOOL AM_INIT_AUTOMAKE AC_SUBST([DESTDIR]) AC_CHECK_HEADERS([asm/ps3av.h]) AC_CHECK_DECLS([PS3AV_MODE_MASK, PS3AV_MODE_RGB, PS3AV_MODE_FULL, \ PS3AV_MODE_WHITE, PS3AV_MODE_COLOR, PS3AV_MODE_DITHER, PS3AV_MODE_HDCP_OFF], [], [], [#include ]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ps3-utils-2.3/lib/flash-db.c000066400000000000000000000441271110270216300156140ustar00rootroot00000000000000/* * PS3 flash memory os area. * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006 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 */ #include #include "ps3-flash.h" #if defined(DEBUG) #define DBG(_args...) do {fprintf(stderr, _args);} while(0) #else static inline int __attribute__ ((format (printf, 1, 2))) DBG( __attribute__((unused)) const char *fmt, ...) {return 0;} #endif struct index { uint8_t owner:5; uint8_t key:3; }; struct iterator { const struct os_area_db *db; struct os_area_db_id match_id; struct index *idx; struct index *last_idx; union { uint64_t *value_64; uint32_t *value_32; uint16_t *value_16; }; }; static unsigned int align_up(unsigned int val, unsigned int size) { return (val + (size - 1)) & (~(size - 1)); } /* 64 bit */ /** * index_array_64 - Helper to get the 64 bit index array. */ static struct index *index_array_64(const struct os_area_db *db) { return (void *)db + db->index_64; } /** * value_array_64 - Helper to get the 64 bit values array. */ static uint64_t *value_array_64(const struct os_area_db *db) { return (void *)db + db->index_64 + align_up(db->count_64, 8); } /** * for_each_64 - Iterator for 64 bit entries. * * A NULL value for id can be used to match all entries. * OS_AREA_DB_OWNER_ANY and OS_AREA_DB_KEY_ANY can be used to match all. */ static int for_each_64(const struct os_area_db *db, const struct os_area_db_id *match_id, struct iterator *i) { next: if (!i->db) { i->db = db; i->match_id = match_id ? *match_id : os_area_db_any_id; i->idx = index_array_64(db); i->last_idx = i->idx + db->count_64; i->value_64 = value_array_64(db); } else { i->idx++; i->value_64++; } if (i->idx >= i->last_idx) { DBG("%s:%d: reached end\n", __func__, __LINE__); return 0; } if (i->match_id.owner != OS_AREA_DB_OWNER_ANY && i->match_id.owner != (int)i->idx->owner) goto next; if (i->match_id.key != OS_AREA_DB_KEY_ANY && i->match_id.key != (int)i->idx->key) goto next; return 1; } /** * enumerate_64 - Helper to find and operate on 64 bit entries. */ static int enumerate_64(struct os_area_db *db, const struct os_area_db_id *id, int (*fn)(void *inst, struct index *idx, uint64_t *value), void *inst) { struct iterator i; for (i.db = NULL; for_each_64(db, id, &i); ) if (fn(inst, i.idx, i.value_64)) break; return 0; } static int delete_64(struct os_area_db *db, const struct os_area_db_id *id) { //DBG("%s:%d: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); struct iterator i; for (i.db = NULL; for_each_64(db, id, &i); ) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_64); i.idx->owner = 0; i.idx->key = 0; *i.value_64 = 0; } return 0; } int os_area_db_set_64(struct os_area_db *db, const struct os_area_db_id *id, uint64_t value) { struct iterator i; DBG("%s:%d: (%d:%d) <= %llxh\n", __func__, __LINE__, id->owner, id->key, (unsigned long long)value); if (!id->owner || id->owner == OS_AREA_DB_OWNER_ANY || id->key == OS_AREA_DB_KEY_ANY) { fprintf(stderr, "%s:%d: bad id: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); return -1; } os_area_db_remove(db, id); i.db = NULL; if (for_each_64(db, &os_area_db_empty_id, &i)) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_64); i.idx->owner = id->owner; i.idx->key = id->key; *i.value_64 = value; DBG("%s:%d: set (%d:%d) <= %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_64); return 0; } fprintf(stderr, "%s:%d: database full.\n", __func__, __LINE__); return -1; } static int get_64(const struct os_area_db *db, const struct os_area_db_id *id, uint64_t *value) { struct iterator i; i.db = NULL; if (for_each_64(db, id, &i)) { *value = *i.value_64; DBG("%s:%d: found %lld\n", __func__, __LINE__, (long long int)*i.value_64); return 0; } DBG("%s:%d: not found\n", __func__, __LINE__); return -1; } /* 32 bit */ /** * index_array_32 - Helper to get the 32 bit index array. */ static struct index *index_array_32(const struct os_area_db *db) { return (void *)db + db->index_32; } /** * value_array_32 - Helper to get the 32 bit values array. */ static uint32_t *value_array_32(const struct os_area_db *db) { return (void *)db + db->index_32 + align_up(db->count_32, 8); } /** * for_each_32 - Iterator for 32 bit entries. * * A NULL value for id can be used to match all entries. * OS_AREA_DB_OWNER_ANY and OS_AREA_DB_KEY_ANY can be used to match all. */ static int for_each_32(const struct os_area_db *db, const struct os_area_db_id *match_id, struct iterator *i) { next: if (!i->db) { i->db = db; i->match_id = match_id ? *match_id : os_area_db_any_id; i->idx = index_array_32(db); i->last_idx = i->idx + db->count_32; i->value_32 = value_array_32(db); } else { i->idx++; i->value_32++; } if (i->idx >= i->last_idx) { DBG("%s:%d: reached end\n", __func__, __LINE__); return 0; } if (i->match_id.owner != OS_AREA_DB_OWNER_ANY && i->match_id.owner != (int)i->idx->owner) goto next; if (i->match_id.key != OS_AREA_DB_KEY_ANY && i->match_id.key != (int)i->idx->key) goto next; return 1; } static int delete_32(struct os_area_db *db, const struct os_area_db_id *id) { //DBG("%s:%d: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); struct iterator i; for (i.db = NULL; for_each_32(db, id, &i); ) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_32); i.idx->owner = 0; i.idx->key = 0; *i.value_32 = 0; } return 0; } int os_area_db_set_32(struct os_area_db *db, const struct os_area_db_id *id, uint32_t value) { struct iterator i; DBG("%s:%d: (%d:%d) <= %llxh\n", __func__, __LINE__, id->owner, id->key, (unsigned long long)value); if (!id->owner || id->owner == OS_AREA_DB_OWNER_ANY || id->key == OS_AREA_DB_KEY_ANY) { fprintf(stderr, "%s:%d: bad id: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); return -1; } os_area_db_remove(db, id); i.db = NULL; if (for_each_32(db, &os_area_db_empty_id, &i)) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_32); i.idx->owner = id->owner; i.idx->key = id->key; *i.value_32 = value; DBG("%s:%d: set (%d:%d) <= %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_32); return 0; } fprintf(stderr, "%s:%d: database full.\n", __func__, __LINE__); return -1; } static int get_32(const struct os_area_db *db, const struct os_area_db_id *id, uint32_t *value) { struct iterator i; i.db = NULL; if (for_each_32(db, id, &i)) { *value = *i.value_32; DBG("%s:%d: found %lld\n", __func__, __LINE__, (long long int)*i.value_32); return 0; } DBG("%s:%d: not found\n", __func__, __LINE__); return -1; } /* 16 bit */ /** * index_array_16 - Helper to get the 16 bit index array. */ static struct index *index_array_16(const struct os_area_db *db) { return (void *)db + db->index_16; } /** * value_array_16 - Helper to get the 16 bit values array. */ static uint16_t *value_array_16(const struct os_area_db *db) { return (void *)db + db->index_16 + align_up(db->count_16, 8); } /** * for_each_16 - Iterator for 16 bit entries. * * A NULL value for id can be used to match all entries. * OS_AREA_DB_OWNER_ANY and OS_AREA_DB_KEY_ANY can be used to match all. */ static int for_each_16(const struct os_area_db *db, const struct os_area_db_id *match_id, struct iterator *i) { next: if (!i->db) { i->db = db; i->match_id = match_id ? *match_id : os_area_db_any_id; i->idx = index_array_16(db); i->last_idx = i->idx + db->count_16; i->value_16 = value_array_16(db); } else { i->idx++; i->value_16++; } if (i->idx >= i->last_idx) { DBG("%s:%d: reached end\n", __func__, __LINE__); return 0; } if (i->match_id.owner != OS_AREA_DB_OWNER_ANY && i->match_id.owner != (int)i->idx->owner) goto next; if (i->match_id.key != OS_AREA_DB_KEY_ANY && i->match_id.key != (int)i->idx->key) goto next; return 1; } static int delete_16(struct os_area_db *db, const struct os_area_db_id *id) { //DBG("%s:%d: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); struct iterator i; for (i.db = NULL; for_each_16(db, id, &i); ) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_16); i.idx->owner = 0; i.idx->key = 0; *i.value_16 = 0; } return 0; } int os_area_db_set_16(struct os_area_db *db, const struct os_area_db_id *id, uint16_t value) { struct iterator i; DBG("%s:%d: (%d:%d) <= %llxh\n", __func__, __LINE__, id->owner, id->key, (unsigned long long)value); if (!id->owner || id->owner == OS_AREA_DB_OWNER_ANY || id->key == OS_AREA_DB_KEY_ANY) { fprintf(stderr, "%s:%d: bad id: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); return -1; } os_area_db_remove(db, id); i.db = NULL; if (for_each_16(db, &os_area_db_empty_id, &i)) { DBG("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_16); i.idx->owner = id->owner; i.idx->key = id->key; *i.value_16 = value; DBG("%s:%d: set (%d:%d) <= %llxh\n", __func__, __LINE__, i.idx->owner, i.idx->key, (unsigned long long)*i.value_16); return 0; } fprintf(stderr, "%s:%d: database full.\n", __func__, __LINE__); return -1; } static int get_16(const struct os_area_db *db, const struct os_area_db_id *id, uint16_t *value) { struct iterator i; i.db = NULL; if (for_each_16(db, id, &i)) { *value = *i.value_16; DBG("%s:%d: found %lld\n", __func__, __LINE__, (long long int)*i.value_16); return 0; } DBG("%s:%d: not found\n", __func__, __LINE__); return -1; } /** * os_area_db_remove - Remove an entry from the database. * * Does an exhaustive search to clean stale entries. */ int os_area_db_remove(struct os_area_db *db, const struct os_area_db_id *id) { delete_64(db, id); delete_32(db, id); delete_16(db, id); return 0; } /** * os_area_db_read - Read the os area database. */ int os_area_db_read(struct os_area_db *db, const struct os_area_header *h, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = os_area_header_verify(h); if (result) { DBG("%s:%d: invalid os_area_header\n", __func__, __LINE__); return -1; } /* other_os */ result = fseek(dev, h->db_area_offset * OS_AREA_SEGMENT_SIZE, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_other_os.\n", __func__, __LINE__); perror(0); return result; } bytes = fread(db, 1, sizeof(struct os_area_db), dev); if (bytes < sizeof(struct os_area_db)) { fprintf(stderr, "%s:%d: read error: os_area_other_os.\n", __func__, __LINE__); perror(0); return -1; } result = os_area_db_verify(db); if (result) { fprintf(stderr, "%s:%d: invalid db header\n", __func__, __LINE__); return -1; } return 0; } int os_area_db_write(const struct os_area_db *db, const struct os_area_header *h, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = os_area_header_verify(h); if (result) { fprintf(stderr, "%s:%d: invalid os_area_header\n", __func__, __LINE__); return -1; } if (!h->db_area_offset) { DBG("%s:%d: bad db_area_offset\n", __func__, __LINE__); return -1; } result = fseek(dev, h->db_area_offset * OS_AREA_SEGMENT_SIZE, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_other_os.\n", __func__, __LINE__); perror(0); return result; } bytes = fwrite(db, 1, sizeof(struct os_area_db), dev); if (bytes < sizeof(struct os_area_db)) { fprintf(stderr, "%s:%d: fwrite error: os_area_other_os.\n", __func__, __LINE__); perror(0); return -1; } return 0; } int os_area_db_get(const struct os_area_db *db, const struct os_area_db_id *id, uint64_t *value) { int result; uint32_t tmp_32; uint16_t tmp_16; result = get_64(db, id, value); if (!result) return result; result = get_32(db, id, &tmp_32); *value = tmp_32; if (!result) return result; result = get_16(db, id, &tmp_16); *value = tmp_16; return result; } int os_area_db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff) { static const struct os_area_db_id id = { .owner = OS_AREA_DB_OWNER_LINUX, .key = OS_AREA_DB_KEY_RTC_DIFF }; return get_64(db, &id, (uint64_t*)rtc_diff); } int os_area_db_get_video_mode(const struct os_area_db *db, unsigned int *video_mode) { static const struct os_area_db_id id = { .owner = OS_AREA_DB_OWNER_LINUX, .key = OS_AREA_DB_KEY_VIDEO_MODE }; return get_64(db, &id, (uint64_t*)video_mode); } static void print_64(const struct os_area_db *db, const struct os_area_db_id *const id, int verbose) { struct iterator i; unsigned int c; for (c = 0, i.db = NULL; for_each_64(db, id, &i); c++) { const char *p = (const char *)i.value_64; if (!verbose) printf("%llu\n", (unsigned long long)*i.value_64); else { char s[9]; s[0] = (p[0] < 127 && p[0] > 31) ? p[0] : '.'; s[1] = (p[1] < 127 && p[1] > 31) ? p[1] : '.'; s[2] = (p[2] < 127 && p[2] > 31) ? p[2] : '.'; s[3] = (p[3] < 127 && p[3] > 31) ? p[3] : '.'; s[4] = (p[4] < 127 && p[4] > 31) ? p[4] : '.'; s[5] = (p[5] < 127 && p[5] > 31) ? p[5] : '.'; s[6] = (p[6] < 127 && p[6] > 31) ? p[6] : '.'; s[7] = (p[7] < 127 && p[7] > 31) ? p[7] : '.'; s[8] = 0; printf(" 64[%2u] (%d:%d): %llxh(%llu) - %s\n", c, i.idx->owner, i.idx->key, (unsigned long long)*i.value_64, (unsigned long long)*i.value_64, s); } } } static void print_32(const struct os_area_db *db, const struct os_area_db_id *const id, int verbose) { struct iterator i; unsigned int c; for (c = 0, i.db = NULL; for_each_32(db, id, &i); c++) { const char *p = (const char *)i.value_32; if (!verbose) printf("%lu\n", (unsigned long)*i.value_32); else { char s[9]; s[0] = (p[0] < 127 && p[0] > 31) ? p[0] : '.'; s[1] = (p[1] < 127 && p[1] > 31) ? p[1] : '.'; s[2] = (p[2] < 127 && p[2] > 31) ? p[2] : '.'; s[3] = (p[3] < 127 && p[3] > 31) ? p[3] : '.'; s[4] = 0; printf(" 32[%2u] (%d:%d): %lxh(%lu) - %s\n", c, i.idx->owner, i.idx->key, (unsigned long)*i.value_32, (unsigned long)*i.value_32, s); } } } static void print_16(const struct os_area_db *db, const struct os_area_db_id *const id, int verbose) { struct iterator i; unsigned int c; for (c = 0, i.db = NULL; for_each_16(db, id, &i); c++) { const char *p = (const char *)i.value_16; if (!verbose) printf("%u\n", (unsigned int)*i.value_16); else { char s[9]; s[0] = (p[0] < 127 && p[0] > 31) ? p[0] : '.'; s[1] = (p[1] < 127 && p[1] > 31) ? p[1] : '.'; s[2] = 0; printf(" 16[%2u] (%d:%d): %xh(%u) - %s\n", c, i.idx->owner, i.idx->key, (unsigned int)*i.value_16, (unsigned int)*i.value_16, s); } } } void os_area_db_print(const struct os_area_db *db, const struct os_area_db_id *const id, int verbose) { DBG("%s:%d: (%d:%d)\n", __func__, __LINE__, id->owner, id->key); print_64(db, id, verbose); print_32(db, id, verbose); print_16(db, id, verbose); } void os_area_db_init(struct os_area_db *db) { /* * item | start | size * ----------+-------+------- * header | 0 | 24 * index_64 | 24 | 64 * values_64 | 88 | 57*8 = 456 * index_32 | 544 | 64 * values_32 | 609 | 57*4 = 228 * index_16 | 836 | 64 * values_16 | 900 | 57*2 = 114 * end | 1014 | - */ memset(db, 0, sizeof(struct os_area_db)); db->magic_num = 0x2d64622dU; db->version = 1; db->index_64 = 24; db->count_64 = 57; db->index_32 = 544; db->count_32 = 57; db->index_16 = 836; db->count_16 = 57; } int os_area_db_verify(const struct os_area_db *db) { if (db->magic_num != 0x2d64622dU) { fprintf(stderr, "%s:%d magic_num failed\n", __func__, __LINE__); return -1; } if (db->version != 1) { fprintf(stderr, "%s:%d version failed\n", __func__, __LINE__); return -1; } return 0; } int os_area_db_format(struct os_area_db *db, const struct os_area_header *h, FILE *dev) { int result; os_area_db_init(db); os_area_db_write(db, h, dev); result = os_area_db_read(db, h, dev); if (result) fprintf(stderr, "%s:%d: db_format failed.\n", __func__, __LINE__); return result; } int os_area_db_list_owners(char *buf, unsigned int size) { return snprintf(buf, size, "Known database owners:\n" " owner: ANY: %d\n" " owner: PROTOTYPE: %d\n" " owner: LINUX: %d\n" " owner: PETITBOOT: %d\n" "Known database keys:\n" " key: ANY: %d\n" " key: RTC_DIFF: %d\n" " key: VIDEO_MODE: %d\n", OS_AREA_DB_OWNER_ANY, OS_AREA_DB_OWNER_PROTOTYPE, OS_AREA_DB_OWNER_LINUX, OS_AREA_DB_OWNER_PETITBOOT, OS_AREA_DB_KEY_ANY, OS_AREA_DB_KEY_RTC_DIFF, OS_AREA_DB_KEY_VIDEO_MODE); } void os_area_db_dump_header(const struct os_area_db *db, const char *func, int line) { printf("%s:%d: db.magic_num: '%s'\n", func, line, (const char*)&db->magic_num); printf("%s:%d: db.version: %u\n", func, line, db->version); printf("%s:%d: db.index_64: %u\n", func, line, db->index_64); printf("%s:%d: db.count_64: %u\n", func, line, db->count_64); printf("%s:%d: db.index_32: %u\n", func, line, db->index_32); printf("%s:%d: db.count_32: %u\n", func, line, db->count_32); printf("%s:%d: db.index_16: %u\n", func, line, db->index_16); printf("%s:%d: db.count_16: %u\n", func, line, db->count_16); } ps3-utils-2.3/lib/flash.c000066400000000000000000000235371110270216300152330ustar00rootroot00000000000000/* * PS3 flash memory os area. * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006 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 */ #include #include #include "ps3-flash.h" #if defined(DEBUG) #define DBG(_args...) do {fprintf(stderr, _args);} while(0) #else static inline int __attribute__ ((format (printf, 1, 2))) DBG( __attribute__((unused)) const char *fmt, ...) {return 0;} #endif /** * os_area_header_read - Read the firmware defined header. */ int os_area_header_read(struct os_area_header *h, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = fseek(dev, 0, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_header.\n", __func__, __LINE__); perror(0); return result; } bytes = fread(h, 1, sizeof(struct os_area_header), dev); if (bytes < sizeof(struct os_area_header)) { fprintf(stderr, "%s:%d: read error: os_area_header.\n", __func__, __LINE__); perror(0); return -1; } result = os_area_header_verify(h); if (result) { fprintf(stderr, "%s:%d: invalid os_area_header\n", __func__, __LINE__); return -1; } return 0; } /** * os_area_header_write - Write the firmware defined header. */ int os_area_header_write(const struct os_area_header *h, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = os_area_header_verify(h); if (result) { fprintf(stderr, "%s:%d: invalid os_area_header\n", __func__, __LINE__); return -1; } result = fseek(dev, 0, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_header.\n", __func__, __LINE__); perror(0); return result; } bytes = fwrite(h, 1, sizeof(struct os_area_header), dev); if (bytes < sizeof(struct os_area_header)) { fprintf(stderr, "%s:%d: fwrite error: os_area_header.\n", __func__, __LINE__); perror(0); return -1; } return 0; } /** * os_area_params_read - Read the firmware defined params. */ int os_area_params_read(struct os_area_params *p, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = fseek(dev, OS_AREA_SEGMENT_SIZE, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_params.\n", __func__, __LINE__); perror(0); return result; } bytes = fread(p, 1, sizeof(struct os_area_params), dev); if (bytes < sizeof(struct os_area_params)) { fprintf(stderr, "%s:%d: read error: os_area_params.\n", __func__, __LINE__); perror(0); return -1; } return 0; } /** * os_area_params_write - Write the firmware defined params. */ int os_area_params_write(const struct os_area_params *p, FILE *dev) { int result; size_t bytes; if (!dev) { DBG("%s:%d: bad stream\n", __func__, __LINE__); return -1; } result = fseek(dev, OS_AREA_SEGMENT_SIZE, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: os_area_params.\n", __func__, __LINE__); perror(0); return result; } bytes = fwrite(p, 1, sizeof(struct os_area_params), dev); if (bytes < sizeof(struct os_area_params)) { fprintf(stderr, "%s:%d: fwrite error: os_area_params.\n", __func__, __LINE__); perror(0); return -1; } return 0; } /** * os_area_image_write - Write the other os boot image. */ int os_area_image_write(FILE *image, struct os_area_header *h, FILE *dev) { int result; long flash_size; size_t image_size; size_t bytes; void* buf; result = fseek(dev, 0, SEEK_END); if (result) { fprintf(stderr, "%s:%d: fseek failed\n", __func__, __LINE__); perror(0); return -1; } flash_size = ftell(dev) - h->ldr_area_offset * OS_AREA_SEGMENT_SIZE; DBG("%s:%d: flash_size %lxh\n", __func__, __LINE__, flash_size); buf = malloc(flash_size); if (!buf) { fprintf(stderr, "%s:%d: malloc failed\n", __func__, __LINE__); perror(0); return -1; } image_size = fread(buf, 1, flash_size, image); DBG("%s:%d: image_size %xh\n", __func__, __LINE__, (unsigned int)image_size); if ((long)image_size > flash_size) { fprintf(stderr, "%s:%d: image-file too big.\n", __func__, __LINE__); perror(0); return -1; } result = fseek(dev, h->ldr_area_offset * OS_AREA_SEGMENT_SIZE, SEEK_SET); if (result) { fprintf(stderr, "%s:%d: seek error: ldr_area_offset.\n", __func__, __LINE__); perror(0); return -1; } bytes = fwrite(buf, 1, image_size, dev); if (bytes < image_size) { fprintf(stderr, "%s:%d: fwrite error: image-file.\n", __func__, __LINE__); perror(0); return -1; } result = os_area_set_ldr_size(h, dev, image_size); if (result) { fprintf(stderr, "%s:%d: os_area_set_ldr_size failed.\n", __func__, __LINE__); perror(0); return -1; } fprintf(stderr, "wrote image to flash (%xh bytes).\n", (unsigned int)image_size); free(buf); return result; } /** * os_area_header_verify - Verify the firmware defined header. */ int os_area_header_verify(const struct os_area_header *h) { if (memcmp(h->magic_num, "cell_ext_os_area", 16)) { fprintf(stderr, "%s:%d: magic_num failed\n", __func__, __LINE__); return -1; } if (h->hdr_version < 1) { fprintf(stderr, "%s:%d: hdr_version failed\n", __func__, __LINE__); return -1; } if (h->db_area_offset > h->ldr_area_offset) { fprintf(stderr, "%s:%d: offsets failed\n", __func__, __LINE__); return -1; } return 0; } /** * os_area_set_ldr_format - Set the data format of the other os boot image. * @value: Specifies the format of the os boot image, one of enum ldr_format. */ int os_area_set_ldr_format(struct os_area_header *h, FILE *dev, enum os_area_ldr_format value) { int result; DBG("%s:%d: %u(%xh) -> %u(%xh)\n", __func__, __LINE__, (unsigned int)h->ldr_format, (unsigned int)h->ldr_format, value, value); if (h->ldr_format == (uint32_t)value) return 0; h->ldr_format = (uint32_t)value ? HEADER_LDR_FORMAT_GZIP : HEADER_LDR_FORMAT_RAW; /* for now just flatten to gzip */ os_area_header_write(h, dev); result = os_area_header_read(h, dev); if (result) fprintf(stderr, "%s:%d: os_area_set_ldr_format failed.\n", __func__, __LINE__); return result; } /** * os_area_set_ldr_size - Set the size in bytes of the other os boot image. * @value: Size in bytes. */ int os_area_set_ldr_size(struct os_area_header *h, FILE *dev, unsigned int value) { int result; DBG("%s:%d: %u(%xh) -> %u(%xh)\n", __func__, __LINE__, (unsigned int)h->ldr_size, (unsigned int)h->ldr_size, value, value); if (h->ldr_size == (uint32_t)value) return 0; h->ldr_size = (uint32_t)value; os_area_header_write(h, dev); result = os_area_header_read(h, dev); if (result) fprintf(stderr, "%s:%d: os_area_set_ldr_format failed.\n", __func__, __LINE__); return result; } /** * os_area_set_boot_flag - Set the system boot flag. * @value: Boot flag value, one of enum os_area_boot_flag. */ int os_area_set_boot_flag(struct os_area_params *p, FILE *dev, enum os_area_boot_flag value) { int result; DBG("%s:%d: %u(%xh) -> %u(%xh)\n", __func__, __LINE__, (unsigned int)p->boot_flag, (unsigned int)p->boot_flag, value, value); if (p->boot_flag == (uint32_t)value) return 0; p->boot_flag = (uint32_t)value ? PARAM_BOOT_FLAG_OTHER_OS : PARAM_BOOT_FLAG_GAME_OS; /* for now just flatten to otheros */ os_area_params_write(p, dev); result = os_area_params_read(p, dev); if (result) fprintf(stderr, "%s:%d: os_area_set_boot_flag failed.\n", __func__, __LINE__); return result; } void os_area_header_dump(const struct os_area_header *h, const char *func, int line) { printf("%s:%d: h.magic_num: '%s'\n", func, line, h->magic_num); printf("%s:%d: h.hdr_version: %u\n", func, line, h->hdr_version); printf("%s:%d: h.db_area_offset: %u\n", func, line, h->db_area_offset); printf("%s:%d: h.ldr_area_offset: %u\n", func, line, h->ldr_area_offset); printf("%s:%d: h.ldr_format: %u (%s)\n", func, line, h->ldr_format, (h->ldr_format ? "gzip" : "raw")); printf("%s:%d: h.ldr_size: %u (%xh)\n", func, line, h->ldr_size, h->ldr_size); } void os_area_params_dump(const struct os_area_params *p, const char *func, int line) { printf("%s:%d: p.boot_flag: %u (%s)\n", func, line, p->boot_flag, (p->boot_flag ? "other-os" : "game-os")); printf("%s:%d: p.num_params: %u\n", func, line, p->num_params); printf("%s:%d: p.rtc_diff %lld\n", func, line, (long long)p->rtc_diff); printf("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out); printf("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button); printf("%s:%d: p.static_ip_addr: %u.%u.%u.%u\n", func, line, p->static_ip_addr[0], p->static_ip_addr[1], p->static_ip_addr[2], p->static_ip_addr[3]); printf("%s:%d: p.network_mask: %u.%u.%u.%u\n", func, line, p->network_mask[0], p->network_mask[1], p->network_mask[2], p->network_mask[3]); printf("%s:%d: p.default_gateway: %u.%u.%u.%u\n", func, line, p->default_gateway[0], p->default_gateway[1], p->default_gateway[2], p->default_gateway[3]); printf("%s:%d: p.dns_primary: %u.%u.%u.%u\n", func, line, p->dns_primary[0], p->dns_primary[1], p->dns_primary[2], p->dns_primary[3]); printf("%s:%d: p.dns_secondary: %u.%u.%u.%u\n", func, line, p->dns_secondary[0], p->dns_secondary[1], p->dns_secondary[2], p->dns_secondary[3]); } ps3-utils-2.3/lib/ps3-av.h000066400000000000000000000045101110270216300152420ustar00rootroot00000000000000/* * PS3 AV settings. * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006 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 * * As a special exception, you may use this file as part of a free software * library without restriction. Specifically, if other files instantiate * templates or use macros or inline functions from this file, or you compile * this file and link it with other files to produce an executable, this * file does not by itself cause the resulting executable to be covered by * the GNU General Public License. This exception does not however * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. */ #if !defined(_B9AAF29B_E200_4804_82F1_A8EAC824F1F5_H) #define _B9AAF29B_E200_4804_82F1_A8EAC824F1F5_H #if defined(HAVE_ASM_PS3AV_H) #include #endif #if !defined(HAVE_DECL_PS3AV_MODE_MASK) || !HAVE_DECL_PS3AV_MODE_MASK #define PS3AV_MODE_MASK 0x000F #endif #if !defined(HAVE_DECL_PS3AV_MODE_RGB) || !HAVE_DECL_PS3AV_MODE_RGB #define PS3AV_MODE_RGB 0x0020 #endif #if !defined(HAVE_DECL_PS3AV_MODE_FULL) || !HAVE_DECL_PS3AV_MODE_FULL #define PS3AV_MODE_FULL 0x0080 #endif #if !defined(HAVE_DECL_PS3AV_MODE_WHITE) || !HAVE_DECL_PS3AV_MODE_WHITE #define PS3AV_MODE_WHITE 0x0200 #endif #if !defined(HAVE_DECL_PS3AV_MODE_COLOR) || !HAVE_DECL_PS3AV_MODE_COLOR #define PS3AV_MODE_COLOR 0x0400 #endif #if !defined(HAVE_DECL_PS3AV_MODE_DITHER) || !HAVE_DECL_PS3AV_MODE_DITHER #define PS3AV_MODE_DITHER 0x0800 #endif #if !defined(HAVE_DECL_PS3AV_MODE_HDCP_OFF) || !HAVE_DECL_PS3AV_MODE_HDCP_OFF #define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 doesn't support this */ #endif #endif ps3-utils-2.3/lib/ps3-flash.h000066400000000000000000000200101110270216300157220ustar00rootroot00000000000000/* * PS3 flash memory os area. * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006 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 * * As a special exception, you may use this file as part of a free software * library without restriction. Specifically, if other files instantiate * templates or use macros or inline functions from this file, or you compile * this file and link it with other files to produce an executable, this * file does not by itself cause the resulting executable to be covered by * the GNU General Public License. This exception does not however * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. */ #if !defined(_C5A0A0BE_F815_48A6_BBE0_F553923CEFEE_H) #define _C5A0A0BE_F815_48A6_BBE0_F553923CEFEE_H #include #include enum { OS_AREA_SEGMENT_SIZE = 0X200, }; enum os_area_ldr_format { HEADER_LDR_FORMAT_RAW = 0, HEADER_LDR_FORMAT_GZIP = 1, }; /** * struct os_area_header - os area header segment. * @magic_num: Always 'cell_ext_os_area'. * @hdr_version: Header format version number. * @db_area_offset: Starting segment number of other os database area. * @ldr_area_offset: Starting segment number of bootloader image area. * @ldr_format: HEADER_LDR_FORMAT flag. * @ldr_size: Size of bootloader image in bytes. * * Note that the docs refer to area offsets. These are offsets in units of * segments from the start of the os area (top of the header). These are * better thought of as segment numbers. The os area of the os area is * reserved for the os image. */ struct os_area_header { uint8_t magic_num[16]; uint32_t hdr_version; uint32_t db_area_offset; uint32_t ldr_area_offset; uint32_t _reserved_1; uint32_t ldr_format; uint32_t ldr_size; uint32_t _reserved_2[6]; }; enum os_area_boot_flag { PARAM_BOOT_FLAG_GAME_OS = 0, PARAM_BOOT_FLAG_OTHER_OS = 1, }; enum { PARAM_CTRL_BUTTON_O_IS_YES = 0, PARAM_CTRL_BUTTON_X_IS_YES = 1, }; /** * struct os_area_params - os area params segment. * @boot_flag: User preference of operating system, PARAM_BOOT_FLAG flag. * @num_params: Number of params in this (params) segment. * @rtc_diff: Difference in seconds between game os wall time and the ps3 rtc value. * @av_multi_out: User preference of AV output, PARAM_AV_MULTI_OUT flag. * @ctrl_button: User preference of controller button config, PARAM_CTRL_BUTTON * flag. * @static_ip_addr: User preference of static IP address. * @network_mask: User preference of static network mask. * @default_gateway: User preference of static default gateway. * @dns_primary: User preference of static primary dns server. * @dns_secondary: User preference of static secondary dns server. * * User preference of zero for static_ip_addr means use dhcp. */ struct os_area_params { uint32_t boot_flag; uint32_t _reserved_1[3]; uint32_t num_params; uint32_t _reserved_2[3]; /* param 0 */ int64_t rtc_diff; uint8_t av_multi_out; uint8_t ctrl_button; uint8_t _reserved_3[6]; /* param 1 */ uint8_t static_ip_addr[4]; uint8_t network_mask[4]; uint8_t default_gateway[4]; uint8_t _reserved_4[4]; /* param 2 */ uint8_t dns_primary[4]; uint8_t dns_secondary[4]; uint8_t _reserved_5[8]; }; #if defined(__cplusplus) extern "C" { #endif int os_area_header_read(struct os_area_header *h, FILE *dev); int os_area_header_write(const struct os_area_header *h, FILE *dev); int os_area_params_read(struct os_area_params *p, FILE *dev); int os_area_params_write(const struct os_area_params *p, FILE *dev); int os_area_image_write(FILE *image, struct os_area_header *h, FILE *dev); int os_area_header_verify(const struct os_area_header *h); static inline int os_area_fixed_read(struct os_area_header *h, struct os_area_params *p, FILE *dev) { int result = os_area_header_read(h, dev); return result ? result : os_area_params_read(p, dev); } int os_area_set_ldr_format(struct os_area_header *h, FILE *dev, enum os_area_ldr_format value); int os_area_set_ldr_size(struct os_area_header *h, FILE *dev, unsigned int value); int os_area_set_boot_flag(struct os_area_params *p, FILE *dev, enum os_area_boot_flag value); #define os_area_header_debug_dump(_a) os_area_header_dump(_a, __func__, \ __LINE__) void os_area_header_dump(const struct os_area_header *h, const char *func, int line); #define os_area_params_debug_dump(_a) os_area_params_dump(_a, __func__, \ __LINE__) void os_area_params_dump(const struct os_area_params *p, const char *func, int line); #if defined(__cplusplus) } #endif /* flash db routines */ /** * struct os_area_db - Shared flash memory database. * @magic_num: Always '-db-' = 0x2d64622d. * @version: os_area_db format version number. * @index_64: byte offset of the database id index for 64 bit variables. * @count_64: number of usable 64 bit index entries * @index_32: byte offset of the database id index for 32 bit variables. * @count_32: number of usable 32 bit index entries * @index_16: byte offset of the database id index for 16 bit variables. * @count_16: number of usable 16 bit index entries * * Flash rom storage for exclusive use by guests running in the other os lpar. * The current system configuration allocates 1K (two segments) for other os * use. */ struct os_area_db { uint32_t magic_num; uint16_t version; uint16_t _reserved_1; uint16_t index_64; uint16_t count_64; uint16_t index_32; uint16_t count_32; uint16_t index_16; uint16_t count_16; uint32_t _reserved_2; uint8_t _reserved_3[1000]; }; /** * enum os_area_db_owner - Data owners. */ enum os_area_db_owner { OS_AREA_DB_OWNER_ANY = -1, OS_AREA_DB_OWNER_NONE = 0, OS_AREA_DB_OWNER_PROTOTYPE = 1, OS_AREA_DB_OWNER_LINUX = 2, OS_AREA_DB_OWNER_PETITBOOT = 3, OS_AREA_DB_OWNER_MAX = 32, }; enum os_area_db_key { OS_AREA_DB_KEY_ANY = -1, OS_AREA_DB_KEY_NONE = 0, OS_AREA_DB_KEY_RTC_DIFF = 1, OS_AREA_DB_KEY_VIDEO_MODE = 2, OS_AREA_DB_KEY_MAX = 8, }; struct os_area_db_id { int owner; int key; }; static const struct os_area_db_id os_area_db_empty_id = {OS_AREA_DB_OWNER_NONE, OS_AREA_DB_KEY_NONE}; static const struct os_area_db_id os_area_db_any_id = {OS_AREA_DB_OWNER_ANY, OS_AREA_DB_KEY_ANY}; #if defined(__cplusplus) extern "C" { #endif int os_area_db_read(struct os_area_db *db, const struct os_area_header *h, FILE *dev); int os_area_db_write(const struct os_area_db *db, const struct os_area_header *h, FILE *dev); void os_area_db_init(struct os_area_db *db); int os_area_db_verify(const struct os_area_db *db); int os_area_db_get(const struct os_area_db *db, const struct os_area_db_id *id, uint64_t *value); int os_area_db_remove(struct os_area_db *db, const struct os_area_db_id *id); int os_area_db_set_64(struct os_area_db *db, const struct os_area_db_id *id, uint64_t value); int os_area_db_set_32(struct os_area_db *db, const struct os_area_db_id *id, uint32_t value); int os_area_db_set_16(struct os_area_db *db, const struct os_area_db_id *id, uint16_t value); void os_area_db_print(const struct os_area_db *db, const struct os_area_db_id *id, int verbose); int os_area_db_format(struct os_area_db *db, const struct os_area_header *h, FILE *dev); int os_area_db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff); int os_area_db_get_video_mode(const struct os_area_db *db, unsigned int *video_mode); int os_area_db_list_owners(char *buf, unsigned int size); void os_area_db_dump_header(const struct os_area_db *db, const char *func, int line); #if defined(__cplusplus) } #endif #endif ps3-utils-2.3/ps3-boot-game-os.8.in000066400000000000000000000036351110270216300167130ustar00rootroot00000000000000.\" PS3 boot game-os utility .\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-boot-game-os.8'. .\" * To check format use this: 'less ps3-boot-game-os.8'. .\" .Dd "" .Dt ps3-boot-game-os 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-boot-game-os .Nd PS3 boot Game OS utility .\" .Sh SYNOPSIS .\" ======== .Nm .Op Fl n, -no-reboot | Fl p, -poweroff .Op Fl h, -help .Op Fl V, -version .\" .Sh DESCRIPTION .\" =========== The ps3-boot-game-os utility will set the system boot flag to Game OS and reboot the system. The system will reboot into the Game OS. .\" .Sh OPTIONS .\" ======= .Bl -tag -width indent .\" .It Fl n, -no-reboot Don't reboot the system after setting the boot flag. .\" .It Fl p, -poweroff Power the system off after setting the boot flag. .\" .It Fl h, -help Print a help message. .\" .It Fl V, -version Display the program version number. .El .Sh SEE ALSO .\" ======== .Xr ps3-flash-util 8 .\" .Sh AUTHOR .\" ====== Written by Masato Noguchi and Geoff Levand. .\" .Sh REPORTING BUGS .\" ============== Send bug reports to @PACKAGE_BUGREPORT@.ps3-utils-2.3/ps3-boot-game-os.in000066400000000000000000000040661110270216300165440ustar00rootroot00000000000000#!/bin/sh # # Set the PS3 boot flag and reboot to game OS. # # Copyright (C) 2006 Sony Computer Entertainment Inc. # Copyright 2006 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 "ps3-boot-game-os (@PACKAGE_NAME@) @PACKAGE_VERSION@" >&2 echo "DESCRIPTION" >&2 echo " The ps3-boot-game-os utility will set the system boot flag to Game OS and" >&2 echo " reboot the system. The system will reboot into the Game OS." >&2 echo "OPTIONS" >&2 echo " -n, --no-reboot" >&2 echo " Don't reboot system after setting boot flag." >&2 echo " -p, --poweroff" >&2 echo " Poweroff system after setting boot flag." >&2 echo " -h, --help" >&2 echo " Print a help message." >&2 echo " -V, -version" >&2 echo " Display the program version number." >&2 echo "SEE ALSO" >&2 echo " ps3-flash-util(8)" >&2 echo "Send bug reports to @PACKAGE_BUGREPORT@" >&2 exit 1 } version() { echo "ps3-boot-game-os (@PACKAGE_NAME@) @PACKAGE_VERSION@" exit 1 } cmd="reboot" while [ "$#" -gt 0 ]; do case "$1" in -n | --no-reboot) cmd="no-reboot" ;; -p | --poweroff) cmd="poweroff" ;; --version | -V) version ;; *) usage ;; esac shift done if ! @prefix@/sbin/ps3-flash-util -g ; then echo "ERROR: can't change boot flag" >&2; exit 1; fi echo $cmd 2>&1; if [ $cmd = "poweroff" ]; then poweroff elif [ $cmd = "no-reboot" ]; then exit 0 else reboot fi ps3-utils-2.3/ps3-dump-bootloader.8.in000066400000000000000000000034611110270216300175140ustar00rootroot00000000000000.\" PS3 dump bootloader utility .\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-dump-bootloader.8'. .\" * To check format use this: 'less ps3-dump-bootloader.8'. .\" .Dd "" .Dt ps3-dump-bootloader 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-dump-bootloader .Nd PS3 dump bootloader utility .\" .Sh SYNOPSIS .\" ======== .Nm .Op Fl s, -sum .Op Fl h, -help .Op Fl V, -version .\" .Sh DESCRIPTION .\" =========== The ps3-dump-bootloader utility will dump the Other OS binary image from PS3 flash memory to stdout. .\" .Sh OPTIONS .\" ======= .Bl -tag -width indent .\" .It Fl s, -sum Compute the md5sum of the Other OS image and only print it to stdout. .\" .It Fl h, -help Print a help message. .\" .It Fl V, -version Display the program version number. .El .Sh SEE ALSO .\" ======== .Xr ps3-flash-util 8 , Xr md5sum 1 .\" .Sh AUTHOR .\" ====== Written by Geoff Levand. .\" .Sh REPORTING BUGS .\" ============== Send bug reports to @PACKAGE_BUGREPORT@.ps3-utils-2.3/ps3-dump-bootloader.in000066400000000000000000000043321110270216300173440ustar00rootroot00000000000000#!/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 "ps3-dump-bootloader (@PACKAGE_NAME@) @PACKAGE_VERSION@" >&2 echo "DESCRIPTION" >&2 echo " The ps3-dump-bootloader utility will dump the Other OS binary image from" >&2 echo " PS3 flash memory to stdout." >&2 echo "OPTIONS" >&2 echo " -s, --sum" >&2 echo " Compute the md5sum of the Other OS image and only print it to" >&2 echo " stdout." >&2 echo " -h, --help" >&2 echo " Print a help message." >&2 echo " -V, -version" >&2 echo " Display the program version number." >&2 echo "SEE ALSO" >&2 echo " ps3-flash-util(8), md5sum(1)" >&2 echo "Send bug reports to @PACKAGE_BUGREPORT@" >&2 exit 1 } version() { echo "ps3-dump-bootloader (@PACKAGE_NAME@) @PACKAGE_VERSION@" exit 1 } sum= while [ "$#" -gt 0 ]; do case "$1" in --sum | -s) sum="y" ;; --version | -V) version ;; *) usage ;; esac shift done ldr_size=`@prefix@/sbin/ps3-flash-util -s \ | grep 'h\.ldr_size' \ | tr -d ' ' | cut -d':' -f4 | cut -d'(' -f1` if [ ! "$ldr_size" ]; then echo "ERROR: can't dump image" >&2; exit 1; fi ldr_offset=`@prefix@/sbin/ps3-flash-util -s \ | grep 'h\.ldr_area_offset' \ | tr -d ' ' | cut -d':' -f4` if [ ! "ldr_offset" ]; then echo "ERROR: can't dump image" >&2; exit 1; fi let ldr_offset=512*ldr_offset if [ "$sum" ]; then dd if=/dev/ps3flash bs=1 skip=$ldr_offset count=$ldr_size | md5sum else dd if=/dev/ps3flash bs=1 skip=$ldr_offset count=$ldr_size fi ps3-utils-2.3/ps3-flash-util.8.in000066400000000000000000000104311110270216300164620ustar00rootroot00000000000000.\" PS3 flash memory utility .\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-flash-util.8'. .\" * To check format use this: 'less ps3-flash-util.8'. .\" .Dd "" .Dt ps3-flash-util 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-flash-util .Nd PS3 flash memory utility .\" .Sh SYNOPSIS .\" ======== .Nm .Op Fl d, -device Ar flash-dev .Op Fl s, -show-settings .Op Fl w, -write-image Ar image-file .Op Fl g, -set-game-os | Fl o, -set-other-os .Op Fl r, -set-raw | Fl z, -set-gzip .Op Fl t, -game-time .Op Fl T, -db-test .Op Fl F, -db-format .Op Fl P, -db-print Ar owner Ar key .Op Fl D, -db-write-dword Ar owner Ar key Ar dword .Op Fl W, -db-write-word Ar owner Ar key Ar word .Op Fl H, -db-write-half Ar owner Ar key Ar half .Op Fl R, -db-remove Ar owner Ar key .Op Fl L, -db-list-known .Op Fl h, -help .Op Fl v, -verbose .Op Fl V, -version .\" .Sh DESCRIPTION .\" =========== The ps3-flash-util utility is used to operate on the system flash ROM of the PS3 game console. .\" .Sh OPTIONS .\" ======= .Bl -tag -width indent .\" .It Fl d, -device Ar flash-dev Use the flash device node .Ar flash-dev (default=/dev/ps3flash). .\" .It Fl s, -show-settings Show the current flash settings (non-destructive). .\" .It Fl w, -write-image Ar image-file Write the Other OS image .Ar image-file to flash memory and update the OS area header with information for the new image. This is the option to use to write a new bootloader image to flash memory. Use '-' for data on stdin. .\" .It Fl g, -set-game-os Set the system boot flag to Game OS. .\" .It Fl o, -set-other-os Set the system boot flag to Other OS. .\" .It Fl r, -set-raw Set the Other OS image compression flag to raw (not compressed). .\" .It Fl z, -set-gzip Set the Other OS image compression flag to gzip compressed. .\" .It Fl t, -game-time Print the Game OS RTC diff value. .\" .It Fl T, -db-test Test for the existence of an Other OS database in flash memory. Exits with a zero status if a database is found. .\" .It Fl F, -db-format Format (write) an empty Other OS database to flash memory. Any existing data in the flash memory will be lost. .\" .It Fl P, -db-print Ar owner Ar key Print owner:key database entries. A negative one (-1) value for owner or key can be used as a wildcard to match any owner or key. .\" .It Fl D, -db-write-dword Ar owner Ar key Ar dword Add or update a 64 bit owner:key database entry. The .Ar dword argument supports input matching the scanf "%Li" format specification. .\" .It Fl W, -db-write-word Ar owner Ar key Ar word Add or update a 32 bit owner:key database entry. The .Ar word argument supports input matching the scanf "%Li" format specification. .\" .It Fl H, -db-write-half Ar owner Ar key Ar half Add or update a 16 bit owner:key database entry. The .Ar half argument supports input matching the scanf "%Li" format specification. .\" .It Fl R, -db-remove Ar owner Ar key Remove an owner:key entry from the database. A negative one (-1) value for owner or key can be used as a wildcard to match any owner or key. .\" .It Fl L, -db-list-known List known database owners and keys. .\" .It Fl h, -help Print a help message. .\" .It Fl v, -verbose Program verbosity level. The level is additive. .\" .It Fl V, -version Display the program version number. .El .Sh SEE ALSO .\" ======== .Xr ps3-boot-game-os 8 , Xr ps3-dump-bootloader 8 .\" .Sh AUTHOR .\" ====== Written by Masato Noguchi and Geoff Levand. .\" .Sh REPORTING BUGS .\" ============== Send bug reports to @PACKAGE_BUGREPORT@.ps3-utils-2.3/ps3-flash-util.c000066400000000000000000000421661110270216300161420ustar00rootroot00000000000000/* * PS3 flash memory utility. * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006 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 */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include #include #include "ps3-flash.h" #define PS3_UTILS_APP_NAME "ps3-flash-util" #if defined(PACKAGE_VERSION) && defined(PACKAGE_NAME) #define PS3_UTILS_VERSION PS3_UTILS_APP_NAME " (" PACKAGE_NAME ") " PACKAGE_VERSION "\n" #else #define PS3_UTILS_VERSION "" #endif #if defined(PACKAGE_BUGREPORT) #define PS3_UTILS_BUGREPORT "Send bug reports to " PACKAGE_BUGREPORT "\n" #else #define PS3_UTILS_BUGREPORT "" #endif #if defined(DEBUG) #define DBG(_args...) do {fprintf(stderr, _args);} while(0) #else static inline int __attribute__ ((format (printf, 1, 2))) DBG( __attribute__((unused)) const char *fmt, ...) {return 0;} #endif static const char flash_dev[] = "/dev/ps3flash"; /** * enum db_op_type - Types of database operations. */ enum db_op_type { op_undef = 0, op_print, op_remove, op_set_16, op_set_32, op_set_64 }; /** * struct db_op_entry - A database operations list entry. */ struct db_op_entry { enum db_op_type type; struct os_area_db_id id; int64_t value; struct db_op_entry *next; }; /** * struct db_op_entry - Add an entry into a database operations list. */ static int db_opt_add(struct db_op_entry** list, const struct db_op_entry *e) { struct db_op_entry *p; DBG("%s:%d: (%d:%d) = %llu (%llxh)\n", __func__, __LINE__, (unsigned int)e->id.owner, (unsigned int)e->id.key, (unsigned long long)e->value, (unsigned long long)e->value); if (!*list) { /* init list */ *list = malloc(sizeof(struct db_op_entry)); p = *list; } else { /* add to list */ p = *list; while(p->next) p = p->next; p->next = malloc(sizeof(struct db_op_entry)); p = p->next; } *p = *e; p->next = 0; return 0; } static void print_version(void) { printf(PS3_UTILS_VERSION); } static void print_usage(void) { fprintf(stderr, PS3_UTILS_VERSION); fprintf(stderr, "SYNOPSIS\n" " ps3-flash-util [-d, --device flash-dev] [-s, --show-settings]\n" " [-w, --write-image image-file]\n" " [-g, --set-game-os | -o, --set-other-os]\n" " [-r, --set-raw | -z, --set-gzip] [-t, --game-time]\n" " [-T, --db-test] [-F, --db-format]\n" " [-P, --db-print owner key]\n" " [-D, --db-write-dword owner key dword]\n" " [-W, --db-write-word owner key word]\n" " [-H, --db-write-half owner key half]\n" " [-R, --db-remove owner key] [-L, --db-list-known]\n" " [-h, --help] [-v, --verbose] [-V, --version]\n" "OPTIONS\n" " -d, --device flash-dev\n" " Use the flash device node flash-dev (default=/dev/ps3flash).\n" " -s, --show-settings\n" " Show the current flash settings (non-destructive).\n" " -w, --write-image image-file\n" " Write the Other OS image image-file to flash memory and update\n" " the OS area header with information for the new image. This is\n" " the option to use to write a new bootloader image to flash mem-\n" " ory. Use ’-’ for data on stdin.\n" " -g, --set-game-os\n" " Set the system boot flag to Game OS.\n" " -o, --set-other-os\n" " Set the system boot flag to Other OS.\n" " -r, --set-raw\n" " Set the Other OS image compression flag to raw (not compressed).\n" " -z, --set-gzip\n" " Set the Other OS image compression flag to gzip compressed.\n" " -t, --game-time\n" " Print the Game OS RTC diff value.\n" " -T, --db-test\n" " Test for the existence of an Other OS database in flash memory.\n" " Exits with a zero status if a database is found.\n" " -F, --db-format\n" " Format (write) an empty Other OS database to flash memory. Any\n" " existing data in the flash memory will be lost.\n" " -P, --db-print owner key\n" " Print owner:key database entries. A negative one (-1) value for\n" " owner or key can be used as a wildcard to match any owner or key.\n" " -D, --db-write-dword owner key dword\n" " Add or update a 64 bit owner:key database entry. The dword argu-\n" " ment supports input matching the scanf \"%%Li\" format specifica-\n" " tion.\n" " -W, --db-write-word owner key word\n" " Add or update a 32 bit owner:key database entry. The word argu-\n" " ment supports input matching the scanf \"%%Li\" format specifica-\n" " tion.\n" " -H, --db-write-half owner key half\n" " Add or update a 16 bit owner:key database entry. The half argu-\n" " ment supports input matching the scanf \"%%Li\" format specifica-\n" " tion.\n" " -R, --db-remove owner key\n" " Remove an owner:key entry from the database. A negative one (-1)\n" " value for owner or key can be used as a wildcard to match any\n" " owner or key.\n" " -L, --db-list-known\n" " List known database owners and keys.\n" " -h, --help\n" " Print a help message.\n" " -v, --verbose\n" " Program verbosity level. The level is additive.\n" " -V, --version\n" " Display the program version number.\n\n" "See the ps3-flash-util man page for more detailed information.\n" ); fprintf(stderr, PS3_UTILS_BUGREPORT); } static const struct option long_options[] = { {"device", required_argument, NULL, 'd'}, {"show-settings", no_argument, NULL, 's'}, {"write-image", required_argument, NULL, 'w'}, {"set-game-os", no_argument, NULL, 'g'}, {"set-other-os", no_argument, NULL, 'o'}, {"set-raw", no_argument, NULL, 'r'}, {"set-gzip", no_argument, NULL, 'z'}, {"game-time", no_argument, NULL, 't'}, {"db-test", no_argument, NULL, 'T'}, {"db-format", no_argument, NULL, 'F'}, {"db-print", required_argument, NULL, 'P'}, {"db-write-dword", required_argument, NULL, 'D'}, {"db-write-word", required_argument, NULL, 'W'}, {"db-write-half", required_argument, NULL, 'H'}, {"db-remove", required_argument, NULL, 'R'}, {"db-list-known", no_argument, NULL, 'L'}, {"help", no_argument, NULL, 'h'}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, { NULL, 0, NULL, 0}, }; static const char short_options[] = "d:sw:gorztTFP:D:W:H:R:LhvV"; /** * enum opt_value - Tri-state options variables. */ enum opt_value {opt_undef = 0, opt_yes, opt_no}; /** * struct opts - User specified options. */ struct opts { unsigned int verbosity; unsigned int show_version; unsigned int show_help; unsigned int show_settings; unsigned int show_game_time; unsigned int boot_other_os; unsigned int compressed_image; unsigned int db_test; unsigned int db_format; unsigned int db_list_owners; struct db_op_entry* db_op_list; const char *device; const char *image; }; static void show_settings(const struct os_area_header *h, const struct os_area_params *p, const struct os_area_db *db) { int64_t rtc_diff; printf(PS3_UTILS_VERSION); os_area_header_dump(h, " header ", 1); os_area_params_dump(p, " param ", 2); if (!db) printf(" db :3: not found\n"); else { int result; os_area_db_dump_header(db, " db ", 3); result = os_area_db_get_rtc_diff(db, &rtc_diff); if(!result) printf(" rtc :4: %lld\n", (long long int)rtc_diff); } } static int write_image(FILE *dev, struct os_area_header *h, const char *image) { int result; FILE *img; if (image[0] == '-' && image[1] == '\0') { DBG("%s:%d: read on stdin\n", __func__, __LINE__); img = stdin; } else img = fopen(image, "r"); if (!img) { DBG("%s:%d: fopen failed.\n", __func__, __LINE__); perror(image); return -1; } result = os_area_image_write(img, h, dev); return result; } static void db_list_owners(void) { char s[2048]; os_area_db_list_owners(s, sizeof(s)); printf(PS3_UTILS_VERSION); printf("%s\n", s); } /** * pickup_db_op_entry - Pickup a database option from the command line. */ static int pickup_db_op_entry(char *argv[], enum db_op_type type, unsigned int required, struct db_op_entry** list) { int result; struct db_op_entry e; unsigned long long values[3]; unsigned int i; values[0] = values[1] = values[2] = 0; for (i = 0; i < required; i++) { if (!argv[i + 1]) { if (required > i) { fprintf(stderr, "missing option: -%c at '%s'\n", argv[0][1], argv[i + 1]); return -1; } break; } result = sscanf(argv[i + 1], "%Li", &values[i]); if (result != 1) { fprintf(stderr, "bad option: -%c at '%s'\n", argv[0][1], argv[i + 1]); return -1; } DBG("%s:%d: (%u) found '%s' => %llu (%llxh)\n", __func__, __LINE__, i, argv[i + 1], values[i], values[i]); } if((int)values[0] != OS_AREA_DB_OWNER_ANY && (int)values[0] >= OS_AREA_DB_OWNER_MAX) { fprintf(stderr, "bad owner value: %u\n", (unsigned int)values[0]); return -1; } if((int)values[1] != OS_AREA_DB_KEY_ANY && (int)values[1] >= OS_AREA_DB_KEY_MAX) { fprintf(stderr, "bad key value: %u\n", (unsigned int)values[1]); return -1; } memset(&e, 0, sizeof(struct db_op_entry)); e.type = type; e.id.owner = values[0]; e.id.key = values[1]; e.value = values[2]; db_opt_add(list, &e); return 0; } static int add_db_op_entry(enum db_op_type type, enum os_area_db_owner owner, enum os_area_db_key key, const char *optarg, struct db_op_entry** list) { int result; struct db_op_entry e; memset(&e, 0, sizeof(struct db_op_entry)); e.type = type; e.id.owner = owner; e.id.key = key; result = sscanf(optarg, "%Li", (long long int *)&e.value); if (result != 1) { fprintf(stderr, "bad option: at '%s'\n", optarg); return -1; } db_opt_add(list, &e); return 0; } /** * opts_parse - Parse the command line options. */ static int opts_parse(struct opts* opts, int argc, char *argv[]) { int result; int got_work = 0; memset(opts, 0, sizeof(*opts)); while(1) { int c = getopt_long(argc, argv, short_options, long_options, NULL); if (c == EOF) break; if (0) { DBG("%s:%d: '%c'\n", __func__, __LINE__, (char)c); DBG("%s:%d: optind = %d\n", __func__, __LINE__, optind); DBG("%s:%d: optarg = '%s'\n", __func__, __LINE__, (optarg ? optarg : "")); DBG("%s:%d: argv[optind] = '%s'\n", __func__, __LINE__, argv[optind]); } switch(c) { case 'd': opts->device = optarg; break; case 's': opts->show_settings = opt_yes; got_work++; break; case 'w': opts->image = optarg; got_work++; break; case 'g': opts->boot_other_os = opt_no; got_work++; break; case 'o': opts->boot_other_os = opt_yes; got_work++; break; case 'z': opts->compressed_image = opt_yes; got_work++; break; case 'r': opts->compressed_image = opt_no; got_work++; break; case 't': opts->show_game_time = opt_yes; got_work++; break; case 'T': opts->db_test = opt_yes; got_work++; break; case 'F': opts->db_format = opt_yes; got_work++; break; case 'P': result = pickup_db_op_entry(&argv[optind - 2], op_print, 2, &opts->db_op_list); if (result) { fprintf(stderr, "parse failed: %s\n\n", argv[optind - 2]); return -1; } optind += 1; got_work++; break; case 'D': result = pickup_db_op_entry(&argv[optind - 2], op_set_64, 3, &opts->db_op_list); if (result) { fprintf(stderr, "parse failed: %s\n\n", argv[optind - 2]); return -1; } optind += 2; got_work++; break; case 'W': result = pickup_db_op_entry(&argv[optind - 2], op_set_32, 3, &opts->db_op_list); if (result) { fprintf(stderr, "parse failed: %s\n\n", argv[optind - 2]); return -1; } optind += 2; got_work++; break; case 'H': result = pickup_db_op_entry(&argv[optind - 2], op_set_32, 3, &opts->db_op_list); if (result) { fprintf(stderr, "parse failed: %s\n\n", argv[optind - 2]); return -1; } optind += 2; got_work++; break; case 'R': result = pickup_db_op_entry(&argv[optind - 2], op_remove, 2, &opts->db_op_list); if (result) { fprintf(stderr, "parse failed: %s\n\n", argv[optind - 2]); return -1; } optind += 1; got_work++; break; case 'L': opts->db_list_owners = opt_yes; got_work++; break; case 'h': opts->show_help = opt_yes; got_work++; break; case 'v': opts->verbosity++; break; case 'V': opts->show_version = opt_yes; got_work++; break; default: opts->show_help = opt_yes; return -1; } } if (0) { DBG("%s:%d: argc %d\n", __func__, __LINE__, argc); DBG("%s:%d: optind %d\n", __func__, __LINE__, optind); DBG("%s:%d: got_work %d\n", __func__, __LINE__, got_work); } return !got_work; } static int process_op_list(const struct db_op_entry* db_op_list, struct os_area_db *db, const struct os_area_header *h, FILE *dev, int verbose) { int result = 0; const struct db_op_entry* e; int need_write = 0; for (e = db_op_list; e; e = e->next) { DBG("%s:%d: %p: type %d, (%d:%d) = %llu\n", __func__, __LINE__, e, e->type, e->id.owner, e->id.key, (unsigned long long)e->value); switch(e->type) { case op_print: os_area_db_print(db, &e->id, verbose); break; case op_remove: result = os_area_db_remove(db, &e->id); need_write = !result; break; case op_set_64: result = os_area_db_set_64(db, &e->id, e->value); need_write = !result; break; case op_set_32: result = os_area_db_set_32(db, &e->id, e->value); need_write = !result; break; case op_set_16: result = os_area_db_set_16(db, &e->id, e->value); need_write = !result; break; default: DBG("%s:%d: unknown type %d\n", __func__, __LINE__, e->type); result = -1; break; } if (result) { fprintf(stderr, "%s:%d: process_op_list failed\n", __func__, __LINE__); return -1; } } if (need_write) { os_area_db_write(db, h, dev); result = os_area_db_read(db, h, dev); if (result) fprintf(stderr, "%s:%d: process_op_list failed\n", __func__, __LINE__); } return result; } int main(int argc, char *argv[]) { int result; int found_db; struct opts opts; struct os_area_header header; struct os_area_params params; struct os_area_db db; FILE *dev; result = opts_parse(&opts, argc, argv); if (result) { print_usage(); DBG("%s:%d: failed.\n", __func__, __LINE__); exit(1); } if (opts.show_help) { print_usage(); exit(0); } if (opts.show_version) { print_version(); exit(0); } if (opts.db_list_owners) db_list_owners(); opts.device = opts.device ? opts.device : flash_dev; dev = fopen(opts.device, "r+"); if (!dev) { DBG("%s:%d: fopen failed.\n", __func__, __LINE__); perror(opts.device); exit(1); } result = os_area_fixed_read(&header, ¶ms, dev); if (result) { fprintf(stderr, "%s:%d: os_area_read_hp error.\n", __func__, __LINE__); exit(1); } if (opts.db_format) { result = os_area_db_format(&db, &header, dev); if (result) { fprintf(stderr, "%s:%d: db_format failed.\n", __func__, __LINE__); exit(1); } } if (opts.show_game_time) printf("%lld\n", (long long int)params.rtc_diff); found_db = !os_area_db_read(&db, &header, dev); if (opts.db_test) { printf(PS3_UTILS_VERSION); if (found_db) printf("db found\n"); else printf("db not found\n"); exit(!found_db); } if (opts.show_settings) show_settings(&header, ¶ms, found_db ? &db : NULL); if (opts.image) { result = write_image(dev, &header, opts.image); if (result) { fprintf(stderr, "%s:%d: write_image failed: '%s'\n", __func__, __LINE__, opts.image); exit(1); } } if (opts.compressed_image) { result = os_area_set_ldr_format(&header, dev, opts.compressed_image == opt_yes); if (result) { fprintf(stderr, "%s:%d: set_compress_flag failed.\n", __func__, __LINE__); exit(1); } } if (opts.boot_other_os) { result = os_area_set_boot_flag(¶ms, dev, opts.boot_other_os == opt_yes); if (result) { fprintf(stderr, "%s:%d: set_boot_flag failed.\n", __func__, __LINE__); exit(1); } } if (opts.db_op_list) { result = process_op_list(opts.db_op_list, &db, &header, dev, opts.verbosity); if (result) { fprintf(stderr, "%s:%d: process_op_list failed.\n", __func__, __LINE__); exit(1); } } return 0; } ps3-utils-2.3/ps3-rtc-init.8.in000066400000000000000000000035251110270216300161510ustar00rootroot00000000000000.\" PS3 flash memory utility .\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-rtc-init.8'. .\" * To check format use this: 'less ps3-rtc-init.8'. .\" .Dd "" .Dt ps3-rtc-init 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-rtc-init .Nd PS3 RTC init utility .\" .Sh SYNOPSIS .\" ======== .Nm .Op Fl f, -force .Op Fl h, -help .Op Fl V, -version .\" .Sh DESCRIPTION .\" =========== The ps3-rtc-init utility is used to initialize the Linux RTC diff value in PS3 flash memory to that currently in use by the Game OS. The default behavior is to not overwrite an existing value. .\" .Sh OPTIONS .\" ======= .Bl -tag -width indent .\" .It Fl f, -force Overwrite any existing Linux RTC diff value in flash memory. .\" .It Fl h, -help Print a help message. .\" .It Fl V, -version Display the program version number. .El .Sh SEE ALSO .\" ======== .Xr ps3-flash-util 8 .\" .Sh AUTHOR .\" ====== Written by Geoff Levand. .\" .Sh REPORTING BUGS .\" ============== Send bug reports to @PACKAGE_BUGREPORT@.ps3-utils-2.3/ps3-rtc-init.in000066400000000000000000000052631110270216300160040ustar00rootroot00000000000000#!/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 "ps3-init-rtc (@PACKAGE_NAME@) @PACKAGE_VERSION@" >&2 echo "DESCRIPTION" >&2 echo " The ps3-rtc-init utility is used to initialize the Linux RTC diff value" >&2 echo " in PS3 flash memory to that currently in use by the Game OS. The default" >&2 echo " behavior is to not overwrite an existing value." >&2 echo "OPTIONS" >&2 echo " -f, --force" >&2 echo " Overwrite any existing Linux RTC diff value in flash memory." >&2 echo " -h, --help" >&2 echo " Print a help message." >&2 echo " -V, -version" >&2 echo " Display the program version number." >&2 echo "SEE ALSO" >&2 echo " ps3-flash-util(8)" >&2 echo "Send bug reports to @PACKAGE_BUGREPORT@" >&2 exit 1 } version() { echo "ps3-init-rtc (@PACKAGE_NAME@) @PACKAGE_VERSION@" exit 1 } force= while [ "$#" -gt 0 ]; do case "$1" in --force | -f) force="y" ;; --version | -V) version ;; *) usage ;; esac shift done game_time=`@prefix@/sbin/ps3-flash-util --game-time` if [ $? -ne 0 ]; then echo "ERROR: Can't read game-time." >&2; exit 1; fi if [ "${force}" ]; then @prefix@/sbin/ps3-flash-util --db-write-dword 2 1 ${game_time} if [ $? -ne 0 ]; then @prefix@/sbin/ps3-flash-util --db-format if [ $? -ne 0 ]; then echo "ERROR: Can't format flash." >&2; exit 1; fi @prefix@/sbin/ps3-flash-util --db-write-dword 2 1 ${game_time} fi if [ $? -ne 0 ]; then echo "ERROR: Can't set rtc diff." >&2; exit 1; fi else other_time=`@prefix@/sbin/ps3-flash-util --db-print 2 1` if [ $? -ne 0 ]; then echo "ERROR: can't read database. Use -f to re-format." >&2; exit 1; fi if [ ${other_time} ]; then echo "WARNING: rtc diff already set." >&2; exit 1; fi @prefix@/sbin/ps3-flash-util --db-write-dword 2 1 ${game_time} if [ $? -ne 0 ]; then echo "ERROR: can't read database. Use -f to re-format." >&2; exit 1; fi fi echo "rtc diff:${game_time}" exit 0ps3-utils-2.3/ps3-utils.8.in000066400000000000000000000046601110270216300155610ustar00rootroot00000000000000.\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-utils.8'. .\" * To check format use this: 'less ps3-utils.8'. .\" .Dd "" .Dt ps3-utils 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-utils .Nd Utilities for the PS3 game console. .\" .Sh DESCRIPTION .\" =========== The ps3-utils package is a set of system administration utilites for the PS3 game console. .\" .Ss ps3-boot-game-os .\" ---------------- The ps3-boot-game-os utility will set the system boot flag to Game OS and reboot the system. The system will reboot into the Game OS. .\" .Ss ps3-dump-bootloader .\" ------------------- The ps3-dump-bootloader utility will dump the Other OS binary image from PS3 flash memory to stdout. .\" .Ss ps3-flash-util .\" -------------- The ps3-flash-util utility is used to operate on the system flash ROM of the PS3 game console. .\" .Ss ps3-rtc-init .\" ------------ The ps3-rtc-init utility is used to initialize the Linux RTC diff value in PS3 flash memory to that currently in use by the Game OS. The default behavior is to not overwrite an existing value. .\" .Ss ps3-video-mode .\" -------------- The ps3-video-mode utility is used to display or change the video mode of the PS3 game console. The default behavior is to display the current video mode ID. .\" .Sh SEE ALSO .\" ======== .Xr ps3-boot-game-os 8 , Xr ps3-dump-bootloader 8 , Xr ps3-flash-util 8 , Xr ps3-rtc-init 8 , Xr ps3-video-mode 8 .\" .Sh AUTHOR .\" ====== The ps3-utils were written by Masato Noguchi, Masashi Kimoto and Geoff Levand. .\" .Sh REPORTING BUGS .\" ============== Send bug reports to @PACKAGE_BUGREPORT@. ps3-utils-2.3/ps3-video-mode.8.in000066400000000000000000000141321110270216300164440ustar00rootroot00000000000000.\" PS3 video mode utility. .\" .\" 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 .\" .\" Maintainer's Notes: .\" * For syntax help see the man pages for 'mdoc' and 'mdoc.samples'. .\" * To check syntax use this: .\" 'groff -C -mtty-char -Tutf8 -man ps3-video-mode.8'. .\" * To check format use this: 'less ps3-video-mode.8'. .\" .Dd "" .Dt ps3-video-mode 8 .Os .\" .Sh NAME .\" ==== .Nm ps3-video-mode .Nd PS3 video mode utility .\" .Sh SYNOPSIS .\" ======== .Nm .Op Fl m, -mode Ar mode-id .Op Fl r, -rgb .Op Fl f, -full-screen .Op Fl g, -full-range .Op Fl d, -dither .Op Fl h, -help .Op Fl V, -version .\" .Sh DESCRIPTION .\" =========== The ps3-video-mode utility is used to display or change the video mode of the PS3 game console. The default behavior is to display the current video mode ID. .\" .Sh OPTIONS .\" ======= .Bl -tag -width indent .\" .It Fl m, -mode Ar mode-id Set the system video mode to .Ar mode-id . See the .Ar NOTES section below for more information on the .Ar mode-id value. .\" .It Fl r, -rgb Use RGB color space mode. .\" .It Fl f, -full-screen Use full screen mode. .\" .It Fl g, -full-range Use full range mode. .\" .It Fl d, -dither Use dither mode. .\" .It Fl h, -help Print a help message. .\" .It Fl V, -version Display the program version number. .El .\" .Sh NOTES .\" ===== .\" .Ss Video Mode IDs and Mode Names .\" ----------------------------- The supported video .Ar mode-id values, coresponding .Ar mode-name values, and screen resolutions are as follows: .Pp .Bd -literal -offset indent AUTO Detect Mode: 0: auto (480i/576i if not HDMI) 60 Hz Broadcast Modes: 1: 480i (576 x 384) 2: 480p (576 x 384) 3: 720p (1124 x 644) 4: 1080i (1688 x 964) 5: 1080p (1688 x 964) 50 Hz Broadcast Modes: 6: 576i (576 x 460) 7: 576p (576 x 460) 8: 720p (1124 x 644) 9: 1080i (1688 x 964) 10: 1080p (1688 x 964) VESA Modes: 11: wxga (1280 x 768) 12: sxga (1280 x 1024) 13: wuxga (1920 x 1200) 60 Hz Full Screen Broadcast Modes: 129: 480if (720 x 480) 130: 480pf (720 x 480) 131: 720pf (1280 x 720) 132: 1080if (1920 x 1080) 133: 1080pf (1920 x 1080) 50 Hz Full Screen Broadcast Modes: 134: 576if (720 x 576) 135: 576pf (720 x 576) 136: 720pf (1280 x 720) 137: 1080if (1920 x 1080) 138: 1080pf (1920 x 1080) .Ed .Pp Note that VESA modes are only valid for the HDMI port. .Pp The mode options .Sy --rgb, --full-screen, --full-range and .Sy --dither can be specified via the .Ar mode-id as follows: .Bd -literal -offset indent RGB color space: