xref: /xv6-public/sign.pl (revision a650c606)
1*55e95b16Srtm#!/usr/bin/perl
2*55e95b16Srtm
3*55e95b16Srtmopen(SIG, $ARGV[0]) || die "open $ARGV[0]: $!";
4*55e95b16Srtm
5*55e95b16Srtm$n = sysread(SIG, $buf, 1000);
6*55e95b16Srtm
7*55e95b16Srtmif($n > 510){
8*55e95b16Srtm  print STDERR "boot block too large: $n bytes (max 510)\n";
9*55e95b16Srtm  exit 1;
10*55e95b16Srtm}
11*55e95b16Srtm
12*55e95b16Srtmprint STDERR "boot block is $n bytes (max 510)\n";
13*55e95b16Srtm
14*55e95b16Srtm$buf .= "\0" x (510-$n);
15*55e95b16Srtm$buf .= "\x55\xAA";
16*55e95b16Srtm
17*55e95b16Srtmopen(SIG, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
18*55e95b16Srtmprint SIG $buf;
19*55e95b16Srtmclose SIG;
20