Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merging for release RC2
[palacios-OLD.git] / geekos / scripts / zerofile
1 #! /usr/bin/perl
2
3 # This script is used for creating a file full of zeroes,
4 # which we use to create the hard disk image used by bochs.
5
6 use strict qw(refs vars);
7 use FileHandle;
8 use IO::Seekable;
9
10 if ( scalar(@ARGV) != 2 ) {
11     print "Usage: zerofile <output file> <num sectors>\n";
12     exit 1;
13 }
14
15 my $outfile = shift @ARGV;
16 my $numsecs = shift @ARGV;
17
18 my $buf = chr(0) x 1;
19
20 my $fh = new FileHandle(">$outfile");
21 (defined $fh) || die "Couldn't open $outfile: $!\n";
22 binmode $fh;
23
24 if ( !sysseek( $fh, ($numsecs * 512) - 1, SEEK_SET ) ) {
25     die "Couldn't seek in $outfile: $!\n";
26 }
27 if ( !syswrite( $fh, $buf, 1 ) ) {
28     die "Couldn't write to $outfile: $!\n";
29 }
30
31 $fh->close();