Initial commit: Schunix as it stands before the SchOS rename
An x86-64 operating system built from xv6, now largely rewritten: SMP, a copy-on-write root filesystem (SchFS), PCI/USB/virtio drivers, a TTF rasteriser, and a Linux-numbered syscall ABI. No history before this point -- the tree was never under version control. This commit exists so the rename that follows has something to undo to.
This commit is contained in:
commit
d0f7acf9eb
275 changed files with 51417 additions and 0 deletions
24
tools/padstage2.pl
Normal file
24
tools/padstage2.pl
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl
|
||||
# Zero-pads the stage2 bootloader binary out to a fixed size (STAGE2_SECTORS
|
||||
# * 512 bytes), so the kernel's on-disk starting sector is predictable
|
||||
# regardless of stage2's actual compiled size. Errors out if stage2 has
|
||||
# grown past that budget instead of silently truncating it.
|
||||
|
||||
my $size = $ARGV[1] || die "usage: padstage2.pl <file> <size-in-bytes>\n";
|
||||
|
||||
open(F, $ARGV[0]) || die "open $ARGV[0]: $!";
|
||||
my $n = sysread(F, my $buf, $size + 1);
|
||||
close(F);
|
||||
|
||||
if ($n > $size) {
|
||||
print STDERR "stage2 too large: $n bytes (max $size)\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print STDERR "stage2 is $n bytes (max $size)\n";
|
||||
|
||||
$buf .= "\0" x ($size - $n);
|
||||
|
||||
open(F, ">$ARGV[0]") || die "open >$ARGV[0]: $!";
|
||||
print F $buf;
|
||||
close(F);
|
||||
Loading…
Reference in a new issue