Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index 2897e48..4e0e293 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -475,6 +475,17 @@ void patch_firmware(
 
     /* Insert vectors, they won't overwrite the OF version string */
 
+    /* Let's find what the reset vector points to */
+    uint32_t reset = get_uint32le(&buf[0x400]);
+    if ((reset & 0xfffff000) == 0xe59ff000) { /* reset vector is ldr pc, =XXX */
+        uint32_t offset = (reset&0xfff) + 8;
+        if (!(offset % 4)) {
+            uint32_t dest = get_uint32le(&buf[0x400 + offset]);
+            if (dest < 0x200 && !(dest% 4))
+                put_uint32le(&buf[0x400 + dest], 0xe3a0fc02 ); // mov pc, #0x200
+        }
+    }
+
     /* Reset vector: branch 0x200 bytes away, to our dualboot code */
     static const uint8_t b_0x200[4] = { 0x7e, 0x00, 0x00, 0xea }; // b 0x200
     memcpy(buf + 0x400, b_0x200, sizeof(b_0x200));