Skip to content

Instantly share code, notes, and snippets.

View xerpi's full-sized avatar

Sergi・セルジ xerpi

View GitHub Profile
#!/bin/bash
#wget https://aur.archlinux.org/cgit/aur.git/plain/config.x86_64?h=linux-drm-tip-git -O ./.config
zcat /proc/config.gz > ./.config
rm ./arch/x86_64/boot/bzImage
commit="$(git rev-parse --short HEAD)"
echo "commit: $commit"
# set localversion to git commit
@xerpi
xerpi / 3DS_Linux_build_instructions.md
Last active October 7, 2024 20:54
3DS Linux build instructions

Step 1: Compiling or Downloading the toolchain

Step 1.a: If you choose to download a pre-compiled toolchain (only for Linux x86-64)

  • Go to https://toolchains.bootlin.com
  • Select arch: armv6-eabihf
  • Select libc: glibc
  • Download bleeding-edge
  • Uncompress it (for example to /opt)
  • Add the bin/directory of the toolchain to $PATH
  • In my case: export PATH=$PATH:/opt/armv6-eabihf--glibc--bleeding-edge-2020.08-1
arm-vita-eabi-gcc -I. -D"__attribute__(ARGS)=" -D"__extension__=" -D"__asm__(ARGS)=" -D"__builtin_va_list=int" -E vitasdk.h > preprocessor.h
@xerpi
xerpi / vitafunctiondefs.py
Last active July 22, 2018 16:26
vitafunctiondefs.py
'''
vitafunctiondefs.py by xerpi
arm-vita-eabi-gcc -E $VITASDK/arm-vita-eabi/include/vitasdk.h -D"__attribute__(x)=" -D"__extension__(x)=" > preprocessor_user.h
arm-vita-eabi-gcc -E $VITASDK/arm-vita-eabi/include/vitasdkkern.h -D"__attribute__(x)=" -D"__extension__(x)=" > preprocessor_kern.h
'''
import sys
import os.path
import struct
@xerpi
xerpi / uart.c
Last active July 11, 2017 20:23
Vita UART
#define PERVASIVERESET_BASE_ADDR 0xE3101000
#define PERVASIVEGATE_BASE_ADDR 0xE3102000
static inline void pervasive_mask_or(unsigned int addr, unsigned int val)
{
volatile unsigned long tmp;
asm volatile(
"ldr %0, [%1]\n\t"
"orr %0, %2\n\t"
#include "hdmi.h"
#include "libc.h"
#include "utils.h"
#include "adv7511.h"
#include "i2c.h"
#include "gpio.h"
#include "pervasive.h"
#include "syscon.h"
#include "log.h"
@xerpi
xerpi / json2yml.py
Created November 10, 2017 08:35
Vita NIDs json2yml.py
#!/usr/bin/python3
import sys
import json
def main():
if len(sys.argv) < 2:
print("Usage:\n\t", sys.argv[0], "db.json")
exit(1)
@xerpi
xerpi / nidreader.py
Last active November 5, 2024 11:01
PS3 NID reader
#!/usr/bin/env python3
import sys
import construct
from collections import namedtuple
from elftools.elf.elffile import ELFFile
from elftools.elf.relocation import RelocationSection
from construct import Struct, Int8ub, Int16ub, Int32ub, PaddedString, CString, Array
#!/usr/bin/env python3
import sys
import yaml
def usage():
print("ps3-libs-gen by xerpi")
print("Usage:\n\t" + sys.argv[0] + " file.yaml")
def generate_lib_resident(name):
@xerpi
xerpi / dmac_test.c
Last active June 22, 2018 07:59
Vita DMAC test
#include <psp2kern/kernel/modulemgr.h>
#include <psp2kern/kernel/threadmgr.h>
#include <psp2kern/kernel/sysmem.h>
#include <psp2kern/kernel/cpu.h>
#include <psp2kern/io/fcntl.h>
#include <psp2kern/sblauthmgr.h>
#include "log.h"
#include "draw.h"
#define LOG(s, ...) \