Skip to content

Commit

Permalink
generate-zbm: remove integrated syslinux support
Browse files Browse the repository at this point in the history
  • Loading branch information
zdykstra committed Nov 7, 2023
1 parent 6c63c1d commit 55f08b9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 102 deletions.
79 changes: 0 additions & 79 deletions bin/generate-zbm
Original file line number Diff line number Diff line change
Expand Up @@ -498,85 +498,6 @@ if ( enabled $config{Components} ) {
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} ) {
while ( my $hook = <$config{Global}{PostHooksDir}/*> ) {
next unless -x $hook;
Expand Down
7 changes: 4 additions & 3 deletions docs/guides/void-linux/syslinux-mbr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ See :doc:`generate-zbm(5) </man/generate-zbm.5>` for more details.
Configure syslinux
~~~~~~~~~~~~~~~~~~
The ``generate-zbm`` image-creation utility includes now-deprecated support for managing a syslinux configuration.
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
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:
* ``/boot/syslinux/zfsbootmenu/vmlinuz-bootmenu``
Expand Down Expand Up @@ -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
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/cleanup.rst
Expand Down
16 changes: 1 addition & 15 deletions docs/man/generate-zbm.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Kernel

**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**

Expand Down Expand Up @@ -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*.

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
---

Expand Down Expand Up @@ -148,9 +137,6 @@ The following example will write separate, unversioned ZFSBootMenu kernel and in
ImageDir: /boot/efi/EFI/zbm
Versions: false
Enabled: true
syslinux:
Config: /boot/syslinux/syslinux.cfg
Enabled: false
EFI:
ImageDir: /boot/efi/EFI/zbm
Versions: 2
Expand Down
3 changes: 0 additions & 3 deletions etc/zfsbootmenu/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ Components:
ImageDir: /boot/efi/EFI/zbm
Versions: 3
Enabled: true
syslinux:
Config: /boot/syslinux/syslinux.cfg
Enabled: false
EFI:
ImageDir: /boot/efi/EFI/zbm
Versions: false
Expand Down
2 changes: 0 additions & 2 deletions etc/zfsbootmenu/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Global:
Components:
Versions: false
Enabled: true
syslinux:
Enabled: false
EFI:
Versions: false
Enabled: true
Expand Down

0 comments on commit 55f08b9

Please sign in to comment.