* same with xv6
[mascara-docs.git] / i386 / standford / 2004 / src / lab3 / boot / sign.pl
blob8a65e9fb21235b8746c3b9c50e4c588ec960ddd4
1 #!/bin/perl
3 open(SIG, $ARGV[0]) || die "open $ARGV[0]: $!";
5 $n = sysread(SIG, $buf, 1000);
7 if($n > 510){
8 print STDERR "boot block too large: $n bytes (max 510)\n";
9 exit 1;
12 print STDERR "boot block is $n bytes (max 510)\n";
14 $buf .= "\0" x (510-$n);
15 $buf .= "\x55\xAA";
17 open(SIG, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
18 print SIG $buf;
19 close SIG;