VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/Etherboot-src/util/makelilo.pl@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 872 bytes
Line 
1#!/usr/bin/perl -w
2
3use constant SYSSIZE_LOC => 500; # bytes from beginning of boot block
4use constant MINSIZE => 32768;
5
6use strict;
7
8use bytes;
9
10$#ARGV >= 1 or die "Usage: $0 liloprefix file ...\n";
11open(L, "$ARGV[0]") or die "$ARGV[0]: $!\n";
12undef($/);
13my $liloprefix = <L>;
14close(L);
15length($liloprefix) >= 512 or die "LILO prefix too short\n";
16shift(@ARGV);
17my $totalsize = 0;
18for my $file (@ARGV) {
19 next if (! -f $file or ! -r $file);
20 $totalsize += -s $file;
21}
22my $pad = 0;
23if ($totalsize < MINSIZE) {
24 $pad = MINSIZE - $totalsize;
25 $totalsize = MINSIZE;
26}
27print STDERR "LILO payload is $totalsize bytes\n";
28$totalsize += 16;
29$totalsize >>= 4;
30substr($liloprefix, SYSSIZE_LOC, 2) = pack('v', $totalsize);
31print $liloprefix;
32for my $file (@ARGV) {
33 next unless open(I, "$file");
34 undef($/);
35 my $data = <I>;
36 print $data;
37 close(I);
38}
39print "\x0" x $pad;
40exit(0);
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette