From 733c6e9341173f28a7da77e1958d2502131c3640 Mon Sep 17 00:00:00 2001 From: JoseAaronLopezGarcia Date: Mon, 15 Apr 2024 14:44:14 +0200 Subject: [PATCH] cIPL working on 4g+ --- Makefile | 2 + libs/daveeipl/handshake.c | 42 +++++++++---------- libs/iplsdk/Makefile | 2 +- libs/iplsdk/sysreg.c | 10 ----- loader/dc/vunbricker/install.c | 11 ++++- .../cipl/new/ipl_stage1_payload/Makefile | 2 +- .../perma/cipl/new/ipl_stage1_payload/main.c | 1 + 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 2b762c75d..d31750459 100644 --- a/Makefile +++ b/Makefile @@ -288,6 +288,8 @@ clean: $(Q)$(MAKE) $@ -C extras/apps/installer/ $(Q)$(MAKE) $@ -C extras/apps/uninstaller $(Q)$(MAKE) $@ -C libs/daveeipl + $(Q)$(MAKE) $@ -C loader/perma/cipl/new/ipl_stage1_payload + $(Q)$(MAKE) $@ -C loader/perma/cipl/new/ipl_stage2_payload $(Q)rm -f extras/apps/updater/ARK_01234.PKG | true $(Q)rm -f extras/apps/updater/EBOOT_PSP.PBP | true $(Q)rm -f extras/apps/updater/EBOOT_GO.PBP | true diff --git a/libs/daveeipl/handshake.c b/libs/daveeipl/handshake.c index 747863b9a..243ab51d6 100644 --- a/libs/daveeipl/handshake.c +++ b/libs/daveeipl/handshake.c @@ -146,49 +146,49 @@ static const HandshakeSecrets *get_handshake_secrets(unsigned int version) // (04g/07g/09g/11g) or type2 (05g) secrets unsigned int model_code = BARYON_VERSION_MODEL_CODE(version); - // type1 is 04g/07g/09g/11g - if (BARYON_MODEL_CODE_IS_HANDSHAKE_TYPE1(model_code)) { - static const HandshakeSecrets type1_secrets = { + // type2 is 05g + if (BARYON_MODEL_CODE_IS_HANDSHAKE_TYPE2(model_code)) { + static const HandshakeSecrets type2_secret = { .secret1 = { - 0x8D, 0x5D, 0xA6, 0x08, 0xF2, 0xBB, 0xC6, 0xCC, + 0x61, 0x7A, 0x56, 0x42, 0xF8, 0xED, 0xC5, 0xE4, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23 }, .secret2 = { - 0xD5, 0x96, 0x55, 0x56, 0xB9, 0x39, 0xD8, 0x9D, - 0x6E, 0x79, 0xD3, 0x8C, 0x88, 0x7B, 0xF3, 0x0A + 0xF3, 0x58, 0x22, 0xBA, 0x99, 0x4F, 0x86, 0x93, + 0x6A, 0xFF, 0xB7, 0x05, 0x5D, 0xDD, 0x14, 0xFC, }, - .expected1 = { - 0x34, 0xDB, 0x81, 0x24, 0x1D, 0x6F, 0x40, 0x57 + .expected1 = { + 0xDB, 0xB1, 0x1E, 0x20, 0x48, 0x83, 0xB1, 0x6F }, .expected2 = { - 0xE0, 0xDC, 0x41, 0xAF, 0xC2, 0xCD, 0x1C, 0x2D + 0x04, 0xF4, 0x69, 0x8A, 0x8C, 0xAA, 0x95, 0x30 } }; - return &type1_secrets; + return &type2_secret; } - // type2 is 05g - else if (BARYON_MODEL_CODE_IS_HANDSHAKE_TYPE2(model_code)) { - static const HandshakeSecrets type2_secret = { + // type1 is 04g/07g/09g/11g + //if (BARYON_MODEL_CODE_IS_HANDSHAKE_TYPE1(model_code)) { + static const HandshakeSecrets type1_secrets = { .secret1 = { - 0x61, 0x7A, 0x56, 0x42, 0xF8, 0xED, 0xC5, 0xE4, + 0x8D, 0x5D, 0xA6, 0x08, 0xF2, 0xBB, 0xC6, 0xCC, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23 }, .secret2 = { - 0xF3, 0x58, 0x22, 0xBA, 0x99, 0x4F, 0x86, 0x93, - 0x6A, 0xFF, 0xB7, 0x05, 0x5D, 0xDD, 0x14, 0xFC, + 0xD5, 0x96, 0x55, 0x56, 0xB9, 0x39, 0xD8, 0x9D, + 0x6E, 0x79, 0xD3, 0x8C, 0x88, 0x7B, 0xF3, 0x0A }, - .expected1 = { - 0xDB, 0xB1, 0x1E, 0x20, 0x48, 0x83, 0xB1, 0x6F + .expected1 = { + 0x34, 0xDB, 0x81, 0x24, 0x1D, 0x6F, 0x40, 0x57 }, .expected2 = { - 0x04, 0xF4, 0x69, 0x8A, 0x8C, 0xAA, 0x95, 0x30 + 0xE0, 0xDC, 0x41, 0xAF, 0xC2, 0xCD, 0x1C, 0x2D } }; - return &type2_secret; - } + return &type1_secrets; + //} return NULL; } diff --git a/libs/iplsdk/Makefile b/libs/iplsdk/Makefile index c8d80a8c9..e9dc19fa0 100644 --- a/libs/iplsdk/Makefile +++ b/libs/iplsdk/Makefile @@ -1,5 +1,5 @@ TARGET = iplsdk -OBJS = fat.o kirk.o ms.o printf.o syscon.o sysreg.o uart.o gpio.o +OBJS = kirk.o printf.o syscon.o sysreg.o uart.o INCDIR = CFLAGS = -Os -G0 -Wall -std=c99 -fno-pic $(BFLAGS) -fdata-sections -ffunction-sections -Wl,--gc-sections diff --git a/libs/iplsdk/sysreg.c b/libs/iplsdk/sysreg.c index 12fac4dfc..a9c336db8 100644 --- a/libs/iplsdk/sysreg.c +++ b/libs/iplsdk/sysreg.c @@ -68,14 +68,4 @@ void SysregBusclkKirkDisable() void SysregResetKirkDisable() { SysregReset(0x400, 0); -} - -void sysreg_io_enable_gpio(void) -{ - REG32(0xbc100058) |= 0x800000; -} - -void sysreg_io_enable_gpio_port(int port) -{ - REG32(0xbc10007c) |= (1 << port); } \ No newline at end of file diff --git a/loader/dc/vunbricker/install.c b/loader/dc/vunbricker/install.c index d553cb92c..6febbbba1 100644 --- a/loader/dc/vunbricker/install.c +++ b/loader/dc/vunbricker/install.c @@ -863,8 +863,8 @@ int install_thread(SceSize args, void *argp) dcSetCancelMode(1); #ifndef INFINITY - if (fw != FW_OFW && model > 2) - InstallError(fw, "Unsupported model."); + //if (fw != FW_OFW && model > 2) + // InstallError(fw, "Unsupported model."); #endif switch(LoadUpdaterModules(fw)) @@ -1066,6 +1066,8 @@ int install_thread(SceSize args, void *argp) case 1: ipl_name = "flash0:/ipl_02g.bin"; break; case 2: ipl_name = "flash0:/ipl_03g.bin"; ipl_key = 1; break; case 3: ipl_name = "flash0:/ipl_04g.bin"; ipl_key = 1; break; + case 4: ipl_name = "flash0:/ipl_05g.bin"; ipl_key = 2; break; + case 6: ipl_name = "flash0:/ipl_07g.bin"; ipl_key = 1; break; case 8: ipl_name = "flash0:/ipl_09g.bin"; ipl_key = 1; break; case 10: ipl_name = "flash0:/ipl_11g.bin"; ipl_key = 1; break; default: InstallError(fw, "Unsupported model."); @@ -1092,6 +1094,11 @@ int install_thread(SceSize args, void *argp) } break; case 2: ipl_name = "flash0:/cipl_03g.bin"; break; + case 3: ipl_name = "flash0:/cipl_04g.bin"; break; + case 4: ipl_name = "flash0:/cipl_05g.bin"; break; + case 6: ipl_name = "flash0:/cipl_07g.bin"; break; + case 8: ipl_name = "flash0:/cipl_09g.bin"; break; + case 10: ipl_name = "flash0:/cipl_11g.bin"; break; default: InstallError(fw, "Unsupported model."); } } diff --git a/loader/perma/cipl/new/ipl_stage1_payload/Makefile b/loader/perma/cipl/new/ipl_stage1_payload/Makefile index 1d5ca1909..8186e8d9b 100644 --- a/loader/perma/cipl/new/ipl_stage1_payload/Makefile +++ b/loader/perma/cipl/new/ipl_stage1_payload/Makefile @@ -7,7 +7,7 @@ CFLAGS = -Os -G0 -Wall -std=c99 -fno-pic $(BFLAGS) -fdata-sections -ffunction-se CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) -LIBS = -ldaveeipl +LIBS = -ldaveeipl -liplsdk LIBDIR = $(ARKROOT)/libs LDFLAGS = -nostartfiles -T linkfile.l -fdata-sections -ffunction-sections -Wl,--gc-sections diff --git a/loader/perma/cipl/new/ipl_stage1_payload/main.c b/loader/perma/cipl/new/ipl_stage1_payload/main.c index ac5abc813..e0b61e16b 100644 --- a/loader/perma/cipl/new/ipl_stage1_payload/main.c +++ b/loader/perma/cipl/new/ipl_stage1_payload/main.c @@ -265,6 +265,7 @@ int main() #ifndef MSIPL syscon_init(); #ifdef SET_SEED_ADDRESS + unlockSyscon(); syscon_handshake_unlock(); #endif #endif