Skip to content

Instantly share code, notes, and snippets.

@psxdev
Created September 24, 2021 14:29
Show Gist options
  • Save psxdev/939fc8f0b8ed4ca38b80e646b6b69112 to your computer and use it in GitHub Desktop.
Save psxdev/939fc8f0b8ed4ca38b80e646b6b69112 to your computer and use it in GitHub Desktop.
pkg_pfs_tool on apple m1
changes needed for apple m1
stat64 structure is deprecated on macos. Use stat instead
stat64 function deprecated use stat instead
fstat64 function deprecated use fstat instead
O_LARGEFILE can't be used on macos is already embed by default in modern macos versions so delete it
delete or comment add_compile_options(-masm=intel -march=native) on CmakeList.txt -march=native is not a valid flag on clang and obviouly if you are on arm64....
compile and install mbedtls with CMAC support enabled i used macport enabling myself support (default is not enabled)
compile and install uthash i used macport
zlib already present on macport if you installed or compiled different playstation toolchains.
lib % ls
linux64 macos windows
lib % ls -l macos
total 1896
-rw-r--r-- 1 bigboss staff 574208 23 sep 22:01 libmbedcrypto.a
-rw-r--r-- 1 bigboss staff 255256 23 sep 22:01 libmbedtls.a
-rw-r--r-- 1 bigboss staff 133904 23 sep 22:01 libmbedx509.a
build % make
[ 4%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/compression.c.o
[ 8%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/config.c.o
[ 12%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/crypto.c.o
[ 16%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/dict.c.o
[ 20%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/gp4.c.o
[ 24%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/keymgr.c.o
[ 28%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/keys.c.o
[ 32%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/main.c.o
[ 36%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/mapped_file.c.o
[ 40%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs.c.o
[ 44%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_block.c.o
[ 48%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_dinode.c.o
[ 52%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_dump.c.o
[ 56%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_io.c.o
[ 60%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_lookup.c.o
[ 64%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_parsers.c.o
[ 68%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_sd.c.o
[ 72%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pfs_util.c.o
[ 76%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/pkg.c.o
[ 80%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/playgo.c.o
[ 84%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/self.c.o
[ 88%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/sfo.c.o
[ 92%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/util.c.o
[ 96%] Building C object CMakeFiles/pkg_pfs_tool.dir/src/wildcard.c.o
[100%] Linking C executable pkg_pfs_tool
[100%] Built target pkg_pfs_tool
build % file pkg_pfs_tool
pkg_pfs_tool: Mach-O 64-bit executable arm64
build % ./pkg_pfs_tool -h
PS4 PKG/PFS Tool 1.8.2 (c) 2017-2021 by flatz
--------------------------------------------
USAGE: pkg_pfs_tool [options] command
COMMANDS PARAMETERS DESCRIPTION
------------------------------------------------------------------------------
-h, --help Print this help
-i, --info <img file> Show information about image
-l, --list <img file> List of entries
-u, --unpack <img file> <out dir> [file1 file2...] Unpack files from image
OPTIONS PARAMETERS DESCRIPTION
------------------------------------------------------------------------------
--key-content-id <content id> Use keyset of specific content ID
--passcode <passcode> Use specific passcode
--sealed-key-file <sealed key file> Use sealed key file for keys generation
--encdec-tweak-key <key> Use specific AES XTS tweak key for enc/dec
--encdec-data-key <key> Use specific AES XTS data key for enc/dec
--sign-key <key> Use specific HMAC SHA256 key for signing
--sc0-key <key> Use specific Sc0 key for enc/dec
--use-meta-data-file <meta data file> Load GP4 meta data from file
--dump-meta-data-file <meta data file> Save GP4 meta data to file
--pfs-image-data-file <pfs_image.dat file> Use plain pfs_image.dat as PFS content of PKG file
--generate-gp4 <gp4 file> Generate GP4 project from PKG file
--unpack-inner-pfs Unpack inner PFS file from PKG file
--unpack-outer-pfs Unpack outer PFS file from PKG file
--unpack-sc-entries Unpack SC entries from PKG file
--unpack-extra-sc-entries Unpack extra SC entries from PKG file
--use-splitted-files Use splitted PKG chunks
--no-unpack Don't unpack main PFS files from PKG file
--no-signature-check Skip signature checking
--no-icv-check Skip ICV hash checking
--dump-sfo Dump SFO structure from PKG file
--dump-playgo Dump Playgo structure from PKG file
--dump-final-keys Dump final keys to use with the tool
--dump-sd-info Dump SD info
--use-random-passcode Use random passcode for GP4 project
--all-compressed Use compression for all files in GP4 project
build %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment