Skip to content

Instantly share code, notes, and snippets.

@carlosrogue
Last active December 2, 2024 01:31
Show Gist options
  • Save carlosrogue/8fdf3cac49edb56a699f5c200103afb5 to your computer and use it in GitHub Desktop.
Save carlosrogue/8fdf3cac49edb56a699f5c200103afb5 to your computer and use it in GitHub Desktop.
How to download missing the firmware files when running the update-initramfs command
#!/bin/bash
# Usage: ./firmware.sh "W: Possible missing firmware /lib/firmware/amdgpu/sienna_cichlid_dmcub.bin for module amdgpu"
# or, save all firmware errors in a file:
# cat missing-firmware.txt | xargs -I % ./firmware.sh %
download() {
firmware=$(echo $1 | awk '{ print $5}')
module=$(echo $firmware | awk -F/ '{ print $4 }')
bin=$(echo $firmware | awk -F/ '{ print $5 }')
#https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/amdgpu/arcturus_asd.bin
url=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/$module/$bin
sudo mkdir -p /lib/firmware/$module
name=$(echo $1 | awk '{ print $(NF) }')
echo "Downloading missing firmware $bin for module $name"
sudo curl -sL --output /lib/firmware/$module/$bin $url
}
if [[ -n $1 ]]
then
download $1
fi
@carlosrogue
Copy link
Author

$ cat missing-firmware.txt | xargs -I % ./firmware.sh %
Downloading missing firmware rtl8125b-2.fw for module r8169
Downloading missing firmware vangogh_gpu_info.bin for module amdgpu
Downloading missing firmware navi12_gpu_info.bin for module amdgpu
Downloading missing firmware arcturus_gpu_info.bin for module amdgpu
Downloading missing firmware polaris12_32_mc.bin for module amdgpu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment