Add GPU Firmware To BOOTKERNFW

From RCS Wiki
Revision as of 14:33, 10 September 2018 by SiteAdmin (talk | contribs) (Update for squashfs)
Jump to navigation Jump to search

Using Debian (or installed linux of choice)

Make sure squashfs-tools is installed

$ apt install squashfs-tools

Generate Image (tmp/firmware should contain the missing firmware that is complained about when booting. E.g. "radeon/PITCAIRN_pfp.bin" or "amdgpu/polaris10_mc.bin")

$ cd tmp/firmware
$ /usr/bin/.mksquashfs * /boot/firmware_squashfs_image.bin -all-root -keep-as-directory

Petitboot

Reboot into petitboot shell.

Make sure you can see BOOTKRNFW (should return: mtd5: 000e0000 00010000 "BOOTKERNFW"):

$ cat /proc/mtd | grep BOOTKERNFW

Find flash_erase (mine was in /var/petitboot/mnt/dev/nvme0n1p2/usr/sbin/):

$ find / -name flash_erase

Erase /dev/mtd5:

$ /var/petitboot/mnt/dev/nvme0n1p2/usr/sbin/./flash_erase /dev/mtd5 0 0

Flash /dev/mtd5:

$ dd if=/var/petitboot/mnt/dev/nvme0n1p2/boot/firmware_squashfs_image.bin of=/dev/mtd5 bs=64k

Reboot back into petitboot shell and check to see if the firmware made it as expected:

$ ls /lib/firmware/


Note: If you are still getting an error message about not being able to find vga bios, it may be because your gpu is being initialized before /lib/firmware is mounted. You can check this by running dmesg from petitboot. E.g. My gpu was trying to initialize around 6.5 seconds and the mtd wasn't actually mounted until 7.25... I was able to successfully load the firmware after after /dev/mtd5 was mounted by running "rmmod amdgpu && modprobe amdgpu" from petitboot. However, I did experience stability issues in Debian Stretch with amdgpu. However, if I let petitboot fail to load the firmware and boot anyway, the radeon driver works fine.

E.g.

$ dmesg
...
[    6.412518] [drm] radeon kernel modesetting enabled.
[    6.412848] pci 0033:00:00.0: enabling device (0105 -> 0107)
[    6.412867] radeon 0033:01:00.0: enabling device (0140 -> 0142)
[    6.413077] [drm] initializing kernel modesetting (PITCAIRN 0x1002:0x6819 0x1043:0x0431 0x00).
[    6.413086] radeon: No suitable DMA available
[    6.413150] [drm:radeon_device_init] *ERROR* Unable to find PCI I/O BAR
[    6.533321] [drm:radeon_atombios_init] *ERROR* Unable to find PCI I/O BAR; using MMIO for ATOM IIO
[    6.533415] ATOM BIOS: 6819.15.17.0.0.AS01
[    6.533434] [drm] GPU not posted. posting now...
[    6.541203] radeon 0033:01:00.0: VRAM: 2048M 0x0000000000000000 - 0x000000007FFFFFFF (2048M used)
[    6.541208] radeon 0033:01:00.0: GTT: 2048M 0x0000000080000000 - 0x00000000FFFFFFFF
[    6.541211] [drm] Detected VRAM RAM=2048M, BAR=256M
[    6.541213] [drm] RAM width 256bits DDR
[    6.541295] [TTM] Zone  kernel: Available graphics memory: 50118240 kiB
[    6.541297] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[    6.541299] [TTM] Initializing pool allocator
[    6.541371] [drm] radeon: 2048M of VRAM memory ready
[    6.541374] [drm] radeon: 2048M of GTT memory ready.
[    6.541390] [drm] Loading pitcairn Microcode
[    6.541429] radeon 0033:01:00.0: Direct firmware load for radeon/pitcairn_pfp.bin failed with error -2
[    6.541456] radeon 0033:01:00.0: Direct firmware load for radeon/PITCAIRN_pfp.bin failed with error -2
[    6.541459] si_cp: Failed to load firmware "radeon/PITCAIRN_pfp.bin"
[    6.541560] [drm:si_init] *ERROR* Failed to load firmware!
[    6.541653] radeon 0033:01:00.0: Fatal error during GPU init
[    6.541772] [drm] radeon: finishing device.
...
[    7.123614] 6 ofpart partitions found on MTD device flash
[    7.123617] Creating 6 MTD partitions on "flash":
[    7.123621] 0x000000000000-0x000004000000 : "PNOR"
[    7.123773] 0x000001b21000-0x000003a21000 : "BOOTKERNEL"
[    7.123868] 0x000003b44000-0x000003b68000 : "CAPP"
[    7.123961] 0x000003b88000-0x000003b89000 : "VERSION"
[    7.124056] 0x000003b89000-0x000003bc9000 : "IMA_CATALOG"
[    7.124149] 0x000003f10000-0x000003ff0000 : "BOOTKERNFW"
...
$ rmmod amdgpu && modprobe amdgpu
$ dmesg
...
[ 2727.836343] [drm] amdgpu kernel modesetting enabled.
[ 2727.836900] amdgpu 0033:01:00.0: SI support provided by radeon.
[ 2727.836905] amdgpu 0033:01:00.0: Use radeon.si_support=0 amdgpu.si_support=1 to override.