|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #include <fcntl.h> |
|
20 #include <libelf.h> |
|
21 #include <stdio.h> |
|
22 #include <stdlib.h> |
|
23 #include <unistd.h> |
|
24 #include <string> |
|
25 #include "romdetails.h" |
|
26 #include "processoptions.h" |
|
27 |
|
28 #include "elfromerror.h" |
|
29 #include "elfrom.h" |
|
30 |
|
31 |
|
32 void InitLibElf() { |
|
33 if (elf_version(EV_CURRENT) == EV_NONE) |
|
34 errx(EX_SOFTWARE, "ELF library initialization failed: %s\n", |
|
35 elf_errmsg(-1)); |
|
36 } |
|
37 |
|
38 RomDetails * Init(int argc, char * argv[]){ |
|
39 RomDetails * details = ProcessOptions(argc, argv); |
|
40 return ProcessRomDetails(details); |
|
41 } |
|
42 |
|
43 int main(int argc, char * argv[]){ |
|
44 //TODO: print banner if trace on |
|
45 InitLibElf(); |
|
46 RomDetails * romDetails = Init(argc, argv); |
|
47 ElfRom aElfRom(romDetails); |
|
48 aElfRom.SetupE32RomData(); |
|
49 aElfRom.SetupELFRomData(); |
|
50 aElfRom.AddData(); |
|
51 |
|
52 aElfRom.Dump(); |
|
53 |
|
54 return EXIT_SUCCESS; |
|
55 } |