Automatically copy GM9 payload on newly formatted SDs

A9LH only feature
This commit is contained in:
d0k3 2016-07-13 22:22:23 +02:00
parent 6be34ee104
commit 7988a26acc
5 changed files with 34 additions and 2 deletions

View File

@ -5,7 +5,8 @@ SECTIONS
.text.start : { *(.text.start) } .text.start : { *(.text.start) }
.text : { *(.text) } .text : { *(.text) }
.data : { *(.data) } .data : { *(.data) }
.bss : { *(.bss COMMON) } .bss : { __bss_start = .; *(.bss COMMON) }
__bss_end = .;
.rodata : { *(.rodata) } .rodata : { *(.rodata) }
. = ALIGN(4); . = ALIGN(4);
__end__ = ABSOLUTE(.); __end__ = ABSOLUTE(.);

View File

@ -5,7 +5,8 @@ SECTIONS
.text.start : { *(.text.start) } .text.start : { *(.text.start) }
.text : { *(.text) } .text : { *(.text) }
.data : { *(.data) } .data : { *(.data) }
.bss : { *(.bss COMMON) } .bss : { __bss_start = .; *(.bss COMMON) }
__bss_end = .;
.rodata : { *(.rodata) } .rodata : { *(.rodata) }
. = ALIGN(4); . = ALIGN(4);
__end__ = ABSOLUTE(.); __end__ = ABSOLUTE(.);

View File

@ -14,6 +14,18 @@ _start:
bic r4, #(1<<0) @ - mpu disable bic r4, #(1<<0) @ - mpu disable
mcr p15, 0, r4, c1, c0, 0 @ write control register mcr p15, 0, r4, c1, c0, 0 @ write control register
@ Clear bss
ldr r0, =__bss_start
ldr r1, =__bss_end
mov r2, #0
.bss_clr:
cmp r0, r1
beq .bss_clr_done
str r2, [r0], #4
b .bss_clr
.bss_clr_done:
@ Give read/write access to all the memory regions @ Give read/write access to all the memory regions
ldr r5, =0x33333333 ldr r5, =0x33333333
mcr p15, 0, r5, c5, c0, 2 @ write data access mcr p15, 0, r5, c5, c0, 2 @ write data access

View File

@ -44,6 +44,18 @@ _start:
bic r4, #(1<<0) @ - mpu disable bic r4, #(1<<0) @ - mpu disable
mcr p15, 0, r4, c1, c0, 0 @ write control register mcr p15, 0, r4, c1, c0, 0 @ write control register
@ Clear bss
ldr r0, =__bss_start
ldr r1, =__bss_end
mov r2, #0
.bss_clr:
cmp r0, r1
beq .bss_clr_done
str r2, [r0], #4
b .bss_clr
.bss_clr_done:
@ Give read/write access to all the memory regions @ Give read/write access to all the memory regions
ldr r5, =0x33333333 ldr r5, =0x33333333
mcr p15, 0, r5, c5, c0, 2 @ write data access mcr p15, 0, r5, c5, c0, 2 @ write data access

View File

@ -193,6 +193,12 @@ u32 SdFormatMenu(void) {
return 1; return 1;
} }
if (*(vu32*) 0x101401C0 == 0) {
InitSDCardFS(); // on A9LH: copy the payload from mem to SD root
FileSetData("0:/arm9loaderhax.bin", (u8*) 0x23F00000, 0x40000, 0, true);
DeinitSDCardFS();
}
return 0; return 0;
} }