VirtualBox

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

最後變更 在這個檔案從26302是 1,由 vboxsync 提交於 55 年 前

import

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 872 位元組
 
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);
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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