Skip to content

Instantly share code, notes, and snippets.

@GMMan
Created April 17, 2019 01:40
Show Gist options
  • Save GMMan/d32cdd2f924b89da54f21afd04eeee2d to your computer and use it in GitHub Desktop.
Save GMMan/d32cdd2f924b89da54f21afd04eeee2d to your computer and use it in GitHub Desktop.

upgrade_app

upgrade_app is the built-in upgrade flasher on the PlayStation Classic. It reads an upgrade file from USB, verifies it, and flashes it. In normal boot, it needs to be called to start the upgrade process. In recovery boot, it is automatically started and polls for files on an attached USB drive to flash the normal system. The program takes a single argument as a command. They are:

  • normal: Reboots the system to recovery and waits to flash a normal system. It will refuse to boot into recovery if it detects recovery is not successfully flashed previously. After flashing completes successfully, the system is rebooted back to normal.
  • recovery: Flashes the recovery system. A flag will be set before flashing to make sure the program won't reboot into a partially flashed recovery system.

Upgrade packages

Once upgrade_app runs, it mounts /dev/sda1 to /dev/sdd1 and /dev/sda to /dev/sdd into the mountpoints /run/media/sda1 to /run/media/sdd1 and /run/media/sda to /run/media/sdd. After each mounted the program looks for upgrade packages at the root of the drive. Drives are not unmounted if the search fails.

Normal files

LBOOT.EPB: normal system package

This package contains files to be flashed to a normal system.

  • boot.img: Normal kernel image, flashes to BOOTIMG1 partition
  • rootfs.ext4: Normal system rootfs, flashes to ROOTFS1 partition
  • tz.img: Normal system Trusted Execution Environment image, flashes to TEE1 partition
  • userdata.ext4: User data filesystem, flashes to USRDATA partition

LDATA.EPB: game data image

This file is the raw image written to the GAADATA partition.

One or both of LBOOT.EPB or LDATA.EPB can be flashed at the same time.

Recovery files

LRECOVERY.EPB: recovery system package

This package contains files to be flashed to the recovery system.

  • boot.img: Recovery kernel image, flashes to BOOTIMG2 partition
  • recovery.ext4: Recovery system rootfs, flashes to ROOTFS2 partition
  • tz.img: Recovery system Trusted Execution Environment image, flashes to TEE2 partition

LBOOT.EPB and LRECOVERY.EPB are both plain ZIP files, with all files included stored at the root of the ZIP file. If a partition does not need to be flashed, the file can be omitted. Files are flashed in the order listed, and if one file fails to flash, the remaining files will not be flashed.

When files are being flashed, only as much data as provided will be written. The partitions are not erased, so it is possible to flash 0-byte files.

LED statuses

  • Flashing green: the program is looking for upgrade packages, or currently flashing the system.
  • Solid green: the program has successfully completed flashing.
  • Flashing red: the program encountered an error.

Exit codes

  • -1: an error has occurred
  • 0: flashing was successful
  • 1: command unknown
  • -2: no USB drives found
  • -3: drives mounted but file not found
  • -255: mounting error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment