mirror of
https://github.com/d0k3/SafeB9SInstaller.git
synced 2025-06-26 05:32:45 +00:00
Add support for upcoming Luma and B9S versions
This commit is contained in:
parent
57afda82ad
commit
0369452723
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -13,7 +13,3 @@
|
|||||||
path = 2xrsa
|
path = 2xrsa
|
||||||
url = https://github.com/b1l1s/2xrsa.git
|
url = https://github.com/b1l1s/2xrsa.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
[submodule "firmtool"]
|
|
||||||
path = firmtool
|
|
||||||
url = https://github.com/TuxSH/firmtool.git
|
|
||||||
ignore = dirty
|
|
||||||
|
4
Makefile
4
Makefile
@ -28,7 +28,7 @@ INCLUDES := source source/common source/font source/fs source/crypto source/fatf
|
|||||||
ARCH := -mthumb -mthumb-interwork -flto
|
ARCH := -mthumb -mthumb-interwork -flto
|
||||||
|
|
||||||
CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2\
|
CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2\
|
||||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu99\
|
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu11\
|
||||||
$(ARCH)
|
$(ARCH)
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE) -DARM9
|
CFLAGS += $(INCLUDE) -DARM9
|
||||||
@ -120,7 +120,7 @@ binary: common
|
|||||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
firm: binary
|
firm: binary
|
||||||
@firmtool/firmtool build $(OUTPUT).firm -n 0x23F00000 -e 0 -D $(OUTPUT).bin -A 0x23F00000 -C NDMA -i
|
@firmtool build $(OUTPUT).firm -n 0x23F00000 -e 0 -D $(OUTPUT).bin -A 0x23F00000 -C NDMA -i
|
||||||
|
|
||||||
gateway: binary
|
gateway: binary
|
||||||
@cp resources/LauncherTemplate.dat $(OUTPUT_D)/Launcher.dat
|
@cp resources/LauncherTemplate.dat $(OUTPUT_D)/Launcher.dat
|
||||||
|
1
firmtool
1
firmtool
@ -1 +0,0 @@
|
|||||||
Subproject commit 375e66c946968c8d39258b01038817a628b88e89
|
|
@ -52,8 +52,10 @@
|
|||||||
#define COLOR_STD_BG COLOR_BLACK
|
#define COLOR_STD_BG COLOR_BLACK
|
||||||
#define COLOR_STD_FONT COLOR_WHITE
|
#define COLOR_STD_FONT COLOR_WHITE
|
||||||
|
|
||||||
#define TOP_SCREEN (u8*)(*(u32*)0x23FFFE00)
|
#define TOP_SCREEN top_screen
|
||||||
#define BOT_SCREEN (u8*)(*(u32*)0x23FFFE08)
|
#define BOT_SCREEN bottom_screen
|
||||||
|
|
||||||
|
extern u8 *top_screen, *bottom_screen;
|
||||||
|
|
||||||
void ClearScreen(unsigned char *screen, int color);
|
void ClearScreen(unsigned char *screen, int color);
|
||||||
void ClearScreenF(bool clear_top, bool clear_bottom, int color);
|
void ClearScreenF(bool clear_top, bool clear_bottom, int color);
|
||||||
|
@ -11,8 +11,21 @@ void Reboot()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
u8 *top_screen, *bottom_screen;
|
||||||
|
|
||||||
|
void main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
// Fetch the framebuffer addresses
|
||||||
|
if(argc >= 2) {
|
||||||
|
// newer entrypoints
|
||||||
|
u8 **fb = (u8 **)(void *)argv[1];
|
||||||
|
top_screen = fb[0];
|
||||||
|
bottom_screen = fb[2];
|
||||||
|
} else {
|
||||||
|
// outdated entrypoints
|
||||||
|
top_screen = (u8*)(*(u32*)0x23FFFE00);
|
||||||
|
bottom_screen = (u8*)(*(u32*)0x23FFFE08);
|
||||||
|
}
|
||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
u32 ret = SafeB9SInstaller();
|
u32 ret = SafeB9SInstaller();
|
||||||
ShowInstallerStatus(); // update installer status one last time
|
ShowInstallerStatus(); // update installer status one last time
|
||||||
@ -21,5 +34,4 @@ int main()
|
|||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
fs_deinit();
|
fs_deinit();
|
||||||
Reboot();
|
Reboot();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,13 @@ _start_gw:
|
|||||||
stmia r0, {r1,r2,r3}
|
stmia r0, {r1,r2,r3}
|
||||||
@ framebuffers properly set
|
@ framebuffers properly set
|
||||||
|
|
||||||
|
ldr r3, =0xFFFF0830 @ flush (clean & invalidate) entire dcache b9 func
|
||||||
|
blx r3
|
||||||
|
|
||||||
|
mov r3, #0
|
||||||
|
mcr p15, 0, r3, c7, c5, 0 @ invalidate I-cache
|
||||||
|
|
||||||
|
mov r2, #0
|
||||||
ldr r3, .entry
|
ldr r3, .entry
|
||||||
bx r3
|
bx r3
|
||||||
|
|
||||||
@ -74,8 +81,18 @@ _start_gw:
|
|||||||
.entry: .word 0x23F00000
|
.entry: .word 0x23F00000
|
||||||
|
|
||||||
_skip_gw:
|
_skip_gw:
|
||||||
|
mov r9, r0 @ argc
|
||||||
|
mov r10, r1 @ argv
|
||||||
|
|
||||||
|
ldr r4, =0xBEEF
|
||||||
|
lsl r2, #16
|
||||||
|
lsr r2, #16
|
||||||
|
cmp r2, r4 @ magic word
|
||||||
|
movne r9, #0
|
||||||
|
|
||||||
@ Disable caches / mpu
|
@ Disable caches / mpu
|
||||||
mrc p15, 0, r4, c1, c0, 0 @ read control register
|
mrc p15, 0, r4, c1, c0, 0 @ read control register
|
||||||
|
bic r4, #(1<<16) @ - dtcm disable (mandated by the docs, before you change the dtcm's address)
|
||||||
bic r4, #(1<<12) @ - instruction cache disable
|
bic r4, #(1<<12) @ - instruction cache disable
|
||||||
bic r4, #(1<<2) @ - data cache disable
|
bic r4, #(1<<2) @ - data cache disable
|
||||||
bic r4, #(1<<0) @ - mpu disable
|
bic r4, #(1<<0) @ - mpu disable
|
||||||
@ -91,10 +108,10 @@ _skip_gw:
|
|||||||
strlt r2, [r0], #4
|
strlt r2, [r0], #4
|
||||||
blt .bss_clr
|
blt .bss_clr
|
||||||
|
|
||||||
@ Flush caches
|
@ Invalidate caches
|
||||||
mov r5, #0
|
mov r5, #0
|
||||||
mcr p15, 0, r5, c7, c5, 0 @ flush I-cache
|
mcr p15, 0, r5, c7, c5, 0 @ invalidate I-cache
|
||||||
mcr p15, 0, r5, c7, c6, 0 @ flush D-cache
|
mcr p15, 0, r5, c7, c6, 0 @ invalidate D-cache
|
||||||
mcr p15, 0, r5, c7, c10, 4 @ drain write buffer
|
mcr p15, 0, r5, c7, c10, 4 @ drain write buffer
|
||||||
|
|
||||||
@ Give read/write access to all the memory regions
|
@ Give read/write access to all the memory regions
|
||||||
@ -142,9 +159,10 @@ _skip_gw:
|
|||||||
mov r1, #0x340
|
mov r1, #0x340
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
|
|
||||||
mov sp, #0x27000000
|
ldr sp, =0x23F00000
|
||||||
|
|
||||||
blx main
|
mov r0, r9
|
||||||
b _start
|
mov r1, r10
|
||||||
|
b main
|
||||||
|
|
||||||
.pool
|
.pool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user