Skip to content

Instantly share code, notes, and snippets.

@xerpi
Last active April 1, 2024 12:51
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save xerpi/5c60ce951caf263fcafffb48562fe50f to your computer and use it in GitHub Desktop.
Save xerpi/5c60ce951caf263fcafffb48562fe50f to your computer and use it in GitHub Desktop.
PSVita Linux build instructions

0) Optional: Solder UART0 pins

  1. Check here for the pinout. You will also need a 1.8V level shifter.

1) Install an ARMv7 cross-compiler

  1. Go to https://toolchains.bootlin.com
  2. Select arch: armv7-eabihf
  3. Select libc: glibc
  4. Download bleeding-edge
  5. Uncompress it (for example to /opt)
  6. Add the bin/directory of the toolchain to $PATH
    • In my case: export PATH=$PATH:/opt/armv7-eabihf--glibc--bleeding-edge-2023.08-1/bin

2) Build Buildroot

  1. git clone git://git.buildroot.net/buildroot && cd buildroot
  2. Download and copy this Buildroot .config to .config
  3. If using a toolchain path different than /opt/armv7-eabihf--glibc--bleeding-edge-2023.08-1:
    • make menuconfig
    • Navigate to Toolchain --->
    • Properly set the Toolchain path, save and exit
  4. Create a rootfs-overlay directory. Everything you put inside will be part of the rootfs.
  5. make -j
  6. This will generate output/images/rootfs.cpio.xz

3) Build Linux

  1. git clone https://github.com/xerpi/linux_vita.git
  2. cd linux_vita && cp ../buildroot/output/images/rootfs.cpio.xz ./
  3. make ARCH=arm vita_defconfig
  4. make ARCH=arm CROSS_COMPILE=arm-linux- -j
  5. make ARCH=arm CROSS_COMPILE=arm-linux- vita1000.dtb vita2000.dtb pstv.dtb
  6. This will generate arch/arm/boot/zImage and arch/arm/boot/dts/{vita1000.dtb,vita2000.dtb,pstv.dtb}

4) Install vitasdk

5) Build vita-baremetal-loader

  1. git clone https://github.com/xerpi/vita-baremetal-loader.git
  2. cd vita-baremetal-loader && make
  3. This will generate baremetal-loader.skprx

6) Install libbaremetal

  1. git clone https://github.com/xerpi/vita-libbaremetal.git
  2. cd vita-libbaremetal/libbaremetal && make install

7) Build vita-baremetal-linux-loader

  1. git clone https://github.com/xerpi/vita-baremetal-linux-loader.git
  2. cd vita-baremetal-linux-loader && make
  3. This will generate vita-baremetal-linux-loader.bin

8) Build and install the Plugin Loader VPK or vitacompanion

Two main methods: (a) a VPK that loads a kernel plugin, or (b) my fork of vitacompanion that has an custom command to load skprxes.

a. Plugin Loader VPK method:

  1. git clone https://bitbucket.org/xerpi/vita_plugin_loader.git
  2. cd vita_plugin_loader && mkdir build && cd build && cmake .. && make
  3. Install plugin_loader.vpk

b. vitacompanion method:

  1. Build and install vitacompanion
  2. To launch an skprx run:
    echo "load_skprx ux0:/myplugin.skprx" | nc $PSVITAIP 1338

9) Boot Linux

  1. Copy baremetal-loader.skprx to ux0:data/tai/kplugin.skprx
    • Configurable in vita_plugin_loader/main.c:13
  2. Copy vita-baremetal-linux-loader.bin to ux0:/baremetal/payload.bin
    • Configurable in vita-baremetal-loader/config.h
  3. Copy linux_vita/arch/arm/boot/zImage to ux0:/linux/zImage (uma0 if using sd2vita)
  4. Copy linux_vita/arch/arm/boot/dts/{vita1000.dtb,vita2000.dtb,pstv.dtb} to ux0:/linux/ (uma0 if using sd2vita)
  5. Launch the Plugin Loader VPK

More information

Deprecated steps

4) Build vita-linux-loader (DEPRECATED: use vita-baremetal-linux-loader instead)

  1. Install vitasdk
  2. git clone git@github.com:xerpi/vita-linux-loader.git
  3. cd vita-linux-loader && make
  4. This will generate linuxloader.skprx
@DvaMishkiLapa
Copy link

@xerpi
Probably should have shown you this, there might be something useful in there. You seem to be doing about the same thing in vita-baremetal-loader as I am. I'd be glad if this helps you in any way or improves the important repository ^^.

@Ipertatos
Copy link

I am getting Error cant read zImage on 3.65. idk what i am doing wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment