mirror of
https://git.nju.edu.cn/oslab2023/oslab.git
synced 2024-06-13 04:44:31 +08:00
20 lines
367 B
Perl
Executable File
20 lines
367 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
open(SIG, $ARGV[0]) || die "open $ARGV[0]: $!";
|
|
|
|
$n = sysread(SIG, $buf, 1000);
|
|
|
|
if($n > 510){
|
|
print STDERR "ERROR: boot block too large: $n bytes (max 510)\n";
|
|
exit 1;
|
|
}
|
|
|
|
print "OK: boot block is $n bytes (max 510)\n";
|
|
|
|
$buf .= "\0" x (510-$n);
|
|
$buf .= "\x55\xAA";
|
|
|
|
open(SIG, ">$ARGV[1]") || die "open >$ARGV[1]: $!";
|
|
print SIG $buf;
|
|
close SIG;
|