import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / cris / drivers / lpslave / bintocarr.pl
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
9 print "#include <linux/init.h>\n\n";
10 #print "unsigned char $symbol", "[] __initdata = {\n";
11 print "unsigned char $symbol", "[]  = {\n";
12
13 my $char;
14
15 $bcount = 0;
16
17 while(read STDIN, $char, 1) {
18     printf("0x%x, ", ord($char));
19     $bcount++;
20     if(!($bcount % 16)) {
21         print "\n";
22     }
23 }
24
25 print "\n};\n";
26
27 $lensymb = ("_" . ($symbol . "_length"));
28
29 print "__asm__(\"\\t.globl $lensymb\\n$lensymb = $bcount\\n\");\n";