7 int main(int argc
, char **argv
)
10 unsigned int i
, count
, bytes
= 0;
14 fprintf(stderr
, "\n\tusage: %s <ucode.bin> <array_name> <output_name>\n\n", argv
[0]);
18 fd_in
= fopen(argv
[1], "rb");
20 fprintf(stderr
, "firmware file '%s' not found\n", argv
[1]);
24 fd_out
= fopen(argv
[3], "w+");
26 fprintf(stderr
, "cannot create output file '%s'\n", argv
[3]);
30 fprintf(fd_out
, "\n#include <asm/types.h>\n\nu8 %s [] = {", argv
[2]);
32 while ((count
= fread(buf
, 1, 8, fd_in
)) > 0) {
33 fprintf(fd_out
, "\n\t");
34 for (i
= 0; i
< count
; i
++, bytes
++)
35 fprintf(fd_out
, "0x%02x, ", buf
[i
]);
38 fprintf(fd_out
, "\n};\n\n");