How can I insert a file into the initramfs?

The title is the question itself, but let me explain here in more detail what I’m trying to do.

This is actually a step of a bigger problem I’m trying to solve:

What I’ve got so far:

Right now, I’m using openSUSE Leap 42.2 with that kernel:

# uname -a
Linux viny-notebook 4.11.4-1.gcba98ee-default #1 SMP PREEMPT Wed Jun 7 15:14:28 UTC 2017 (cba98ee) x86_64 x86_64 x86_64 GNU/Linux

With the kernel 4.11.4, those same messages appear. It seems the ath3k kernel module is trying to load the file AthrBT_0x31010100.dfu during boot time. It is located at /lib/firmware/ar3k/, I think it is part of the kernel-firmware package, which I also downloaded from the Kernel:stable OBS repo. As the kernel module does not find that file, it gives that error message in dmesg.

So, back to the title/question: how can I insert the file AthrBT_0x31010100.dfu into initramfs?

I decided to make that specific question in an specific forum (Install/Boot/Login) because everything I found on Google was meant to other distros and does not work on openSUSE. So maybe we can make this post a reference.

Thank you in advance!

man dracut.conf, search for “install_items” and similar.

1 Like

Thank you! You got right to the point!

$ man dracut.conf

...

       install_items+=" <file> <file> ...] "
           Specify additional files to include in the initramfs, separated by spaces.

...

# nano /etc/dracut.conf.d/01-bluetooth.conf

force_drivers+="ath3k btusb"
install_items+="/lib/firmware/ar3k/AthrBT_0x31010100.dfu /lib/firmware/ar3k/ramps_0x31010100_40.dfu"

# reboot

Actually, I started adding the first file. Then, looking at dmesg, it complained about the second. So, I added the second.

Now, it does not complain about missing files anymore, and it seems my Bluetooth adapter is correctly identified:

# dmesg | egrep -i 'ath|bluetooth|firm|hal|usb|wifi'
    0.507083] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
    2.637889] ACPI: bus type USB registered
    2.639206] usbcore: registered new interface driver usbfs
    2.640424] usbcore: registered new interface driver hub
    2.641676] usbcore: registered new device driver usb
    2.643414] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    2.647881] ehci-pci 0000:00:1d.0: new USB bus registered, assigned bus number 1
    2.670124] ehci-pci 0000:00:1d.0: USB 2.0 started, EHCI 1.00
    2.670228] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    2.670274] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    2.670320] usb usb1: Product: EHCI Host Controller
    2.670353] usb usb1: Manufacturer: Linux 4.11.4-1.gcba98ee-default ehci_hcd
    2.670399] usb usb1: SerialNumber: 0000:00:1d.0
    2.670580] hub 1-0:1.0: USB hub found
    2.671150] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 2
    2.672493] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
    2.672539] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    2.672585] usb usb2: Product: xHCI Host Controller
    2.672618] usb usb2: Manufacturer: Linux 4.11.4-1.gcba98ee-default xhci-hcd
    2.672664] usb usb2: SerialNumber: 0000:00:14.0
    2.672846] hub 2-0:1.0: USB hub found
    2.675907] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 3
    2.676533] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
    2.676578] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    2.676625] usb usb3: Product: xHCI Host Controller
    2.676656] usb usb3: Manufacturer: Linux 4.11.4-1.gcba98ee-default xhci-hcd
    2.676702] usb usb3: SerialNumber: 0000:00:14.0
    2.676877] hub 3-0:1.0: USB hub found
    2.678002] usb: port power management may be unreliable
    3.002146] usb 1-1: new high-speed USB device number 2 using ehci-pci
**    3.002156] usb 2-5: new full-speed USB device number 2 using xhci_hcd**
**    3.143037] usb 2-5: New USB device found, idVendor=04ca, idProduct=3014**
**    3.143038] usb 2-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0**
**    3.147120] Bluetooth: Core ver 2.22**
**    3.147139] Bluetooth: HCI device and connection manager initialized**
**    3.147141] Bluetooth: HCI socket layer initialized**
**    3.147143] Bluetooth: L2CAP socket layer initialized**
**    3.147147] Bluetooth: SCO socket layer initialized**
**    3.148116] usbcore: registered new interface driver btusb**
    3.150432] usb 1-1: New USB device found, idVendor=8087, idProduct=8001
    3.150433] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    3.150586] hub 1-1:1.0: USB hub found
**    3.153192] usbcore: registered new interface driver ath3k**
    3.262136] usb 2-7: new high-speed USB device number 3 using xhci_hcd
    3.411404] usb 2-7: New USB device found, idVendor=1bcf, idProduct=2c81
    3.411406] usb 2-7: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    3.411406] usb 2-7: Product: HD WebCam
    3.411407] usb 2-7: Manufacturer: NC2141103M50708908LM05
    3.530196] usb 2-8: new high-speed USB device number 4 using xhci_hcd
    3.670580] usb 2-8: New USB device found, idVendor=0bda, idProduct=0129
    3.670584] usb 2-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    3.670586] usb 2-8: Product: USB2.0-CRW
    3.670588] usb 2-8: Manufacturer: Generic
    3.670590] usb 2-8: SerialNumber: 20100201396000000
**    3.671308] usb 2-5: USB disconnect, device number 2**
    3.675887] usbcore: registered new interface driver rtsx_usb
**    3.934183] usb 2-5: new full-speed USB device number 5 using xhci_hcd**
**    9.323353] usb 2-5: New USB device found, idVendor=04ca, idProduct=3014**
**    9.324077] usb 2-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0**
**   14.476841] usb 2-5: USB disconnect, device number 5**
   14.919635] ath: phy0: WB335 2-ANT card detected
   14.923495] ath: phy0: Set BT/WLAN RX diversity capability
   14.934042] ath: phy0: Enable LNA combining
   14.936330] ath: phy0: ASPM enabled: 0x42
   14.937453] ath: EEPROM regdomain: 0x6c
   14.937454] ath: EEPROM indicates we should expect a direct regpair map
   14.937455] ath: Country alpha2 being used: 00
   14.937455] ath: Regpair used: 0x6c
   15.108629] ieee80211 phy0: Atheros AR9565 Rev:2 mem=0xffffa29f41c00000, irq=19
   17.131412] input: HD WebCam as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/input/input22
   17.132859] usbcore: registered new interface driver uvcvideo
   17.134202] USB Video Class driver (1.1.1)
   27.872910] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
   27.876028] Bluetooth: BNEP filters: protocol multicast
   27.877987] Bluetooth: BNEP socket layer initialized

But I’m concerned about those lines:

    3.671308] usb 2-5: USB disconnect, device number 2

...

   14.476841] usb 2-5: USB disconnect, device number 5

During this boot, my Bluetooth adapter was disconnected twice!

Also, I’m not able to use it. GNOME says there is no Bluetooth found. Indeed, it is not listed by lsusb:

# lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 002 Device 003: ID 1bcf:2c81 Sunplus Innovation Technology Inc. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Do you have any idea on why that is happening? And/or what could I try next?

The original question of this post (How can I insert a file into the initramfs?) has been answered, should I add [SOLVED] to it?

1 Like

I gave up. Instead of spending more time trying to make my built-in Bluetooth adapter work on Linux, I bought an USB adapter that actually works on Linux, more info here.

Anyways, the original question of this post has been answered, so I marked this thread as solved adding a solved tag to it, according to HOW TO!! Mark a Thread SOLVED!

Thank you!