1#!/usr/bin/perl -w
2
3# Copy of mkjulbin.pl made by Olof
4# convert a binary stdin to a C-file containing a char array of the input
5# first argument is the symbol name
6
7$symbol = shift @ARGV;
8
9print "#include <linux/init.h>\n\n";
10#print "unsigned char $symbol", "[] __initdata = {\n";
11print "unsigned char $symbol", "[]  = {\n";
12
13my $char;
14
15$bcount = 0;
16
17while(read STDIN, $char, 1) {
18    printf("0x%x, ", ord($char));
19    $bcount++;
20    if(!($bcount % 16)) {
21	print "\n";
22    }
23}
24
25print "\n};\n";
26
27$lensymb = ("_" . ($symbol . "_length"));
28
29print "__asm__(\"\\t.globl $lensymb\\n$lensymb = $bcount\\n\");\n";
30