mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-05-03 18:33:57 +08:00
LAB 4 IS DONE.
This commit is contained in:
23
lab/boot/sign.pl
Normal file
23
lab/boot/sign.pl
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
open(BB, $ARGV[0]) || die "open $ARGV[0]: $!";
|
||||
|
||||
binmode BB;
|
||||
my $buf;
|
||||
read(BB, $buf, 1000);
|
||||
$n = length($buf);
|
||||
|
||||
if($n > 510){
|
||||
print STDERR "boot block too large: $n bytes (max 510)\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print STDERR "boot block is $n bytes (max 510)\n";
|
||||
|
||||
$buf .= "\0" x (510-$n);
|
||||
$buf .= "\x55\xAA";
|
||||
|
||||
open(BB, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
|
||||
binmode BB;
|
||||
print BB $buf;
|
||||
close BB;
|
||||
Reference in New Issue
Block a user