diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2009-05-28 18:27:08 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2009-05-28 18:27:08 +0000 |
commit | 96165abec2da60c466659fa0e68e06d97587d51a (patch) | |
tree | 5445bddea2ac0e706546ce972d61dacc8d0f81e2 /rbutil/mkamsboot/mkamsboot.h | |
parent | bebc8587cfa7896684278d824ed5b28b2e9f9df1 (diff) | |
download | rockbox-96165abec2da60c466659fa0e68e06d97587d51a.tar.gz rockbox-96165abec2da60c466659fa0e68e06d97587d51a.zip |
FS#10253 : mkamsboot v1.0mkamsboot_1.0
- Bump version to 1.0
- Add Clipv2 target
- Make mkamsboot work as a library (work by domonoky : FS#10185, with a few modifications by me)
. Use a macro with variadic arguments for error cases in functions which might error.
. Add detailed descriptions to functions exported by the library (in the header file)
- modify bin2c.c to produce only one pair of .c/.h files with several files embedded in it
- move files needing to be built by an ARM cross compiler into dualboot/
- commit produced .c/.h files (containing nrv2e_d8.S and dualboot.S built for Clip, Fuze, e200v2, c200v2, m200v4, Clipv2)
- Write a real README file
- cosmetics: indent dualboot.S properly, remove trailing spaces, limit lines to 80 characters
- comments: add/correct comments in dualboot.S and mkamsboot.c
- move back extract_fw.c to utils/AMS/hacking
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21118 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkamsboot/mkamsboot.h')
-rw-r--r-- | rbutil/mkamsboot/mkamsboot.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h new file mode 100644 index 0000000000..e2de46c9b8 --- /dev/null +++ b/rbutil/mkamsboot/mkamsboot.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * mkamsboot.h - a tool for merging bootloader code into an Sansa V2 | ||
11 | * (AMS) firmware file | ||
12 | * | ||
13 | * Copyright (C) 2008 Dave Chapman | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | #ifndef MKAMSBOOT_H | ||
26 | #define MKAMSBOOT_H | ||
27 | |||
28 | #include <stdint.h> | ||
29 | #include <sys/types.h> | ||
30 | |||
31 | |||
32 | /* load_rockbox_file() | ||
33 | * | ||
34 | * Loads a rockbox bootloader file into memory | ||
35 | * | ||
36 | * ARGUMENTS | ||
37 | * | ||
38 | * filename : bootloader file to load | ||
39 | * model : a 4 characters string representing the Sansa model | ||
40 | * ("fuze", "clip", "e2v2", "m2v4", or "c2v2") | ||
41 | * bootloader_size : set to the uncompressed bootloader size | ||
42 | * rb_packed_size : set to the size of compressed bootloader | ||
43 | * errstr : provided buffer to store an eventual error | ||
44 | * errstrsize : size of provided error buffer | ||
45 | * | ||
46 | * RETURN VALUE | ||
47 | * pointer to allocated memory containing the content of compressed bootloader | ||
48 | * or NULL in case of error (errstr will hold a description of the error) | ||
49 | */ | ||
50 | |||
51 | unsigned char* load_rockbox_file( | ||
52 | char* filename, int model, int* bootloader_size, int* rb_packedsize, | ||
53 | char* errstr, int errstrsize); | ||
54 | |||
55 | |||
56 | /* load_of_file() | ||
57 | * | ||
58 | * Loads a Sansa AMS Original Firmware file into memory | ||
59 | * | ||
60 | * ARGUMENTS | ||
61 | * | ||
62 | * filename : firmware file to load | ||
63 | * bufsize : set to firmware file size | ||
64 | * md5sum : set to file md5sum, must be at least 33 bytes long | ||
65 | * model : set to firmware model (MODEL_XXX) | ||
66 | * fw_version : set to firmware format version (1 or 2) | ||
67 | * firmware_size : set to firmware block's size | ||
68 | * of_packed : pointer to allocated memory containing the compressed | ||
69 | * original firmware block | ||
70 | * of_packedsize : size of compressed original firmware block | ||
71 | * errstr : provided buffer to store an eventual error | ||
72 | * errstrsize : size of provided error buffer | ||
73 | * | ||
74 | * RETURN VALUE | ||
75 | * pointer to allocated memory containing the content of Original Firmware | ||
76 | * or NULL in case of error (errstr will hold a description of the error) | ||
77 | */ | ||
78 | |||
79 | unsigned char* load_of_file( | ||
80 | char* filename, off_t* bufsize, char* md5sum, int* model, | ||
81 | int* fw_version, int* firmware_size, unsigned char** of_packed, | ||
82 | int* of_packedsize, char* errstr, int errstrsize); | ||
83 | |||
84 | |||
85 | /* patch_firmware() | ||
86 | * | ||
87 | * Patches a Sansa AMS Original Firmware file | ||
88 | * | ||
89 | * ARGUMENTS | ||
90 | * | ||
91 | * model : firmware model (MODEL_XXX) | ||
92 | * fw_version : firmware format version (1 or 2) | ||
93 | * firmware_size : size of uncompressed original firmware block | ||
94 | * buf : pointer to original firmware file | ||
95 | * len : size of original firmware file | ||
96 | * of_packed : pointer to compressed original firmware block | ||
97 | * of_packedsize : size of compressed original firmware block | ||
98 | * rb_packed : pointer to compressed rockbox bootloader | ||
99 | * rb_packed_size : size of compressed rockbox bootloader | ||
100 | */ | ||
101 | |||
102 | void patch_firmware( | ||
103 | int model, int fw_version, int firmware_size, unsigned char* buf, | ||
104 | int len, unsigned char* of_packed, int of_packedsize, | ||
105 | unsigned char* rb_packed, int rb_packedsize); | ||
106 | |||
107 | |||
108 | /* total_size() | ||
109 | * | ||
110 | * Calculates the size of the new firmware block | ||
111 | * | ||
112 | * ARGUMENTS | ||
113 | * | ||
114 | * model : firmware model (MODEL_XXX) | ||
115 | * rb_packed_size : size of compressed rockbox bootloader | ||
116 | * of_packedsize : size of compressed original firmware block | ||
117 | * | ||
118 | * RETURN VALUE | ||
119 | * Size of new firmware block | ||
120 | */ | ||
121 | |||
122 | int total_size(int model, int rb_packedsize, int of_packedsize); | ||
123 | |||
124 | #endif | ||