forked from lwfinger/rtl8723bu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_firmware.c
68 lines (57 loc) · 1.36 KB
/
convert_firmware.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Program to convert header into a binary file
* Coded by Larry Finger
* August 2015
*
* There is no Makefile, build with:
* gcc -o convert_firmware convert_firmware.c
*/
#include <stdio.h>
#define u8 char
#define u32 int
/* Get the firmware data that has been copied from hal/HalHWImg8723B_FW.c */
#include "convert_firmware.h"
void output_bin(FILE *outb, const u8 *array, int len)
{
int i;
for (i = 0; i < len; i++)
fwrite(&array[i], 1, 1, outb);
}
int main(int argc, char **argv)
{
FILE *outb;
int i;
/* convert firmware */
outb = fopen("rtl8723bu_ap_wowlan.bin", "w");
if (!outb) {
fprintf(stderr, "File open error\n");
return 1;
}
output_bin(outb, Array_MP_8723B_FW_AP_WoWLAN,
ArrayLength_MP_8723B_FW_AP_WoWLAN);
fclose(outb);
outb = fopen("rtl8723bu_bt.bin", "w");
if (!outb) {
fprintf(stderr, "File open error\n");
return 1;
}
output_bin(outb, Array_MP_8723B_FW_BT,
ArrayLength_MP_8723B_FW_BT);
fclose(outb);
outb = fopen("rtl8723bu_nic.bin", "w");
if (!outb) {
fprintf(stderr, "File open error\n");
return 1;
}
output_bin(outb, Array_MP_8723B_FW_NIC,
ArrayLength_MP_8723B_FW_NIC);
fclose(outb);
outb = fopen("rtl8723bu_wowlan.bin", "w");
if (!outb) {
fprintf(stderr, "File open error\n");
return 1;
}
output_bin(outb, Array_MP_8723B_FW_WoWLAN,
ArrayLength_MP_8723B_FW_WoWLAN);
fclose(outb);
return 0;
}