generate-zbm: remove integrated syslinux support

This commit is contained in:
Zach Dykstra 2023-10-28 11:15:25 -05:00
parent 6c63c1d129
commit 55f08b96bc
5 changed files with 5 additions and 102 deletions

View File

@ -498,85 +498,6 @@ if ( enabled $config{Components} ) {
printf "Created kernel image %s\n", $kernel_target; printf "Created kernel image %s\n", $kernel_target;
} }
# Generate syslinux.cfg, requires components to be built
if ( enabled $config{Components}{syslinux} ) {
my $warning = <<"EOF";
DEPRECATION WARNING: syslinux support in generate-zbm is deprecated.
Support will be removed in the next release.
As an alternative: consider one of the following two options:
1. Set `Components.Versions` to `false` in the ZFSBootMenu configuration and
maintain a static syslinux configuration.
2. Use the contrib/syslinux-update.sh script in the ZFSBootMenu repository
as a post-image hook for generate-zbm(5).
EOF
print $warning;
my $glob = sprintf( "%s/%s-*", $config{Components}{ImageDir}, $runConf{kernel_prefix} );
my @listing = sort versioncmp glob($glob);
# Filter EFI files, in case they're in the same directory
my @components;
foreach my $entry (@listing) {
if ( $entry =~ /EFI$/i ) {
next;
}
push( @components, $entry );
}
$runConf{syslinux_temp} = join( '/', $tempdir, 'syslinux.conf' );
open CFG, '>', $runConf{syslinux_temp};
my $header = <<'EOF';
UI menu.c32
PROMPT 0
MENU TITLE Boot Menu
TIMEOUT 50
EOF
print CFG $header;
my $add_default = 1;
while (@components) {
my $entry = pop(@components);
my $directory = dirname($entry);
# Strip the mountpoint prefix out to generate a correct path based on /
$directory =~ s/\Q$config{Global}{BootMountPoint}//;
my $kernel = basename($entry);
my ( undef, $version ) = split( '-', $kernel );
my $label = "ZFSBootMenu-$version";
my $menu_label = "ZFSBootMenu $version";
if ($add_default) {
print CFG "DEFAULT $label\n\n";
$add_default--;
}
my $entry_text = <<"EOF";
LABEL $label
MENU LABEL $menu_label
KERNEL $directory/$kernel
INITRD $directory/initramfs-$version.img
APPEND $runConf{cmdline}
EOF
print CFG $entry_text;
}
close CFG;
make_path dirname( $config{Components}{syslinux}{Config} );
safeCopy( $runConf{syslinux_temp}, $config{Components}{syslinux}{Config} ) or exit 1;
}
if ( nonempty $config{Global}{PostHooksDir} and -d $config{Global}{PostHooksDir} ) { if ( nonempty $config{Global}{PostHooksDir} and -d $config{Global}{PostHooksDir} ) {
while ( my $hook = <$config{Global}{PostHooksDir}/*> ) { while ( my $hook = <$config{Global}{PostHooksDir}/*> ) {
next unless -x $hook; next unless -x $hook;

View File

@ -142,9 +142,7 @@ See :doc:`generate-zbm(5) </man/generate-zbm.5>` for more details.
Configure syslinux Configure syslinux
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The ``generate-zbm`` image-creation utility includes now-deprecated support for managing a syslinux configuration. The ZFSBootMenu configuration described above disables explicit image versioning, which means
Because this capability is slated for removal and was not reliable in the first place, it is better to create a static
syslinux configuration. The ZFSBootMenu configuration described above disables explicit image versioning, which means
that each invocation of ``generate-zbm`` will produce two output files at a predictable location: that each invocation of ``generate-zbm`` will produce two output files at a predictable location:
* ``/boot/syslinux/zfsbootmenu/vmlinuz-bootmenu`` * ``/boot/syslinux/zfsbootmenu/vmlinuz-bootmenu``
@ -184,6 +182,9 @@ Consult the `syslinux documentation <https://wiki.syslinux.org/wiki/index.php?ti
contents of the ``syslinux.cfg`` configuration file. To alter the command-line arguments passed to the ZFSBootMenu contents of the ``syslinux.cfg`` configuration file. To alter the command-line arguments passed to the ZFSBootMenu
image, adjust the contents of the ``APPEND`` lines in the configuration. image, adjust the contents of the ``APPEND`` lines in the configuration.
Alternatively, the :zbm:`contrib/syslinux-update.sh` ``generate-zbm`` hook can be used to automatically recreate
``syslinux.cfg``.
.. include:: _include/gen-initramfs.rst .. include:: _include/gen-initramfs.rst
.. include:: ../_include/cleanup.rst .. include:: ../_include/cleanup.rst

View File

@ -70,7 +70,7 @@ Kernel
**CommandLine** **CommandLine**
If you're making a unified EFI file or a syslinux configuration, this is the command line passed to the boot image. If you're making a unified EFI file, this is the command line passed to the boot image.
**Path** **Path**
@ -103,17 +103,6 @@ Components
When *true* (which behaves as *1*) or any positive integer, **generate-zbm** will append the value of *Global.Version* to every image it produces, followed by a revision as *_$revision*. **generate-zbm** will save *Components.Versions* revisions of all images with versions matching the current value of *Global.Version*. In addition, **generate-zbm** will save the highest revision of the most recent *Components.Versions* image versions distinct from *Global.Version*. When *true* (which behaves as *1*) or any positive integer, **generate-zbm** will append the value of *Global.Version* to every image it produces, followed by a revision as *_$revision*. **generate-zbm** will save *Components.Versions* revisions of all images with versions matching the current value of *Global.Version*. In addition, **generate-zbm** will save the highest revision of the most recent *Components.Versions* image versions distinct from *Global.Version*.
Components.syslinux
-------------------
**Enabled**
When *true*, syslinux configuration generation is enabled. The default value is *false*.
**Config**
The path of the syslinux configuration file to produce.
EFI EFI
--- ---
@ -148,9 +137,6 @@ The following example will write separate, unversioned ZFSBootMenu kernel and in
ImageDir: /boot/efi/EFI/zbm ImageDir: /boot/efi/EFI/zbm
Versions: false Versions: false
Enabled: true Enabled: true
syslinux:
Config: /boot/syslinux/syslinux.cfg
Enabled: false
EFI: EFI:
ImageDir: /boot/efi/EFI/zbm ImageDir: /boot/efi/EFI/zbm
Versions: 2 Versions: 2

View File

@ -9,9 +9,6 @@ Components:
ImageDir: /boot/efi/EFI/zbm ImageDir: /boot/efi/EFI/zbm
Versions: 3 Versions: 3
Enabled: true Enabled: true
syslinux:
Config: /boot/syslinux/syslinux.cfg
Enabled: false
EFI: EFI:
ImageDir: /boot/efi/EFI/zbm ImageDir: /boot/efi/EFI/zbm
Versions: false Versions: false

View File

@ -5,8 +5,6 @@ Global:
Components: Components:
Versions: false Versions: false
Enabled: true Enabled: true
syslinux:
Enabled: false
EFI: EFI:
Versions: false Versions: false
Enabled: true Enabled: true