* What is the minimal set of firmware files I need for my hardware? @ 2020-05-04 10:26 Doron Behar 2020-05-04 10:45 ` Greg KH 0 siblings, 1 reply; 5+ messages in thread From: Doron Behar @ 2020-05-04 10:26 UTC (permalink / raw) To: kernelnewbies I hope this question fits to this List. Today I learned that my distro's `linux-unfree-firmware` package is 491 Mb in size. I'm pretty sure my hardware doesn't need all of these files. Maybe different Linux distros call this package differently, but I'm talking about the firmware files that come from: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ I think I can reduce this disk usage if I'll only know what files I can exclude from there. Is there any official documentation, that states exactly what files from That git repo are needed per device / computer model? Perhaps the official documentation of my Computer's hardware will state that? There's a Linux from scratch webpage[1] that gives some info for popular hardware, but I'm wondering if there's a bit more "official" information available somewhere. [1]: http://linuxfromscratch.org/blfs/view/svn/postlfs/firmware.html Thanks. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the minimal set of firmware files I need for my hardware? 2020-05-04 10:26 What is the minimal set of firmware files I need for my hardware? Doron Behar @ 2020-05-04 10:45 ` Greg KH 2020-05-04 12:56 ` Doron Behar 0 siblings, 1 reply; 5+ messages in thread From: Greg KH @ 2020-05-04 10:45 UTC (permalink / raw) To: kernelnewbies On Mon, May 04, 2020 at 01:26:35PM +0300, Doron Behar wrote: > I hope this question fits to this List. > > Today I learned that my distro's `linux-unfree-firmware` package is 491 > Mb in size. I'm pretty sure my hardware doesn't need all of these files. > Maybe different Linux distros call this package differently, but I'm talking > about the firmware files that come from: > https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ > > I think I can reduce this disk usage if I'll only know what files > I can exclude from there. > > Is there any official documentation, that states exactly what files from > That git repo are needed per device / computer model? Perhaps the official > documentation of my Computer's hardware will state that? There's a Linux > from scratch webpage[1] that gives some info for popular hardware, but I'm > wondering if there's a bit more "official" information available > somewhere. > > [1]: http://linuxfromscratch.org/blfs/view/svn/postlfs/firmware.html The kernel macro MODULE_FIRMWARE() will show the firmware file that a specific kernel module needs. So if you look a the output of modinfo for all of the modules that your system needs, you will see a "firmware" line that shows the name that your hardware needs for that specific driver/module. Just take those specific files and put them on your disk and you should be fine. Note, I think tools that generate initrd images can do this automatically, so perhaps you should look at what they do as an example for this. Hope this helps, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the minimal set of firmware files I need for my hardware? 2020-05-04 10:45 ` Greg KH @ 2020-05-04 12:56 ` Doron Behar 2020-05-04 13:06 ` Greg KH 0 siblings, 1 reply; 5+ messages in thread From: Doron Behar @ 2020-05-04 12:56 UTC (permalink / raw) To: kernelnewbies On Mon, May 04, 2020 at 12:45:55PM +0200, Greg KH wrote: > On Mon, May 04, 2020 at 01:26:35PM +0300, Doron Behar wrote: > > I hope this question fits to this List. > > > > Today I learned that my distro's `linux-unfree-firmware` package is 491 > > Mb in size. I'm pretty sure my hardware doesn't need all of these files. > > Maybe different Linux distros call this package differently, but I'm talking > > about the firmware files that come from: > > https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ > > > > I think I can reduce this disk usage if I'll only know what files > > I can exclude from there. > > > > Is there any official documentation, that states exactly what files from > > That git repo are needed per device / computer model? Perhaps the official > > documentation of my Computer's hardware will state that? There's a Linux > > from scratch webpage[1] that gives some info for popular hardware, but I'm > > wondering if there's a bit more "official" information available > > somewhere. > > > > [1]: http://linuxfromscratch.org/blfs/view/svn/postlfs/firmware.html > > The kernel macro MODULE_FIRMWARE() will show the firmware file that a > specific kernel module needs. So if you look a the output of modinfo > for all of the modules that your system needs, you will see a "firmware" > line that shows the name that your hardware needs for that specific > driver/module. Thanks for replying greg, So I have the command `modinfo` available, should I just iterate _all_ the files in /usr/lib/modules/5.6.7/kernel ? For example: ``` $ modinfo /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz filename: /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz author: Dmitry Eremin-Solenikov description: IEEE 802.15.4 configuration interface license: GPL v2 depends: retpoline: Y intree: Y name: ieee802154 vermagic: 5.6.7 SMP mod_unload sig_id: PKCS#7 signer: sig_key: sig_hashalgo: unknown signature: ``` Doesn't seem informative regarding firmware files. Should I expect other .ko.xz files to give a line with `firmware: `? Plus, how do I know what modules does my system need and which it doesn't? Doron. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the minimal set of firmware files I need for my hardware? 2020-05-04 12:56 ` Doron Behar @ 2020-05-04 13:06 ` Greg KH 2020-05-04 15:20 ` Doron Behar 0 siblings, 1 reply; 5+ messages in thread From: Greg KH @ 2020-05-04 13:06 UTC (permalink / raw) To: kernelnewbies On Mon, May 04, 2020 at 03:56:40PM +0300, Doron Behar wrote: > On Mon, May 04, 2020 at 12:45:55PM +0200, Greg KH wrote: > > On Mon, May 04, 2020 at 01:26:35PM +0300, Doron Behar wrote: > > > I hope this question fits to this List. > > > > > > Today I learned that my distro's `linux-unfree-firmware` package is 491 > > > Mb in size. I'm pretty sure my hardware doesn't need all of these files. > > > Maybe different Linux distros call this package differently, but I'm talking > > > about the firmware files that come from: > > > https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ > > > > > > I think I can reduce this disk usage if I'll only know what files > > > I can exclude from there. > > > > > > Is there any official documentation, that states exactly what files from > > > That git repo are needed per device / computer model? Perhaps the official > > > documentation of my Computer's hardware will state that? There's a Linux > > > from scratch webpage[1] that gives some info for popular hardware, but I'm > > > wondering if there's a bit more "official" information available > > > somewhere. > > > > > > [1]: http://linuxfromscratch.org/blfs/view/svn/postlfs/firmware.html > > > > The kernel macro MODULE_FIRMWARE() will show the firmware file that a > > specific kernel module needs. So if you look a the output of modinfo > > for all of the modules that your system needs, you will see a "firmware" > > line that shows the name that your hardware needs for that specific > > driver/module. > > Thanks for replying greg, > > So I have the command `modinfo` available, should I just iterate _all_ > the files in /usr/lib/modules/5.6.7/kernel ? For example: No, don't iterate all kernel modules, unless you only built the modules that you know you need for your hardware (like you can get by running 'make localmodconfig'). > > ``` > $ modinfo /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz > filename: /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz > author: Dmitry Eremin-Solenikov > description: IEEE 802.15.4 configuration interface > license: GPL v2 > depends: > retpoline: Y > intree: Y > name: ieee802154 > vermagic: 5.6.7 SMP mod_unload > sig_id: PKCS#7 > signer: > sig_key: > sig_hashalgo: unknown > signature: > ``` > > Doesn't seem informative regarding firmware files. Should I expect other > .ko.xz files to give a line with `firmware: `? Yes, try looking at btrtl.ko for an example. The module you picked above does not need any firmware to control the hardware it manages (hint, it's not a driver for any specific hardware, just a protocol that other drivers use.) > Plus, how do I know what modules does my system need and which it > doesn't? That's up to you to figure out if you are building your own kernel image. As I mentioned above, the 'make localmodconfig' is a nice quick shortcut to get that done, I recommend using it by doing: - boot a distro kernel - plug in all devices you want to support - run 'make localmodconfig' to create a .config file based only on the modules you have loaded in the system at that point in time. - build the kernel with that .config file hope this helps, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the minimal set of firmware files I need for my hardware? 2020-05-04 13:06 ` Greg KH @ 2020-05-04 15:20 ` Doron Behar 0 siblings, 0 replies; 5+ messages in thread From: Doron Behar @ 2020-05-04 15:20 UTC (permalink / raw) To: kernelnewbies On Mon, May 04, 2020 at 03:06:10PM +0200, Greg KH wrote: > On Mon, May 04, 2020 at 03:56:40PM +0300, Doron Behar wrote: > > On Mon, May 04, 2020 at 12:45:55PM +0200, Greg KH wrote: > > > On Mon, May 04, 2020 at 01:26:35PM +0300, Doron Behar wrote: > > > > I hope this question fits to this List. > > > > > > > > Today I learned that my distro's `linux-unfree-firmware` package is 491 > > > > Mb in size. I'm pretty sure my hardware doesn't need all of these files. > > > > Maybe different Linux distros call this package differently, but I'm talking > > > > about the firmware files that come from: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ > > > > > > > > I think I can reduce this disk usage if I'll only know what files > > > > I can exclude from there. > > > > > > > > Is there any official documentation, that states exactly what files from > > > > That git repo are needed per device / computer model? Perhaps the official > > > > documentation of my Computer's hardware will state that? There's a Linux > > > > from scratch webpage[1] that gives some info for popular hardware, but I'm > > > > wondering if there's a bit more "official" information available > > > > somewhere. > > > > > > > > [1]: http://linuxfromscratch.org/blfs/view/svn/postlfs/firmware.html > > > > > > The kernel macro MODULE_FIRMWARE() will show the firmware file that a > > > specific kernel module needs. So if you look a the output of modinfo > > > for all of the modules that your system needs, you will see a "firmware" > > > line that shows the name that your hardware needs for that specific > > > driver/module. > > > > Thanks for replying greg, > > > > So I have the command `modinfo` available, should I just iterate _all_ > > the files in /usr/lib/modules/5.6.7/kernel ? For example: > > No, don't iterate all kernel modules, unless you only built the modules > that you know you need for your hardware (like you can get by running > 'make localmodconfig'). > > > > > ``` > > $ modinfo /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz > > filename: /usr/lib/modules/5.6.7/kernel/net/ieee802154/ieee802154.ko.xz > > author: Dmitry Eremin-Solenikov > > description: IEEE 802.15.4 configuration interface > > license: GPL v2 > > depends: > > retpoline: Y > > intree: Y > > name: ieee802154 > > vermagic: 5.6.7 SMP mod_unload > > sig_id: PKCS#7 > > signer: > > sig_key: > > sig_hashalgo: unknown > > signature: > > ``` > > > > Doesn't seem informative regarding firmware files. Should I expect other > > .ko.xz files to give a line with `firmware: `? > > Yes, try looking at btrtl.ko for an example. > > The module you picked above does not need any firmware to control the > hardware it manages (hint, it's not a driver for any specific hardware, > just a protocol that other drivers use.) Cool! I see it now. > > Plus, how do I know what modules does my system need and which it > > doesn't? > > That's up to you to figure out if you are building your own kernel > image. > > As I mentioned above, the 'make localmodconfig' is a nice quick shortcut > to get that done, I recommend using it by doing: > - boot a distro kernel > - plug in all devices you want to support > - run 'make localmodconfig' to create a .config file based only > on the modules you have loaded in the system at that point in > time. > - build the kernel with that .config file OK! I did all that, and ran make afterwards. Now, I got a few .ko files found in the build directory, and it seems that these are definitely just a selection of those found in my distro's kernel. I ran then: find -name '*.ko' -exec modinfo {} \; | grep '^firmware:' So if I understand correctly. The files listed in the output of this command are the only files I do need, assuming all of the modules where loaded when I ran `make localmodconfig`. I was connected to a WiFi network and I connected to a Bluetooth device prior to running `make localmodconfig` - just to make sure I used all of my hardware and that all of the kernel modules that might be relevant were loaded. I guess that now I just have to download these files only from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ > > hope this helps, > > greg k-h > Thank you greg for you help and guidance :). _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-04 15:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-04 10:26 What is the minimal set of firmware files I need for my hardware? Doron Behar 2020-05-04 10:45 ` Greg KH 2020-05-04 12:56 ` Doron Behar 2020-05-04 13:06 ` Greg KH 2020-05-04 15:20 ` Doron Behar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).