Initial support for syslinux
This commit is contained in:
parent
5fecb80f5b
commit
09b1833297
|
@ -173,6 +173,62 @@ if ( defined( $config{Components}{Copies} ) and ( $config{Components}{Copies} gt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( defined( $config{syslinux}{Copies} ) and ( $config{syslinux}{Copies} gt 0 ) ) {
|
||||||
|
$runConf{kernel_target} =
|
||||||
|
sprintf( "%s/%s-%s", $config{syslinux}{ImageDir}, $runConf{kernel_prefix}, $runConf{version} );
|
||||||
|
$runConf{initramfs_target} = sprintf( "%s/initramfs-%s.img", $config{syslinux}{ImageDir}, $runConf{version} );
|
||||||
|
|
||||||
|
my $glob = sprintf( "%s/%s-*", $config{syslinux}{ImageDir}, $runConf{kernel_prefix} );
|
||||||
|
my @listing = sort glob($glob);
|
||||||
|
|
||||||
|
printf "Found %s existing images, allowed to have a total of %s\n", scalar @listing, $config{syslinux}{Copies};
|
||||||
|
while ( scalar @listing > $config{syslinux}{Copies} ) {
|
||||||
|
my $kernel = shift(@listing);
|
||||||
|
my $initramfs = sprintf( "%s.img", $kernel );
|
||||||
|
$initramfs =~ s/\Q$runConf{kernel_prefix}/initramfs/;
|
||||||
|
printf "Removing %s, %s\n", $kernel, $initramfs;
|
||||||
|
unlink $kernel;
|
||||||
|
unlink $initramfs;
|
||||||
|
}
|
||||||
|
|
||||||
|
make_path $config{syslinux}{ImageDir};
|
||||||
|
if ( safeCopy( $runConf{kernel}, $runConf{kernel_target} )
|
||||||
|
and safeCopy( $runConf{initramfs}, $runConf{initramfs_target} ) )
|
||||||
|
{
|
||||||
|
printf "Created %s, %s\n", $runConf{kernel_target}, $runConf{initramfs_target};
|
||||||
|
}
|
||||||
|
|
||||||
|
$glob = sprintf( "%s/%s-*", $config{syslinux}{ImageDir}, $runConf{kernel_prefix} );
|
||||||
|
@listing = sort glob($glob);
|
||||||
|
|
||||||
|
$runConf{syslinux_temp} = join('/', $tempdir, 'syslinux.conf');
|
||||||
|
open CFG, '>', $runConf{syslinux_temp};
|
||||||
|
|
||||||
|
my $add_default = 1;
|
||||||
|
while (@listing) {
|
||||||
|
my $entry = pop(@listing);
|
||||||
|
|
||||||
|
my $kernel = basename( $entry );
|
||||||
|
my (undef,$version) = split('-', basename( $kernel ));
|
||||||
|
my $label = "ZFSBootMenu-$version";
|
||||||
|
|
||||||
|
if ($add_default) {
|
||||||
|
print CFG "DEFAULT $label\n\n";
|
||||||
|
$add_default--;
|
||||||
|
}
|
||||||
|
|
||||||
|
print CFG "LABEL $label\n";
|
||||||
|
print CFG "KERNEL /$kernel\n";
|
||||||
|
print CFG "INITRD /initramfs-$version.img\n";
|
||||||
|
print CFG "APPEND $config{Kernel}{CommandLine}\n";
|
||||||
|
print CFG "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
close CFG;
|
||||||
|
|
||||||
|
make_path basename( $config{syslinux}{Config} );
|
||||||
|
safeCopy( $runConf{syslinux_temp}, $config{syslinux}{Config} );
|
||||||
|
}
|
||||||
# Finds the latest kernel in /boot
|
# Finds the latest kernel in /boot
|
||||||
sub latestKernel {
|
sub latestKernel {
|
||||||
my @prefixes = ( "vmlinux*", "vmlinuz*", "linux*", "kernel*" );
|
my @prefixes = ( "vmlinux*", "vmlinuz*", "linux*", "kernel*" );
|
||||||
|
|
|
@ -4,7 +4,6 @@ DracutConfDir=/etc/zfsbootmenu/dracut.conf.d
|
||||||
|
|
||||||
[Kernel]
|
[Kernel]
|
||||||
CommandLine="ro quiet loglevel=0"
|
CommandLine="ro quiet loglevel=0"
|
||||||
|
|
||||||
[Components]
|
[Components]
|
||||||
ImageDir=/boot/efi/EFI/void
|
ImageDir=/boot/efi/EFI/void
|
||||||
Versioned=1
|
Versioned=1
|
||||||
|
@ -14,3 +13,8 @@ Copies=3
|
||||||
ImageDir=/boot/efi/EFI/void
|
ImageDir=/boot/efi/EFI/void
|
||||||
Versioned=1
|
Versioned=1
|
||||||
Copies=0
|
Copies=0
|
||||||
|
|
||||||
|
[syslinux]
|
||||||
|
ImageDir=/boot/syslinux
|
||||||
|
Config=/boot/syslinux/syslinux.cfg
|
||||||
|
Copies=0
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ZFSBootMenu-0.7.6='/boot/vmlinux-0.7.6 initrd=/boot/initramfs-0.7.6.img root=zfsbootmenu:POOL=zroot spl_hostid=68f7287a quiet loglevel=0 ro rd.driver.blacklist=usbcore rd.driver.blacklist=xhci_hcd rd.driver.blacklist=xhci_pci amdgpu.dc=1 radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dpm=1'
|
|
@ -0,0 +1,7 @@
|
||||||
|
DEFAULT ZFSBootMenu-0.7.6
|
||||||
|
|
||||||
|
LABEL ZFSBootMenu-0.7.6
|
||||||
|
KERNEL /vmlinux-0.7.6
|
||||||
|
INITRD /initramfs-0.7.6.img
|
||||||
|
APPEND root=zfsbootmenu:POOL=zroot spl_hostid=68f7287a quiet loglevel=0 ro rd.driver.blacklist=usbcore rd.driver.blacklist=xhci_hcd rd.driver.blacklist=xhci_pci amdgpu.dc=1 radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dpm=1
|
||||||
|
|
Loading…
Reference in New Issue