65 lines
2.8 KiB
Bash
65 lines
2.8 KiB
Bash
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
DOWNLOAD="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${BPM_PKG_VERSION}.tar.gz"
|
|
FILENAME="${DOWNLOAD##*/}"
|
|
|
|
# The prepare function is executed in the root of the temp directory
|
|
# This function is used for downloading files and putting them into the correct location
|
|
prepare() {
|
|
wget "$DOWNLOAD"
|
|
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
|
|
}
|
|
|
|
build() {
|
|
# Create temporary directory for firmware installation
|
|
install -dm755 "$BPM_SOURCE"/temp
|
|
|
|
# Install and compress firmware files
|
|
ZSTD_CLEVEL=19 make -j1 install-zst FIRMWAREDIR=/usr/lib/firmware/ DESTDIR="$BPM_SOURCE"/temp
|
|
make dedup FIRMWAREDIR=/usr/lib/firmware/ DESTDIR="$BPM_SOURCE"/temp
|
|
}
|
|
|
|
package_linux-firmware-whence() {
|
|
# Install whence file
|
|
install -Dm644 WHENCE "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/WHENCE
|
|
}
|
|
|
|
# Function for packaging AMD CPU and GPU microcode
|
|
package_linux-firmware-amd() {
|
|
# Copy firmware files to amd package
|
|
install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/
|
|
mv temp/usr/lib/firmware/amd* "$BPM_OUTPUT"/usr/lib/firmware/
|
|
mv temp/usr/lib/firmware/radeon "$BPM_OUTPUT"/usr/lib/firmware/
|
|
|
|
# Install package licenses
|
|
install -Dm644 LICENSE.amdgpu "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.amdgpu
|
|
install -Dm644 LICENSE.amd-ucode "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.amd-ucode
|
|
install -Dm644 LICENSE.radeon "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.radeon
|
|
|
|
# Create dracut config for amd microcode
|
|
install -dm755 "$BPM_OUTPUT"/usr/lib/dracut/dracut.conf.d
|
|
echo "early_microcode=yes" >> "$BPM_OUTPUT"/usr/lib/dracut/dracut.conf.d/amd_ucode.conf
|
|
}
|
|
|
|
# Function for packaging Intel CPU and GPU microcode
|
|
package_linux-firmware-intel() {
|
|
# Copy firmware files to intel package
|
|
install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/
|
|
mv temp/usr/lib/firmware/i915 "$BPM_OUTPUT"/usr/lib/firmware/
|
|
|
|
# Install package license
|
|
install -Dm644 LICENSE.i915 "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/intel/LICENSE.i915
|
|
}
|
|
|
|
# Function for packaging Nvidia GPU microcode
|
|
package_linux-firmware-nvidia() {
|
|
# Copy firmware files to nvidia package
|
|
install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/
|
|
mv temp/usr/lib/firmware/nvidia "$BPM_OUTPUT"/usr/lib/firmware/
|
|
|
|
# Install package license
|
|
install -Dm644 LICENCE.nvidia "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/nvidia/LICENSE.nvidia
|
|
}
|