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.


information request api for the host - gives a more detailed view of VM and vcore...
[palacios.releases.git] / geekos / scripts / make_payload.pl
1 #!/usr/bin/perl
2
3 $magic = 0xf1e2d3c4;
4
5 use FileHandle;
6
7 if (scalar(@ARGV) != 2) {
8   print STDERR "usage: make_payload.pl <cfg-file> <out-file>\n";
9   exit 1;
10 }
11
12 my $config_file = shift @ARGV;
13 my $out_file = shift @ARGV;
14
15 open (CFGFILE, "$config_file");
16 @cfg = <CFGFILE>;
17 close CFGFILE;
18
19 my $num_regions = 0;
20
21 my @region_names = ();
22 my %region_map = {};
23
24 foreach $line (@cfg) {
25   chomp $line;
26   ($file, $dst) = split(/:/, $line);
27   push @region_names, $file;
28   $region_map{$file} = hex($dst); #unpack('N', pack("h8",$dst));
29   print "" . hex($dst) . "\n";
30   $num_regions++;
31 }
32
33
34
35 my $fh = new FileHandle(">$out_file");
36 binmode $fh;
37
38 syswrite $fh, pack('L', $magic), 4;
39 syswrite $fh, pack('L', $num_regions), 4;
40
41 foreach $file (@region_names) {
42   my $size = (-s $file);
43
44   print "$file to " .  $region_map{$file}. " ($size bytes)\n";
45   syswrite $fh, pack('L', $size), 4;
46   syswrite $fh, pack('L', $region_map{$file}), 4;
47 }
48
49
50 my $file;
51 while (($file = shift @region_names)) {
52   my $in_fh = new FileHandle("<$file");
53   (defined $in_fh) || die "Couldn't open $file: $!\n";
54   binmode $in_fh;
55
56   my $buf = chr(0) x 1024;
57   my $n;
58   while (($n = sysread($in_fh, $buf, 1024)) > 0) {
59     syswrite($fh, $buf, $n);
60   }
61   $in_fh->close();
62 }
63
64
65 $fh->close();