# Description: Intel CPU microcode update
# URL: https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: iucode-tool

name=intel-ucode
version=20230613
release=1
source=(https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-$version.tar.gz)

build() {
  cd Intel-Linux-Processor-Microcode-Data-Files-microcode-$version

  rm -f intel-ucode{,-with-caveats}/list
  mkdir -p kernel/x86/microcode
  iucode_tool -w kernel/x86/microcode/GenuineIntel.bin \
    intel-ucode/ intel-ucode-with-caveats/
  echo kernel/x86/microcode/GenuineIntel.bin | \
     cpio -o -H newc -R 0:0 > intel-ucode.img
  install -D -m0644 intel-ucode.img $PKG/boot/intel-ucode.img
}
