read race fixed.
[mit-jos.git] / boot / sign.pl
blob0bf46cb0e215158fe1fb0007a5b97371bca75d2b
1 #!/usr/bin/perl
3 open(BB, $ARGV[0]) || die "open $ARGV[0]: $!";
5 binmode BB;
6 my $buf;
7 read(BB, $buf, 1000);
8 $n = length($buf);
10 if($n > 510){
11 print STDERR "boot block too large: $n bytes (max 510)\n";
12 exit 1;
15 print STDERR "boot block is $n bytes (max 510)\n";
17 $buf .= "\0" x (510-$n);
18 $buf .= "\x55\xAA";
20 open(BB, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
21 binmode BB;
22 print BB $buf;
23 close BB;