summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-02 23:45:15 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-02 23:58:31 +0100
commitb93ba7d1e876e81ac1d21b256fe9fcd580cb9fc4 (patch)
tree813f1e5b7ba42fb8819872db9f6e60c7e7566d3e
parentFix blkid fact. (diff)
downloadsyslinux-b93ba7d1e876e81ac1d21b256fe9fcd580cb9fc4.tar.gz
syslinux-b93ba7d1e876e81ac1d21b256fe9fcd580cb9fc4.tar.xz
Add µCode-updates to syslinux initrd.
-rw-r--r--manifests/init.pp41
1 files changed, 40 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 8428b5c..d7bd375 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -42,14 +42,27 @@ class syslinux (
$device = $facts['mountpoints']['/']['device']
$partuuid = $facts['blkid'][$device]['PARTUUID']
+
+ $cpus = $facts['processors']['models']
+ $has_amd = $cpus.any |$i| { $i =~ /AMD/ }
+ $has_intel = $cpus.any |$i| { $i =~ /Intel/ }
+
+ if $has_amd { ensure_packages(['amd-ucode']) }
+ if $has_intel { ensure_packages(['intel-ucode']) }
+
$entries = $boot_entries.map |$key, $entry| {
case $entry['type'] {
'linux': {
$extra_args = $entry['extra_args']
$initrd = $entry['initrd']
+ $initrd_multi = [
+ if $has_amd { '../amd-ucode.img' },
+ if $has_intel { '../intel-ucode.img' },
+ "../arch/${initrd}",
+ ].filter |$i| { $i != undef }.join(',')
$hash = {
'APPEND' => "root=PARTUUID=${partuuid} rw ${extra_args}",
- 'INITRD' => "../arch/${initrd}",
+ 'INITRD' => $initrd_multi,
'LINUX' => "../arch/vmlinuz-${kernel}",
}
}
@@ -99,11 +112,23 @@ class syslinux (
mode => '0555',
content => @("EOF"/$)
#!/bin/sh
+ # File managed by Puppet
IFS='\n' read data
cp "/\$data" "${efi_root}/EFI/arch/vmlinuz-${kernel}"
| EOF
}
+ file { '/usr/libexec/move-ucode':
+ ensure => file,
+ mode => '0555',
+ content => @("EOF"/$)
+ #!/bin/sh
+ # File managed by Puppet
+ IFS='\n' read data
+ cp "/\$data" "${efi_root}/EFI/"
+ | EOF
+ }
+
pacman::hook { 'install-kernel':
priority => 60, # something less than /usr/share/libalpm/hooks/90-mkinitcpio-install.hook
trigger => {
@@ -116,4 +141,18 @@ class syslinux (
exec => '/usr/libexec/move-kernel',
needsTargets => true ,
}
+
+
+ pacman::hook { 'install-ucode-initrd':
+ priority => 60,
+ trigger => {
+ type => 'Path',
+ operation => [ 'Install', 'Upgrade' ],
+ target => [ 'boot/*-ucode.img', ],
+ },
+ description => 'Moving µCode-updates to EFI',
+ when => 'PostTransaction',
+ exec => '/usr/libexec/move-ucode',
+ needsTargets => true ,
+ }
}