summaryrefslogtreecommitdiff
path: root/sign.pl
diff options
context:
space:
mode:
authorrtm <rtm>2006-06-12 15:22:12 +0000
committerrtm <rtm>2006-06-12 15:22:12 +0000
commit55e95b16db458b7f9abeca96e541acbdf8d7f85b (patch)
tree92a1fcb6f1cdede7ab83b37acabf76e1bc1b10f4 /sign.pl
downloadxv6-labs-55e95b16db458b7f9abeca96e541acbdf8d7f85b.tar.gz
xv6-labs-55e95b16db458b7f9abeca96e541acbdf8d7f85b.tar.bz2
xv6-labs-55e95b16db458b7f9abeca96e541acbdf8d7f85b.zip
import
Diffstat (limited to 'sign.pl')
-rwxr-xr-xsign.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/sign.pl b/sign.pl
new file mode 100755
index 0000000..d84bdc6
--- /dev/null
+++ b/sign.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+
+open(SIG, $ARGV[0]) || die "open $ARGV[0]: $!";
+
+$n = sysread(SIG, $buf, 1000);
+
+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(SIG, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
+print SIG $buf;
+close SIG;