]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-install: Add support for compressed firmware files
authorTakashi Iwai <tiwai@suse.de>
Wed, 8 May 2019 05:12:06 +0000 (07:12 +0200)
committerDaniel Molkentin <daniel@molkentin.de>
Thu, 18 Jul 2019 16:39:56 +0000 (18:39 +0200)
The upcoming kernel will have a support for loading compressed
firmware files, and this patch corresponds to that kernel change.
When a firmware file with the extra .xz extension is found, dracut
copies to initrd as fallback.  Since initrd itself is compressed, the
file is uncompressed in initrd beforehand.

dracut-init.sh

index 50d23e2d110dd1f220eb134e7a5cb5adf3211277..1ebafff7b96247f99896e6d9f9c1cd0aee93954f 100644 (file)
@@ -917,8 +917,16 @@ install_kmod_with_fw() {
     for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
         _found=''
         for _fwdir in $fw_dir; do
-            [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
-            inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
+            [[ -d $_fwdir ]] || continue
+            if [[ -f $_fwdir/$_fw ]]; then
+                inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
+            elif [[ -f $_fwdir/$_fw.xz ]]; then
+                inst_simple "$_fwdir/$_fw.xz" "/lib/firmware/$_fw.xz"
+                rm -f "${initdir}/lib/firmware/$_fw"
+                unxz -f "${initdir}/lib/firmware/$_fw.xz"
+            else
+               continue
+            fi
             _found=yes
         done
         if [[ $_found != yes ]]; then