Subject: mkimage.sh and cpu microcode updates

From: Thomas Liske <[email-masked]>
Date: Sun, 3 May 2020 23:34:14 +0200

Hi,

this is related to aports #11478 and !7493. I wonder how could I use CPU 
microcode updates on Alpine while using the diskless mode (directly from 
a usb stick without setup-bootable installation). As a result I think 
the situation should be improved.

For Intel and AMD CPUs it is required to use a early initrd to apply 
microcode updates. For Intel we have the intel-ucode package, for AMD it 
is missing (there are the linux-firmware-amd* packages containing the 
vanilla ucode updates, details see below).

*mkimage.sh*

I've created a small patch[1] for mkimage.sh to make it possible a image 
profile can add packages which provides additional files into boot and 
use that files as early initrd by chain loading them (like ArchLinux 
does with syslinux[2] and grub[3]).

[1] 
https://gitlab.alpinelinux.org/alpine/aports/-/commit/9b9e4b106ce96fe71e1c1deae11c7fcb61d78da5
[2] https://wiki.archlinux.org/index.php/Microcode#Syslinux
[3] https://wiki.archlinux.org/index.php/Microcode#GRUB

I think loading those early initrds should not be a problem on foreign 
CPUs (Intel CPU|ucode vs. AMD ucode|CPU).

Should microcode updates loaded by default, only in extended or only be 
advanced users building their own images using mkimage.sh?

*AMD*

There are the two related packages linux-firmware-amd and 
linux-firmware-amd-ucode for AMD CPU and APU (btw: they are packaged for 
all architectures but can only be used on x86 and x86_64).

This does *not* help for early boot ucode updates. I think we require a 
amd-ucode package simiular to the intel-ucode package. It should be 
possible since ArchLinux does it the same way[4].

[4] https://www.archlinux.org/packages/core/any/amd-ucode/

Both intel-ucode and amd-ucode packages should be added to the .iso 
images and can be chain loaded as early initrd or used for individual 
image profiles.

*Documentation*

It was hard for me to find any details how microcode updates are handled 
in alpine. I think it would be useful to have a site in the alpine wiki 
giving some hints on this topic for other users.

Regards,
Thomas

---

From: Wolf <[email-masked]>
Date: Tue, 5 May 2020 14:37:15 +0200

Hello,

On 2020-05-03 23:34:14 +0200, Thomas Liske wrote:
> amd-ucode package simiular to the intel-ucode package. It should be possible
> since ArchLinux does it the same way[4].
> 

I can say that using the Arch's way does indeed work. I have my own
amd-ucode package (basically rewrite of PKGBUIld to ABUILD) and did not
notice any issues.

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

---

From: Thomas Liske <[email-masked]>
Date: Tue, 5 May 2020 22:54:59 +0200

Hi,

> amd-ucode package (basically rewrite of PKGBUIld to ABUILD) and did not

in the meantime I have created MR !7527[1] porting the PKGBUILD part 
into the APKBUILD of linux-firmware to add the amd-ucode package.

[1] https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/7527

HTH,
Thomas

---

From: Thomas Liske <[email-masked]>
Date: Tue, 19 May 2020 17:33:08 +0200

Hi,

are there any updates or comments on this topics || MR ?

TIA,
Thomas