amd64-microcode: create early load microcode image
authorTomasz Maciej Nowak <tomek_n@o2.pl>
Wed, 31 Oct 2018 17:48:38 +0000 (18:48 +0100)
committerJohn Crispin <john@phrozen.org>
Mon, 26 Nov 2018 11:05:45 +0000 (12:05 +0100)
Create initrd image with packed microcode. This'll allow to load it at
early boot stage.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
package/firmware/amd64-microcode/Makefile

index 4fd3d0461043328aee5f0852fdfc94f99cdf6da6..adf3352af2e5d13b6e6d9c9908964b629818e768 100644 (file)
@@ -35,11 +35,17 @@ define Build/Prepare
 endef
 
 define Build/Compile
+       mkdir -p $(PKG_BUILD_DIR)/kernel/x86/microcode/
+       cat $(PKG_BUILD_DIR)/microcode_amd*.bin \
+               > $(PKG_BUILD_DIR)/kernel/x86/microcode/AuthenticAMD.bin
+       (cd $(PKG_BUILD_DIR); \
+       echo "kernel/x86/microcode/AuthenticAMD.bin" \
+               | cpio -o -H newc --reproducible > amd-ucode.cpio)
 endef
 
 define Package/amd64-microcode/install
-       $(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/*.bin $(1)/lib/firmware/amd-ucode
+       $(INSTALL_DIR) $(1)/boot
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/amd-ucode.cpio $(1)/boot/amd-ucode.img
 endef
 
 $(eval $(call BuildPackage,amd64-microcode))