1 // Copyright 2010 Sven Peter <svenpeter@gmail.com>
2 // Licensed under the terms of the GNU GPL, version 2
3 // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
13 #define MKDIR(x,y) mkdir(x);
15 #define MKDIR(x,y) mkdir(x,y)
18 static u8
*nor
= NULL
;
20 static void new_dir(const char *n
)
27 static void do_toc(u8
*ptr
)
36 n_entries
= be32(ptr
+ 0x04);
39 for(i
= 0; i
< n_entries
; i
++) {
40 memcpy(name
, p
+ 16, 0x20);
42 if (strncmp(name
, "asecure_loader", 0x20) == 0) {
43 new_dir("asecure_loader");
44 do_toc(ptr
+ be64(p
));
47 } else if (strncmp(name
, "ros", 3) == 0) {
49 do_toc(ptr
+ be64(p
) + 0x10);
54 size
= be64(p
+ 0x08);
55 if (be32(tmp
+ 0x10) == 0x53434500) {
60 memcpy_to_file(name
, tmp
, size
);
66 int main(int argc
, char *argv
[])
69 fail("usage: norunpack dump.b directory");
71 nor
= mmap_file(argv
[1]);