at master 4.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchgit, 5 pkg-config, 6 zlib, 7 pciutils, 8 openssl, 9 coreutils, 10 acpica-tools, 11 makeWrapper, 12 gnugrep, 13 gnused, 14 file, 15 buildEnv, 16}: 17 18let 19 version = "25.06"; 20 21 commonMeta = { 22 description = "Various coreboot-related tools"; 23 homepage = "https://www.coreboot.org"; 24 license = with lib.licenses; [ 25 gpl2Only 26 gpl2Plus 27 ]; 28 maintainers = with lib.maintainers; [ 29 felixsinger 30 jmbaur 31 ]; 32 platforms = lib.platforms.linux; 33 }; 34 35 generic = 36 { 37 pname, 38 path ? "util/${pname}", 39 ... 40 }@args: 41 stdenv.mkDerivation ( 42 finalAttrs: 43 { 44 inherit pname version; 45 46 src = fetchgit { 47 url = "https://review.coreboot.org/coreboot"; 48 rev = finalAttrs.version; 49 hash = "sha256-D7W8LtL6eeaKiRYoxVkcjeZ2aMIEXCvNakVtexe0mG8="; 50 }; 51 52 enableParallelBuilding = true; 53 54 postPatch = '' 55 substituteInPlace 3rdparty/vboot/Makefile --replace 'ar qc ' '$$AR qc ' 56 cd ${path} 57 patchShebangs . 58 ''; 59 60 makeFlags = [ 61 "INSTALL=install" 62 "PREFIX=${placeholder "out"}" 63 ]; 64 65 meta = commonMeta // args.meta; 66 } 67 // (removeAttrs args [ "meta" ]) 68 ); 69 70 utils = { 71 msrtool = generic { 72 pname = "msrtool"; 73 meta.description = "Dump chipset-specific MSR registers"; 74 meta.platforms = [ 75 "x86_64-linux" 76 "i686-linux" 77 ]; 78 buildInputs = [ 79 pciutils 80 zlib 81 ]; 82 preConfigure = "export INSTALL=install"; 83 }; 84 cbmem = generic { 85 pname = "cbmem"; 86 meta.description = "Coreboot console log reader"; 87 }; 88 ifdtool = generic { 89 pname = "ifdtool"; 90 meta.description = "Extract and dump Intel Firmware Descriptor information"; 91 }; 92 intelmetool = generic { 93 pname = "intelmetool"; 94 meta.description = "Dump interesting things about Management Engine"; 95 meta.platforms = [ 96 "x86_64-linux" 97 "i686-linux" 98 ]; 99 buildInputs = [ 100 pciutils 101 zlib 102 ]; 103 }; 104 cbfstool = generic { 105 pname = "cbfstool"; 106 meta.description = "Management utility for CBFS formatted ROM images"; 107 }; 108 nvramtool = generic { 109 pname = "nvramtool"; 110 meta.description = "Read and write coreboot parameters and display information from the coreboot table in CMOS/NVRAM"; 111 meta.mainProgram = "nvramtool"; 112 }; 113 superiotool = generic { 114 pname = "superiotool"; 115 meta.description = "User-space utility to detect Super I/O of a mainboard and provide detailed information about the register contents of the Super I/O"; 116 meta.platforms = [ 117 "x86_64-linux" 118 "i686-linux" 119 ]; 120 buildInputs = [ 121 pciutils 122 zlib 123 ]; 124 }; 125 ectool = generic { 126 pname = "ectool"; 127 meta.description = "Dump the RAM of a laptop's Embedded/Environmental Controller (EC)"; 128 meta.platforms = [ 129 "x86_64-linux" 130 "i686-linux" 131 ]; 132 preInstall = "mkdir -p $out/sbin"; 133 }; 134 inteltool = generic { 135 pname = "inteltool"; 136 meta.description = "Provides information about Intel CPU/chipset hardware configuration (register contents, MSRs, etc)"; 137 meta.platforms = [ 138 "x86_64-linux" 139 "i686-linux" 140 ]; 141 buildInputs = [ 142 pciutils 143 zlib 144 ]; 145 }; 146 amdfwtool = generic { 147 pname = "amdfwtool"; 148 meta.description = "Create AMD firmware combination"; 149 buildInputs = [ openssl ]; 150 nativeBuildInputs = [ pkg-config ]; 151 installPhase = '' 152 runHook preInstall 153 154 install -Dm755 amdfwtool $out/bin/amdfwtool 155 156 runHook postInstall 157 ''; 158 }; 159 acpidump-all = generic { 160 pname = "acpidump-all"; 161 path = "util/acpi"; 162 meta.description = "Walk through all ACPI tables with their addresses"; 163 nativeBuildInputs = [ makeWrapper ]; 164 dontBuild = true; 165 installPhase = '' 166 runHook preInstall 167 168 install -Dm755 acpidump-all $out/bin/acpidump-all 169 170 runHook postInstall 171 ''; 172 postFixup = '' 173 wrapProgram $out/bin/acpidump-all \ 174 --set PATH ${ 175 lib.makeBinPath [ 176 coreutils 177 acpica-tools 178 gnugrep 179 gnused 180 file 181 ] 182 } 183 ''; 184 }; 185 }; 186 187in 188utils 189// { 190 coreboot-utils = 191 (buildEnv { 192 name = "coreboot-utils-${version}"; 193 paths = lib.filter (lib.meta.availableOn stdenv.hostPlatform) (lib.attrValues utils); 194 postBuild = "rm -rf $out/sbin"; 195 }) 196 // { 197 inherit version; 198 meta = commonMeta; 199 }; 200}