You are not logged in.

#1 2025-03-13 16:22:50

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

How to obtain firmware information being used for compiling kernel.

Hi I am Rupesh from India and I have brought a new system with AMD Ryzen zen3 5500GT which has integrated GPU and Asus prime b450 motherboard. I have installed Linux Operating System six months back and running fine without any problems. I thought to compile kernel myself but failed.

Actually everything is working fine without any problems but I want to learn how to compile kernel on my own. The kernel built by me must work without any problems in comparison with the kernel provided by official distribution kernel.

Another requirement is I want to build monolithic kernel compiled with gcc flag "--march=znver3".

I have successfully completed compiling the source code of kernel and even installed and modified the grub boot loader to boot into the latest kernel and even succeeded but only one issue is firmware files are not loaded which are necessary to run the system properly.

I am getting errors only related to two components they are amdgpu and rtl8169.

When I boot into the latest kernel and run the command "journalctl -b  -p 3" I am getting errors something like

Failed to load amdgpu/...bin
Failed to load rtl wifi/..bin

The above mentioned journalctl command is throwing exactly 9 to 10 lines which consists of lines amdgpu and rtl8169.

The procedure given by Linux kernel compilation tutorials is

1) Download the source code of kernel

2) uncompress the xz file or gz file

3) change to the kernel source code directory

4) run the command "make localmodconfig"

5) run xconfig and modify the options

6) run make bzImage modules

7) run make modules_install

8) run make install

I followed above mentioned steps except instead of localmodconfig I used localyesconfig.

In order to successfully build custom kernel one must know which firmware files are being used or loaded by the current kernel.

There are a number of utilities to obtain hardware information and some of them are as follows.

1) lshw
2) hwinfo
3) lsmod
4) lspci
5) dmesg

At present I am using current Linux Operating System along with Gentoo Linux.

In Gentoo Linux tutorials on compiling kernel source code they suggested to run the following command to obtain firmware files currently being used.

sudo dmesg | grep -i "loading firmware"

They suggested to note down those file names with path and enter them into the entry CONFIG_EXTRA_FIRMWARE contained in .config file of kernel source code directory.

I have done what they said and compiled installed run successfully without any problems.

When I ran the command "journalctl -b -p 3" in Gentoo Linux I got zero errors.

What I want to say is entering firmware file names currently being used into the .config file of kernel source code is the main thing important to consider.

In the present Linux Operating System when I run the command " sudo dmesg | grep -i loading firmware" I am getting lots of stuff except the names of firmware files currently being used.

Kindly try to suggest how to obtain names of firmware files currently being used so that I can enter them into configuration file of kernel source code and compile kernel myself successfully.

Regards,
Rupesh.

Offline

#2 2025-03-13 20:41:50

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

When I boot into the latest kernel and run the command "journalctl -b  -p 3" I am getting errors something like

https://bbs.archlinux.org/viewtopic.php?id=57855

They suggested to note down those file names with path and enter them into the entry CONFIG_EXTRA_FIRMWARE contained in .config file of kernel source code directory.

This is completely unrequired as you have proven with Arch's kernel which does not do this and works without issue on your system loading firmware from the file-system / initrd.
If you build using Arch's kernel config does can you reproduce the issue?

Offline

#3 2025-03-14 02:11:43

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

This is completely unrequired as you have proven with Arch's kernel which does not do this and works without issue on your system loading firmware from the file-system / initrd.
If you build using Arch's kernel config does can you reproduce the issue?

I am using Arch kernel config and even I am getting errors as " failed to load...bin"

Offline

#4 2025-03-14 02:17:57

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

I followed above mentioned steps except instead of localmodconfig I used localyesconfig.

that would produce a different kernel from Arch's. Please post a link to full system journal showing the error messages and the extracted kernel config from the kernel you built.

Offline

#5 2025-03-14 03:50:43

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

Previously I mean one month back I have compiled the kernel source code.

At that time to generate configuration file I ran the following command.

make localmodconfig

And I booted into the latest kernel and there are no errors.

But at present I thought to create monolithic kernel I mean all the modules and drivers must be compiled and integrated into the kernel itself.

In order to build monolithic kernel I ran the following command.

make localyesconfig

I want to build monolithic kernel because I am not going to run it on another system and I removed unnecessary things from kernel configuration.

I think that majority of you have not created a monolithic kernel. I am requesting you to build monolithic kernel and see whether you can succeed or not.

Offline

#6 2025-03-14 08:20:11

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

Hi link to full system journal showing the error messages is

https://paste.gentoo.zip/o53H83do

kernel configuration file link

https://paste.gentoo.zip/HQaxa3D5

dmesg error messages

[    0.113053] Spectre V2 : Enabling Restricted Speculation for firmware calls
[    0.302774] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    0.337547] acpi PNP0A08:00: [Firmware Info]: ECAM [mem 0xf8000000-0xfbffffff] for domain 0000 [bus 00-3f] only partially covers this bridge
[    0.526912] amdgpu 0000:09:00.0: Direct firmware load for amdgpu/green_sardine_asd.bin failed with error -2
[    0.526943] amdgpu 0000:09:00.0: Direct firmware load for amdgpu/green_sardine_dmcub.bin failed with error -2
[    0.526969] amdgpu 0000:09:00.0: Direct firmware load for amdgpu/green_sardine_pfp.bin failed with error -2
[    0.526996] amdgpu 0000:09:00.0: Direct firmware load for amdgpu/green_sardine_sdma.bin failed with error -2
[    0.527022] amdgpu 0000:09:00.0: Direct firmware load for amdgpu/green_sardine_vcn.bin failed with error -2
[    0.687511] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    7.106911] usb 1-9: rtl8xxxu: Loading firmware rtlwifi/rtl8192eu_nic.bin
[    7.106979] usb 1-9: Direct firmware load for rtlwifi/rtl8192eu_nic.bin failed with error -2
[    7.106983] usb 1-9: request_firmware(rtlwifi/rtl8192eu_nic.bin) failed
[    7.106986] usb 1-9: Fatal - failed to load firmware
[    7.594896] systemd[1]: Clear Stale Hibernate Storage Info was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/HibernateLocation-8cf2644b-4b0b-428f-9387-6d876050dc67).

Offline

#7 2025-03-14 14:29:59

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

Does the initrd contain:

/usr/lib/firmware/amdgpu/green_sardine_asd.bin.zst
/usr/lib/firmware/amdgpu/green_sardine_dmcub.bin.zst
/usr/lib/firmware/amdgpu/green_sardine_pfp.bin.zst
/usr/lib/firmware/amdgpu/green_sardine_sdma.bin.zst
/usr/lib/firmware/amdgpu/green_sardine_vcn.bin.zst
/usr/lib/firmware/rtlwifi/rtl8192eu_nic.bin.zst

Offline

#8 2025-03-15 01:43:03

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

I have not added firmware files to initrd.

I think that this is the main problem.

Can you suggest how to add firmware files to initrd.

Offline

#9 2025-03-15 01:55:20

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

What do you use to create the initrd?  Arch offers multiple solutions.

Offline

#10 2025-03-15 02:17:14

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

I am using mkinitcpio.

Last edited by rupeshforu3 (2025-03-15 02:22:14)

Offline

#11 2025-03-15 02:24:04

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

The command is

sudo mkinitcpio -k 6.13.6-arch1_Rupesh  -g /boot/initramfs-linux-6.13.6-arch1_Rupesh.img

Offline

#12 2025-03-15 04:33:36

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

Try adding the files to the files array of mkinitcpio.conf.

Offline

#13 2025-03-15 08:56:25

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

Firmware files in /lib/firmware are in compressed zst format.

Can I add zst files to mkinitcpio.conf or I must uncompress and add the resulted file names.

Offline

#14 2025-03-15 12:11:01

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

There's something to learn more the following page.

https://www.linuxfromscratch.org/blfs/v … mware.html

Offline

#15 2025-03-15 13:05:21

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

Can I add zst files to mkinitcpio.conf or I must uncompress and add the resulted file names.

Did you remove compressed firmware loading from your kernel config?

Offline

#16 2025-03-15 14:06:49

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

I am generating new initial kernel config file through the following command.

make localyesconfig

All the settings of the current kernel config file are copied to the new config file.

I am new to kernel compilation and so I have asked a number of questions.

I got answer.

Thanks for your support.

Offline

#17 2025-03-15 20:29:09

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

Have you considered keeping modules that load firmware as modules so that the initrd generator can query them for required firmware then list all those modules to be loaded in the initrd?

Offline

#18 2025-03-16 01:15:12

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

loqs wrote:

Have you considered keeping modules that load firmware as modules so that the initrd generator can query them for required firmware then list all those modules to be loaded in the initrd?

localyesconfig means compile all the modules like amdgpu into the kernel.

Due to this vmlinuz will be large and initrd image will be quite small.

Offline

#19 2025-03-16 05:03:23

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

There are more than 600 files in /lib/firmware/amdgpu.

Can I compress all these files and add the resulted file to mkinitcpio.conf.

Offline

#20 2025-03-16 14:32:05

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

localyesconfig means compile all the modules like amdgpu into the kernel.

Due to this vmlinuz will be large and initrd image will be quite small.

Why can you not adjust the config after running localyesconfig?

rupeshforu3 wrote:

There are more than 600 files in /lib/firmware/amdgpu.

Can I compress all these files and add the resulted file to mkinitcpio.conf.

Are the files not already compressed? You can add them all but what is the advantage to that over only adding those the kernel needs?

Offline

#21 2025-03-17 01:45:17

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

At present only six to seven files are being used and after some time another file may be used.

The files in firmware amdgpu option are of size 20kb.

If I compress all these files I can get 20 mb file.

So finally I can add it to mkininitcpio.conf.

Offline

#22 2025-03-17 14:47:07

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

If I compress all these files I can get 20 mb file.

Why do you want to compress already compressed files?

find /usr/lib/firmware/amdgpu/ -type f \! -name '*.zst'

Offline

#23 2025-03-17 14:53:52

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

My requirement is I want to add all the files present amdgpu firmware to mkinitcpio.conf.

Adding 600 files to it can be cumbersome.

Offline

#24 2025-03-17 15:09:29

loqs
Member
Registered: 2014-03-06
Posts: 18,389

Re: How to obtain firmware information being used for compiling kernel.

rupeshforu3 wrote:

My requirement is I want to add all the files present amdgpu firmware to mkinitcpio.conf.

Adding 600 files to it can be cumbersome.

You want to create a single archive of the contents of /usr/lib/firmware/amdgpu/? How would the kernel know what is in that archive or to even look in it?

Offline

#25 2025-03-18 05:27:22

rupeshforu3
Member
Registered: 2023-01-06
Posts: 98

Re: How to obtain firmware information being used for compiling kernel.

In Linux from scratch tutorials they said as follows.

The firmware files can be joined and create a file with extension .bin and finally this file can be added in grub.cfg so that the kernel knows the firmware files.

Offline

Board footer

Powered by FluxBB