WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: early loading microcode for kernel 5.19+  (Read 254 times)

Offline nick65go

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 912
early loading microcode for kernel 5.19+
« on: August 01, 2025, 12:56:22 PM »
Maybe was not enough discussed, but it seams important: https://wiki.archlinux.org/title/Microcode#Late_loading
"Warning: Late microcode loading is considered dangerous, using it on Linux 5.19 and later will taint the kernel", I would say near useless to be in a tcz extension.

Latest TC16 has kernel 6.x, so microcode for Intel / AMD should be EARLY loaded. And this can be done only by an early initialRAM. So basically you BUILD a very small core1 (ex: with files from /usr/lib/firmware/intel-ucode) and concatenate it with original TC core2, core1 being before core2 in final cpio file.

FYI: some bloated distro could do this automatically for you
Code: [Select]
❯ sudo journalctl -k --grep='microcode:'
[sudo] password for abc:
Jul 29 19:44:00 cachyos-HP17 kernel: microcode: Current revision: 0x00004128
Jul 29 19:44:00 cachyos-HP17 kernel: microcode: Updated early from: 0x00004119
~
❯ grep microcode /proc/cpuinfo
microcode       : 0x4128
« Last Edit: August 01, 2025, 12:57:56 PM by nick65go »

Offline nick65go

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 912
Re: early loading microcode for kernel 5.19+
« Reply #1 on: August 01, 2025, 01:30:59 PM »
and here is how to do it manually: https://docs.kernel.org/arch/x86/microcode.html#early-load-microcode
PS: if you know which file you need then you do not need to concatenate ALL files from  /lib/firmware/intel-ucode/* (10+MB) but just ~200 KB.Even the CPU identification can be obtained and then using triplet (X-Y-Z ) to just select your specific binary.ex:
Code: [Select]
❯ lscpu
Architecture:                x86_64
  CPU op-mode(s):            32-bit, 64-bit
  Address sizes:             39 bits physical, 48 bits virtual
  Byte Order:                Little Endian
CPU(s):                      12
  On-line CPU(s) list:       0-11
Vendor ID:                   GenuineIntel
  Model name:                13th Gen Intel(R) Core(TM) i5-1335U
    CPU family:              6   <=== X
   Model:                   186  <=== Y
    Thread(s) per core:      2
    Core(s) per socket:      10
    Socket(s):               1
   Stepping:                3  <=== Z
So CPU-family=6, Model=186 (aka 0x/ba in hexadecimal) and Stepping=3 so I need just the file 06-ba-03 of 224 kb
Code: [Select]
❯ ls /lib/firmware/intel-ucode/06-ba-03
.rw-r--r-- 224k root 12 Mai 19:56 󰡯 /lib/firmware/intel-ucode/06-ba-03

« Last Edit: August 01, 2025, 01:48:18 PM by nick65go »

Offline mocore

  • Hero Member
  • *****
  • Posts: 725
  • ~.~
Re: early loading microcode for kernel 5.19+
« Reply #2 on: August 13, 2025, 12:32:16 PM »

fwiw i found aus9 related topic
"Topic: [Howto] Create and use AMD microcodes with grub2 bootloader" @ https://forum.tinycorelinux.net/index.php/topic,26141.0.html

makes me wander how/where lscpu gets the info ?! ....

unfortunately this is not helpful ( only , long mode and PAE )
Check for CPU features. This command is only available on x86 systems. 
https://www.gnu.org/software/grub/manual/grub/html_node/cpuid.html

https://unix.stackexchange.com/questions/741234/what-is-the-exact-source-of-architecture-info-in-lscpu-command

perhaps some ldr has/could have a module to extract the relevant info ?...
« Last Edit: August 13, 2025, 12:36:51 PM by mocore »