Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dracut: how to include a whole directory
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
pablo_supertux
Advocate
Advocate


Joined: 25 Jan 2004
Posts: 2953
Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)

PostPosted: Sun Jan 31, 2021 1:06 am    Post subject: dracut: how to include a whole directory Reply with quote

Hi

I've recently started using dracut to build my initrd images. I have an Nvidia GTX 1050 Ti and I use nouveau (built in, not as module)

I see this in dmesg:

Code:

[    0.887768] nouveau 0000:01:00.0: NVIDIA GP107 (137000a1)
[    0.996180] nouveau 0000:01:00.0: bios: version 86.07.42.00.5b
[    0.996370] nouveau 0000:01:00.0: gr: failed to load firmware "gr/sw_ctx"
[    0.996373] nouveau 0000:01:00.0: gr: failed to load gr/sw_ctx
[    0.996599] nouveau 0000:01:00.0: fb: 4096 MiB GDDR5


I've found this thread but it has no solution that I can use. In /lib/firmware/nvidia/gp107/gr/ there are more than the sw_ctx.bin file and some of them are symlinks to other files, so adding only sw_ctx.bin did not help. Adding a single file was easy, just add install_items+=" /lib/firmware/nvidia/gp107/gr/sw_ctx.bin" to /etc/dracut.conf. And it does include the file, but like I said, that didn't help, I presume because the other files are missing.

However I cannot find a way to add a whole directory with dracut. Something like this install_items+=" /lib/firmware/nvidia/**/**" did only work partially, one some files were included but not all. As far as I can see in man dracut.conf there is no variable that allows you to do that, you can only do that from the command line: dracut -i /lib/firmware/nvidia /lib/firmware/nvidia ... which it's not great.

Is there a better way?

Mod edit: Potentially confusing typo in thread title corrected. — JRG
_________________
A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth!
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3953

PostPosted: Sun Jan 31, 2021 1:50 am    Post subject: Reply with quote

Hi

Have you tried capital -I?

from dracut --help
Code:

  -I, --install [LIST]  Install the space separated list of files into theinitramfs.

something like
Code:

dracut -I /lib/firmware/nvidia/gp107/gr/{file1,file2,filen} ###OR perhaps
dracut -I $(find /lib/firmware/nvidia -type f)

If this doesnt work maybe the
Code:

--early-microcode

flag would work..
You can enter all your config in
/etc/dracut.conf.d/<gentoo?>.conf
Please find a sample in
Code:

 bzcat /usr/share/man/man5/dracut.conf.5.bz2

_________________
:)
Back to top
View user's profile Send private message
pablo_supertux
Advocate
Advocate


Joined: 25 Jan 2004
Posts: 2953
Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)

PostPosted: Mon Feb 01, 2021 12:21 am    Post subject: Reply with quote

I know that I can use a command line option, but that's too much typing, I'd rather have this in the config file but that seems not to be possible at all, unless you put every single file in install_items.
_________________
A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth!
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3953

PostPosted: Mon Feb 01, 2021 7:34 am    Post subject: Reply with quote

Please try the --early-microcode flag.
_________________
:)
Back to top
View user's profile Send private message
DespLock
n00b
n00b


Joined: 27 Jul 2020
Posts: 65

PostPosted: Mon Feb 01, 2021 11:08 am    Post subject: Reply with quote

Quote:

However I cannot find a way to add a whole directory with dracut.


You can add this to the ebuild of linux-firmware to be executed each time the firmware is updated/reinstalled.

create "/etc/portage/env/sys-kernel/linux-firmware":
Code:

pkg_postinst()
{
    files_to_add=$(find /lib/firmware/nvidia/gp107/gr/ -type f | tr "\n" " ")
    echo "install_items+=\" $files_to_add \"" > /etc/dracut.conf.d/20-install-nvidia-firmware.conf
}



P. S: Remove the list from your default dracut.conf if it exists.
Back to top
View user's profile Send private message
pablo_supertux
Advocate
Advocate


Joined: 25 Jan 2004
Posts: 2953
Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)

PostPosted: Tue Feb 02, 2021 12:26 am    Post subject: Reply with quote

[quote="DespLock"]
Quote:

However I cannot find a way to add a whole directory with dracut.


You can add this to the ebuild of linux-firmware to be executed each time the firmware is updated/reinstalled.

create "/etc/portage/env/sys-kernel/linux-firmware":
Code:

pkg_postinst()
{
    files_to_add=$(find /lib/firmware/nvidia/gp107/gr/ -type f | tr "\n" " ")
    echo "install_items+=\" $files_to_add \"" > /etc/dracut.conf.d/20-install-nvidia-firmware.conf
}



P. S: Remove the list from your default dracut.conf if it exists.
alamahant wrote:
I'll try that.

[quote="alamahant"]Please try the --early-microcode flag.


I'll take a look at that.
_________________
A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth!
Back to top
View user's profile Send private message
mega_flow
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2016
Posts: 97
Location: Belgium

PostPosted: Tue Feb 02, 2021 6:34 pm    Post subject: Reply with quote

u need to add the entry 2 time
install_items+=" /lib/firmware/nvidia/gp107/gr/sw_ctx.bin /lib/firmware/nvidia/gp107/gr/sw_ctx.bin" first is the file to include the second is te Location inside the initram
_________________
default/linux/amd64/23.0/no-multilib/systemd gnome:47.2
Legion Slim 5 16ARP9
intel haswell h97i homeserver
SteamDeck
Back to top
View user's profile Send private message
DespLock
n00b
n00b


Joined: 27 Jul 2020
Posts: 65

PostPosted: Tue Feb 02, 2021 10:13 pm    Post subject: Reply with quote

mega_flow wrote:
Quote:

u need to add the entry 2 time
install_items+=" /lib/firmware/nvidia/gp107/gr/sw_ctx.bin /lib/firmware/nvidia/gp107/gr/sw_ctx.bin" first is the file to include the second is te Location inside the initram



That's not what "man dracut.conf" says:
Quote:

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


Path is exactly the same as the path of the file with initram root as base. No need to include each file twice ;).
Back to top
View user's profile Send private message
Hamlet
Apprentice
Apprentice


Joined: 15 Apr 2005
Posts: 152
Location: Turin (Italy)

PostPosted: Thu Feb 27, 2025 6:20 am    Post subject: Reply with quote

Dracut 106 seems to support wildcards:
Code:
install_items+=" /lib/firmware/iwlwifi-cc-a0-*.ucode "
install_items+=" /lib/firmware/regulatory.db* "

seems to pick all iwlwifi firmware blobs and the two regulatory DB.
I don't know when this undocumented feature was introduced.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum