# Compile Firmware into Kernel (SOLVED)

## ustone

I have a question regarding this option in kernel configuration...

Where are the firmware-files stored by genkernel? directly in the kernel file? i ask because i tried to upgrade the kernel, but with same firmware-files like in the old config in /var/log/dmsg exists "no file found" or similiar regarding the specified files...now i'm unsure, if the really stored in the kernel, or will they be used from filesystem? Or maybe from initramfs?Last edited by ustone on Fri Mar 16, 2012 10:47 am; edited 1 time in total

----------

## BillWho

ustone,

As far as I know the firmware file is built directly into your binary kernel image.

There's some info on it here http://cateee.net/lkddb/web-lkddb/EXTRA_FIRMWARE.html

----------

## Hu

The files are not stored by genkernel.  The kernel build process will read them from the local filesystem and embed them in the generated kernel binary.

----------

## Kaso_da_Zmok

check here?

```
$ ls /lib/firmware/

```

maybe you removed this in the process and now the files are not there anymore:

```
* sys-kernel/linux-firmware

     Available versions:  20110731 (~)20110818 20120125 (~)20120219 **99999999 {savedconfig}

     Homepage:            http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git

     Description:         Linux firmware files

```

----------

## Deathwing00

Moved from Installing Gentoo to Kernel & Hardware.

----------

## ustone

Thanx for clarify this.

firmware files are still in /firmware/lib/radeon 

The problem maybe caused by wrong firmware for my ati card....

let me explain:

in kernel 3.2.1-gentoo-r2 i used the ati TURKS firmware which worked well.. 

in kernel 3.2.11 i used the same and i got the file not found error, but strange not for TURKS, but for another (can't remember and log files are lost, was beginning with B)..even if on boot "Loading TURKS" were displayed..

i was thinking maybe another firmware was used in older kernel, because in the beginning i wrote all existing firmwarefiles into kernel config, but the last compiled working 3.2.1 kernel i used was only with TURKS...

is this the correct driver for my card or is there any kind of "display used firmware"  problem in 3.2.1?

lspci | grep VGA

01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Whistler XT [AMD Radeon HD 6700M Series]

i'm confused....

ps: thanx for your answeres: i use gentoo since 4 weeks and the community here is great...

----------

## NeddySeagoon

ustone,

Some firmware is distributed with the kernel. It can be found in /usr/src/linux/firmware.

Yet more firmware is contained in the linux-firmware package. This installs its payload into /lib/firmware.

Its huge but its size can be contaned by setting up its config file, so only some files are actually installed.

I don't know the files your card needs but dmesg will tell you, one file at a time about any files that can't be found.

The firmware files are embedded in the kernel binary. You will need to tell the kernel which files you want and where they are located.

Under Generic Driver Options, you need something like this  

```
(/sbin/hotplug) path to uevent helper                   

  │ │ [ ] Maintain a devtmpfs filesystem to mount at /dev                

  │ │ [*] Select only drivers that don't need compile-time external firmware    

  │ │ [*] Prevent firmware from being built                                                                    

  │ │ -*- Userspace firmware loading support                                         

  │ │ [ ]   Include in-kernel firmware blobs in kernel binary   

  │ │ (rtl_nic/rtl8168e-2.fw radeon/PALM_pfp.bin radeon/PALM_me.bin radeon/SUMO_rlc.bin) External firmware blobs to build into the kernel binary   

  │ │ (/lib/firmware/) Firmware blobs root directory 
```

Look at the last tine. This tells the kernel where to look for the firmware that is to be included.

The linle above the last line is a space separated list of file names to include, relative to the

```
Firmware blobs root directory
```

entry

The above is taken from my media player. You will need to fix those last two entries to suit your video card.

----------

## Kaso_da_Zmok

your ATI 6700M Whistler uses TURKS

This should do:

```
CONFIG_PREVENT_FIRMWARE_BUILD=y

CONFIG_FW_LOADER=y

CONFIG_FIRMWARE_IN_KERNEL=y

CONFIG_EXTRA_FIRMWARE="radeon/TURKS_mc.bin radeon/TURKS_me.bin radeon/TURKS_pfp.bin"

CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"

```

assuming the files are where expected

```

risko@phenomx6 ~ $ ls -l /lib/firmware/radeon/TURKS_*

-rw-r--r-- 1 root root 24096 Feb 24 21:48 /lib/firmware/radeon/TURKS_mc.bin

-rw-r--r-- 1 root root  5504 Feb 24 21:48 /lib/firmware/radeon/TURKS_me.bin

-rw-r--r-- 1 root root  4480 Feb 24 21:48 /lib/firmware/radeon/TURKS_pfp.bin

```

----------

## ustone

hmmm...

```

ls -l /lib/firmware/radeon/TURKS_*

-rw-r--r-- 1 root root 24096 Mar  2 23:39 /lib/firmware/radeon/TURKS_mc.bin

-rw-r--r-- 1 root root  5504 Mar  2 23:39 /lib/firmware/radeon/TURKS_me.bin

-rw-r--r-- 1 root root  4480 Mar  2 23:39 /lib/firmware/radeon/TURKS_pfp.bin

```

```

 grep  -C 3 CONFIG_EXTRA_FIRMWARE /usr/src/linux-3.2.11-gentoo/.config

CONFIG_PREVENT_FIRMWARE_BUILD=y

CONFIG_FW_LOADER=y

CONFIG_FIRMWARE_IN_KERNEL=y

CONFIG_EXTRA_FIRMWARE="radeon/TURKS_mc.bin radeon/TURKS_me.bin radeon/TURKS_pfp.bin"

CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/"

# CONFIG_DEBUG_DRIVER is not set

# CONFIG_DEBUG_DEVRES is not set

# CONFIG_SYS_HYPERVISOR is not set

```

any other suggestions?

----------

## Kaso_da_Zmok

maybe this can make the difference:

try to change this:

```
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/" 
```

to this:

```
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware" 
```

----------

## ustone

ok....iirc i have read that the last / in path is importand...but i'll try...

additional info: its strange that turks is trying to load but missing radeon/BTC_rlc.bin??

```

cat /var/log/dmesg | sed -ne "348,375p"

drm] initializing kernel modesetting (TURKS 0x1002:0x6740 0x1028:0x04A3).

[drm] register mmio base: 0xE3820000

[drm] register mmio size: 131072

ATOM BIOS: Dell

radeon 0000:01:00.0: VRAM: 1024M 0x0000000000000000 - 0x000000003FFFFFFF (1024M used)

radeon 0000:01:00.0: GTT: 512M 0x0000000040000000 - 0x000000005FFFFFFF

[drm] Detected VRAM RAM=1024M, BAR=256M

[drm] RAM width 128bits DDR

[TTM] Zone  kernel: Available graphics memory: 4070636 kiB.

[TTM] Zone   dma32: Available graphics memory: 2097152 kiB.

[TTM] Initializing pool allocator.

[drm] radeon: 1024M of VRAM memory ready

[drm] radeon: 512M of GTT memory ready.

[drm] Supports vblank timestamp caching Rev 1 (10.10.2010).

[drm] Driver supports precise vblank timestamp query.

radeon 0000:01:00.0: irq 41 for MSI/MSI-X

radeon 0000:01:00.0: radeon: using MSI.

[drm] radeon: irq initialized.

[drm] GART: num cpu pages 131072, num gpu pages 131072

[drm] Loading TURKS Microcode

Refined TSC clocksource calibration: 2195.014 MHz.

Switching to clocksource tsc

ni_cp: Failed to load firmware "radeon/BTC_rlc.bin"

[drm:evergreen_startup] *ERROR* Failed to load firmware!

radeon 0000:01:00.0: disabling GPU acceleration

radeon 0000:01:00.0: ffff880220421800 unpin not necessary

radeon 0000:01:00.0: ffff880220421800 unpin not necessary

[drm:evergreen_init] *ERROR* radeon: MC ucode required for NI+.

```

----------

## Kaso_da_Zmok

what happens if you add the BTC to kernel?

```
[drm] Loading TURKS Microcode 

Refined TSC clocksource calibration: 2195.014 MHz. 

Switching to clocksource tsc 

ni_cp: Failed to load firmware "radeon/BTC_rlc.bin" 
```

it looks like turks is loaded , only the BTC is missing. the trailing slash '/' in the /lib/firmware/ you don't need to try without it, it is not causing the problem.

----------

## ustone

 :Very Happy:  too late i tried the slash and it doesn't solve the problem  :Smile: 

adding btc solve the problem....but i don't understand why in 3.2.1-rc1 this was not neccessary....

btw...what means btc?

----------

## Kaso_da_Zmok

AMD Fusion Chipset uses BTC_rlc.bin, what is the laptop model you have there?

don't know what BTC stands for. 

the card was not working without the BTC ?

----------

## ustone

dell precision m4600

strange for me was:

a couple of weeks ago i compiled kernel 3.2.1-rc2 and had problems..i tried all radeon firmware files and that worked..later is deleted all other firmware but turks and it worked too...this i can't explain...

this week i tried kernel 3.2.11 with same firmware config as 3.2.1 and it didn't worked...

so to your question:

it worked in 3.2.1-rc2 w/o btc and in 3.2.11 not......i have to reproduce that with a clean build in 3.2.1-rc2

----------

