# kernel.SlackBuild helper 'source/k/platform/aarch64/fw-amdgpu' # # 16-May-2024 # # Note: This script is executed when the shell's working directory # is set to the root of the OS InitRD. # # Add AMD GPU firmware for known/tested AMD GPU's. # # AMD GPU hardware: AMD RX550 4GB GPU # Used by Hardware Models: Honey Comb LX2. # # This adds just >500K to the OS InitRD. # Reference method to determine which firmware is required: # https://wiki.gentoo.org/wiki/AMDGPU#Firmware_blobs_for_a_known_card_model # We're masking this out since we don't need to include the firmware within # the OS InitRD in order for basic video (just enough to see the system boot) # to function. # # This code remains here for future implementation reference. function branch_past_amdgpu() { # Extract the AMD GPU firmware from the Slackware a/kernel-firmware package # into a temporary location: echo "Adding AMD GPU firmware into $PWD" mkdir -p $TMPBUILD/fw-amdgpu-extract tar -C $TMPBUILD/fw-amdgpu-extract/ -xf $PKGSTORE/a/kernel-firmware-*.t?z lib/firmware/amdgpu/ # Extract the package installation script so we can grab the symlinks: tar -C $TMPBUILD/fw-amdgpu-extract/ -xf $PKGSTORE/a/kernel-firmware-*.t?z install/doinst.sh pushd $TMPBUILD/fw-amdgpu-extract/ # Expect errors from here since we are trying to make symlinks in directories that # we haven't extracted/created: ( grep -E '^\( cd .*(rm|ln)' install/doinst.sh | bash ) 2>/dev/null popd # Move the required firmware into the OS InitRD's root directory along with # the rest of the packaged firmware: pushd $TMPBUILD/fw-amdgpu-extract/lib/firmware/amdgpu # Create the directory within the OS InitRD to hold it: mkdir -vpm755 $TMPBUILD/initrd-tree/lib/firmware/amdgpu # We copy the symlinks and their targets: mv -fv \ polaris10_{sdma,sdma1,uvd,vce}.bin \ polaris12_{ce,ce_2,k_mc,k_smc,mc,me,me_2,mec,mec2,mec2_2,mec_2,pfp,pfp_2,rlc,sdma,sdma1,smc,uvd,vce}.bin \ $TMPBUILD/initrd-tree/lib/firmware/amdgpu/ popd # Compress the firmware: xz -vze9 $TMPBUILD/initrd-tree/lib/firmware/amdgpu/* # Fix any broken symlinks caused by the compression process: pushd $TMPBUILD/initrd-tree/lib/firmware/amdgpu ( find . -type l -not -name '*.xz' -printf "rm -f %P ; ln -s %l.xz %p.xz\n" ) | /bin/bash popd }