mirror of
https://github.com/linuxboot/linuxboot
synced 2024-11-21 15:50:58 +00:00
add -h | --help option, handle empty argument case
This commit is contained in:
parent
90a34eac18
commit
0d33925b8e
@ -8,10 +8,11 @@ use Getopt::Long;
|
||||
use Digest::SHA 'sha1';
|
||||
use EFI;
|
||||
|
||||
my $usage = <<"";
|
||||
my $usage = <<"END";
|
||||
Usage:
|
||||
$0 -o output.ffs [options] file.efi [...]
|
||||
Options:
|
||||
-h | -? | --help This help
|
||||
-o | --output output.ffs Output file (default is stdout)
|
||||
-n | --name FileName Name to include in UI Section
|
||||
-t | --type Type FREEFORM|DRIVER|SMM|DXE_CORE|SMM_CORE|PEIM
|
||||
@ -20,6 +21,7 @@ Options:
|
||||
-d | --depex 'guid guid..' Optional dependencies (all ANDed, or TRUE)
|
||||
-z | --compress Enable LZMA compression
|
||||
-a | --auto Detect the section types from the filenames
|
||||
END
|
||||
|
||||
my $output = '-';
|
||||
my $name;
|
||||
@ -32,6 +34,7 @@ my $auto;
|
||||
|
||||
|
||||
GetOptions(
|
||||
"h|?|help" => sub { print $usage; exit 0 },
|
||||
"o|output=s" => \$output,
|
||||
"n|name=s" => \$name,
|
||||
"t|type=s" => \$type,
|
||||
@ -45,6 +48,8 @@ GetOptions(
|
||||
die "$type: unknown file type\n"
|
||||
if $type and not exists $EFI::file_types{$type};
|
||||
|
||||
die "At least one FFS section is required\n" unless @ARGV;
|
||||
|
||||
my @sections;
|
||||
|
||||
# Read entire files at a time and append a new section
|
||||
|
@ -18,27 +18,34 @@ use Getopt::Long;
|
||||
use Digest::SHA 'sha1';
|
||||
use EFI;
|
||||
|
||||
my $usage = <<"";
|
||||
my $usage = <<"END";
|
||||
Usage:
|
||||
$0 -o output.fv [options] file.ffs [...]
|
||||
Options:
|
||||
-h | -? | --help This help
|
||||
-o | --output output.ffs Output file (default is stdout)
|
||||
-s | --size BYTES Final size in bytes (default is 4 MB)
|
||||
-v | --verbose Increase verbosity
|
||||
-z | --compress BYTES Create an internal LZMA compresed FV
|
||||
|
||||
|
||||
For compressed firmware volumes, the --size is the final size of the
|
||||
output and --compress size is the internal volume. So to create a 4MB
|
||||
volume with a 8MB internal use --size 0x4000000 --compress 0x800000
|
||||
|
||||
|
||||
Sizes are limited to less than 16 MB until FFSv3 support is added.
|
||||
|
||||
END
|
||||
|
||||
# if invoked with no options, we should probably print some help
|
||||
die $usage unless @ARGV;
|
||||
|
||||
my $output = '-';
|
||||
my $size = 4 * 1024 * 1024;
|
||||
my $verbose = 0;
|
||||
my $compress_size;
|
||||
|
||||
GetOptions(
|
||||
"h|?|help" => sub { print $usage; exit 0 },
|
||||
"o|output=s" => \$output,
|
||||
"s|size=o" => \$size,
|
||||
"z|compress=o" => \$compress_size,
|
||||
|
Loading…
Reference in New Issue
Block a user