@ -1,9 +1,7 @@
{ lib ? import <nixpkgs/lib>
{ lib ? import <nixpkgs/lib>
, hostPlatform ? lib . systems . examples . gnu64
, hostPlatform ? lib . systems . examples . gnu64
} :
} :
let
update_microcode = true ;
in
{
{
inherit hostPlatform ;
inherit hostPlatform ;
@ -29,23 +27,13 @@ in
'' ;
'' ;
} ) ;
} ) ;
coreboot = let
# microcode updates are needed only for Opteron 63xx
# does include spectre mitigations (performance hit)
#
#linux-firmware = final.nixpkgsOnBuildForBuild.linux-firmware;
# TODO: check processor type at boot time and refuse to boot
#path-within-linux-firmware = "lib/firmware/amd-ucode/microcode_amd_fam15h.bin";
# insecure configurations? (63xx without microcode)
microcode-blob = null ;
# does *not* include spectre mitigations (no performance hit)
coreboot = let
linux-firmware = final . nixpkgsOnBuildForBuild . fetchgit {
# most recent update that does *not* include spectre
# mitigations; needed for 63xx processors due to an exploitable
# NMI defect in that series (only)
url = " h t t p s : / / g i t . k e r n e l . o r g / p u b / s c m / l i n u x / k e r n e l / g i t / f i r m w a r e / l i n u x - f i r m w a r e . g i t " ;
rev = " 5 f 8 c a 0 c 1 d b 6 1 0 6 a 2 d 6 d 7 e 8 5 e e e 7 7 8 9 1 7 f f 0 3 c 3 d e " ;
branchName = " m a i n " ;
#sparseCheckout = path-within-linux-firmware;
hash = " s h a 2 5 6 - u w z z 0 z 2 + u P k e 8 A V K b 8 0 C y 6 2 0 e f d R B S u w j f o I r Q h e p c 8 = " ;
} ;
path-within-linux-firmware = " a m d - u c o d e / m i c r o c o d e _ a m d _ f a m 1 5 h . b i n " ;
in
in
final . lib . makeOverridable ( prev . coreboot . override {
final . lib . makeOverridable ( prev . coreboot . override {
iasl = final . iasl_20180531 ;
iasl = final . iasl_20180531 ;
@ -55,14 +43,14 @@ in
coreboot-toolchain = with final . coreboot-toolchain ; [ x64 i386 ] ;
coreboot-toolchain = with final . coreboot-toolchain ; [ x64 i386 ] ;
linux-command-line = " c o n s o l e = t t y S 1 , 1 1 5 2 0 0 n 8 " ;
linux-command-line = " c o n s o l e = t t y S 1 , 1 1 5 2 0 0 n 8 " ;
} ) . overrideAttrs ( a : {
} ) . overrideAttrs ( a : {
postConfigure = if update_microcode then ''
postConfigure = if final. microcode-blob != null then ''
echo CONFIG_CPU_MICROCODE_MULTIPLE_FILES = y > > . config
echo CONFIG_CPU_MICROCODE_MULTIPLE_FILES = y > > . config
'' e l s e ''
'' e l s e ''
echo CONFIG_CPU_MICROCODE_CBFS_NONE = y > > . config
echo CONFIG_CPU_MICROCODE_CBFS_NONE = y > > . config
'' ;
'' ;
preBuild = final . lib . optionalString update_microcode ''
preBuild = final . lib . optionalString ( final . microcode-blob != null ) ''
mkdir - p 3rdparty/blobs/cpu/amd/family_15h /
mkdir - p 3rdparty/blobs/cpu/amd/family_15h /
ln - sfT $ { linux-firmware} / $ { path-within-linux-firmware } \
ln - sfT $ { final. microcode-blob } \
3rdparty/blobs/cpu/amd/family_15h/microcode_amd_fam15h.bin
3rdparty/blobs/cpu/amd/family_15h/microcode_amd_fam15h.bin
mkdir - p 3rdparty/blobs/cpu/amd/family_10h-family_14h /
mkdir - p 3rdparty/blobs/cpu/amd/family_10h-family_14h /
touch 3rdparty/blobs/cpu/amd/family_10h-family_14h/microcode_amd.bin
touch 3rdparty/blobs/cpu/amd/family_10h-family_14h/microcode_amd.bin