wip/yesman
parent
38ab184381
commit
19ac914c4e
@ -0,0 +1,9 @@ |
||||
Features: |
||||
|
||||
- Specify config overrides as Nix attribute set |
||||
- Change payload without rebuilding coreboot |
||||
|
||||
Limitations: |
||||
|
||||
- currently only `x86_64-linux` host and target systems are supported |
||||
- It's not yet possible to build with a SeaBIOS payload |
@ -0,0 +1,8 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_THINKPAD_T440P = "y"; |
||||
|
||||
# TODO: fetch mrc.bin |
||||
} |
@ -0,0 +1,6 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_T60 = "y"; |
||||
} |
@ -0,0 +1,6 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_X1_CARBON_GEN1 = "y"; |
||||
} |
@ -0,0 +1,6 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_X220 = "y"; |
||||
} |
@ -0,0 +1,9 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
imports = [ |
||||
./x230.nix |
||||
]; |
||||
|
||||
# TODO: modify vbt to hide LVDS |
||||
} |
@ -0,0 +1,6 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_X230 = "y"; |
||||
} |
@ -0,0 +1,4 @@ |
||||
{ |
||||
CONFIG_VENDOR_LENOVO = "y"; |
||||
CONFIG_BOARD_LENOVO_X230T = "y"; |
||||
} |
@ -0,0 +1,11 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
coreboot.corebootConfig = { |
||||
CONFIG_PAYLOAD_NONE = "y"; # payload is added later |
||||
CONFIG_CBFS_SIZE = lib.mkDefault "0x300000"; |
||||
CONFIG_USE_OPTION_TABLE = lib.mkDefault "y"; |
||||
CONFIG_PCIEXP_CLK_PM = lib.mkDefault "y"; |
||||
CONFIG_GENERIC_LINEAR_FRAMEBUFFER = lib.mkDefault "y"; |
||||
}; |
||||
} |
@ -0,0 +1,15 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
imports = [ |
||||
./common.nix |
||||
./boards/x1c.nix |
||||
]; |
||||
|
||||
coreboot.corebootConfig = { |
||||
CONFIG_LINEAR_FRAMEBUFFER_MAX_WIDTH = "1600"; |
||||
CONFIG_LINEAR_FRAMEBUFFER_MAX_HEIGHT = "900"; |
||||
}; |
||||
|
||||
grub2.enable = true; |
||||
} |
@ -0,0 +1,27 @@ |
||||
{ |
||||
"nodes": { |
||||
"nixpkgs": { |
||||
"locked": { |
||||
"lastModified": 1602333914, |
||||
"narHash": "sha256-ossU2LFWerfPK/HkCvAom6WvBrQ80vq9CTApMCPaHMs=", |
||||
"owner": "nixos", |
||||
"repo": "nixpkgs", |
||||
"rev": "b70ac01b380722591c89d40ea31e0ac2463d87ec", |
||||
"type": "github" |
||||
}, |
||||
"original": { |
||||
"owner": "nixos", |
||||
"ref": "master", |
||||
"repo": "nixpkgs", |
||||
"type": "github" |
||||
} |
||||
}, |
||||
"root": { |
||||
"inputs": { |
||||
"nixpkgs": "nixpkgs" |
||||
} |
||||
} |
||||
}, |
||||
"root": "root", |
||||
"version": 7 |
||||
} |
@ -0,0 +1,44 @@ |
||||
{ config, pkgs, lib, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.coreboot; |
||||
in { |
||||
options.coreboot = { |
||||
extraFiles = mkOption { |
||||
type = types.attrs; |
||||
}; |
||||
corebootConfig = mkOption { |
||||
type = types.attrs; |
||||
}; |
||||
rom = mkOption { |
||||
readOnly = true; |
||||
type = types.path; |
||||
}; |
||||
}; |
||||
|
||||
config = { |
||||
coreboot.rom = let |
||||
base = pkgs.coreboot.override { |
||||
inherit (cfg) corebootConfig; |
||||
}; |
||||
|
||||
filteredFiles = filterAttrs (k: v: v != null) cfg.extraFiles; |
||||
filesList = mapAttrsToList (k: v: v // { name = v; }) filteredFiles; |
||||
|
||||
installCommands = concatMapStringsSep "\n" (file: '' |
||||
cbfstool $out add \ |
||||
-f ${file.src} \ |
||||
-n ${file.name} \ |
||||
-t ${file.type} |
||||
'') filesList; |
||||
|
||||
in runCommand "coreboot-rom" { |
||||
buildInputs = with pkgs; [ cbfstool ]; |
||||
} '' |
||||
install -D ${base}/coreboot.rom -t $out |
||||
${installCommands} |
||||
''; |
||||
}; |
||||
} |
@ -0,0 +1,9 @@ |
||||
{ ... }: |
||||
|
||||
{ |
||||
imports = [ |
||||
./coreboot |
||||
./grub2 |
||||
#./tianocore |
||||
]; |
||||
} |
@ -0,0 +1,20 @@ |
||||
{ lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.grub2; |
||||
in { |
||||
options.grub2 = { |
||||
enable = mkEnableOption "grub2 coreboot primary payload"; |
||||
}; |
||||
|
||||
config = lib.mkIf cfg.enable { |
||||
coreboot.rom.extraFiles = { |
||||
"fallback/payload" = { |
||||
type = "payload"; |
||||
src = "${pkgs.coreboot-payload-grub}/default_payload.elf"; |
||||
}; |
||||
}; |
||||
}; |
||||
} |
@ -1,73 +0,0 @@ |
||||
{ fetchgit |
||||
, fetchurl |
||||
, stdenv |
||||
, m4 |
||||
, flex |
||||
, bison |
||||
, zlib |
||||
, gnat |
||||
, curl |
||||
, grub-coreboot |
||||
, tianocore-coreboot |
||||
, perl |
||||
, writeText |
||||
, config ? {} |
||||
}: |
||||
|
||||
let |
||||
version = "4.12"; |
||||
src = fetchgit { |
||||
url = "https://review.coreboot.org/coreboot.git"; |
||||
rev = "${version}"; |
||||
fetchSubmodules = true; |
||||
sha256 = "1l140zbvn6pkbrr55lymhi4lycimhpy8xgm45shl4zv6a9vjd66z"; |
||||
}; |
||||
|
||||
toolchain = stdenv.mkDerivation rec { |
||||
pname = "coreboot-toolchain"; |
||||
inherit version src; |
||||
nativeBuildInputs = [ |
||||
curl |
||||
stdenv |
||||
m4 |
||||
flex |
||||
bison |
||||
zlib |
||||
gnat |
||||
]; |
||||
buildPhase = '' |
||||
mkdir -p util/crossgcc/tarballs |
||||
${} |
||||
NIX_HARDENING_ENABLE="$\{NIX_HARDENING_ENABLE/ format/\}" make crossgcc-i386 CPUS=$NIX_BUILD_CORES |
||||
''; |
||||
installPhase = '' |
||||
cp -r util/crossgcc $out |
||||
''; |
||||
}; |
||||
|
||||
in stdenv.mkDerivation rec { |
||||
pname = "coreboot"; |
||||
inherit version src; |
||||
configurePhase = let |
||||
filteredConfig = lib.filterAttrs (n: v: v != null) config; |
||||
lines = lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig; |
||||
configFile = writeText "config" (concatStringsSept "\n" lines); |
||||
in '' |
||||
cp ${configFile} .config |
||||
make olddefconfig |
||||
''; |
||||
buildPhase = '' |
||||
rm -rf util/crossgcc |
||||
cp -r ${toolchain} util/crossgcc |
||||
chmod u+rwX -R util/crossgcc |
||||
patchShebangs util/xcompile/xcompile |
||||
make |
||||
''; |
||||
installPhase = '' |
||||
mkdir -p $out |
||||
cp build/coreboot.rom $out |
||||
''; |
||||
passthru = { |
||||
inherit toolchain configfile; |
||||
}; |
||||
} |
@ -1,3 +1,76 @@ |
||||
{ fetchgit |
||||
, fetchurl |
||||
, stdenv |
||||
, m4 |
||||
, flex |
||||
, bison |
||||
, zlib |
||||
, gnat |
||||
, curl |
||||
, writeText |
||||
, callPackage |
||||
, lib |
||||
, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; } |
||||
}: |
||||
|
||||
# ${tianocore-coreboot}/FV/UEFIPAYLOAD.fd |
||||
# ${grub-coreboot}/default_payload.elf |
||||
let |
||||
version = "4.12"; |
||||
src = fetchgit { |
||||
url = "https://review.coreboot.org/coreboot.git"; |
||||
rev = "${version}"; |
||||
fetchSubmodules = true; |
||||
sha256 = "1l140zbvn6pkbrr55lymhi4lycimhpy8xgm45shl4zv6a9vjd66z"; |
||||
}; |
||||
|
||||
toolchain = stdenv.mkDerivation rec { |
||||
pname = "coreboot-toolchain"; |
||||
inherit version src; |
||||
nativeBuildInputs = [ |
||||
curl |
||||
stdenv |
||||
m4 |
||||
flex |
||||
bison |
||||
zlib |
||||
gnat |
||||
]; |
||||
buildPhase = '' |
||||
mkdir -p util/crossgcc/tarballs |
||||
${lib.concatMapStringsSep "\n" (file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}") (callPackage ./files.nix {})} |
||||
NIX_HARDENING_ENABLE="$\{NIX_HARDENING_ENABLE/ format/\}" make crossgcc-i386 CPUS=$NIX_BUILD_CORES |
||||
''; |
||||
installPhase = '' |
||||
cp -r util/crossgcc $out |
||||
''; |
||||
}; |
||||
|
||||
filteredConfig = lib.filterAttrs (n: v: v != null) corebootConfig; |
||||
lines = lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig; |
||||
configFile = writeText "config" (lib.concatStringsSep "\n" lines); |
||||
in stdenv.mkDerivation rec { |
||||
|
||||
pname = "coreboot"; |
||||
inherit version src; |
||||
|
||||
configurePhase = '' |
||||
cp ${configFile} .config |
||||
make olddefconfig |
||||
''; |
||||
|
||||
buildPhase = '' |
||||
rm -rf util/crossgcc |
||||
cp -r ${toolchain} util/crossgcc |
||||
chmod u+rwX -R util/crossgcc |
||||
patchShebangs util/xcompile/xcompile |
||||
make |
||||
''; |
||||
|
||||
installPhase = '' |
||||
mkdir -p $out |
||||
cp build/coreboot.rom $out |
||||
''; |
||||
|
||||
passthru = { |
||||
inherit toolchain configFile; |
||||
}; |
||||
} |
||||
|
@ -1,7 +1,7 @@ |
||||
final: prev: |
||||
let inherit (final) callPackage; |
||||
in { |
||||
coreboot-base = callPackage ./coreboot-base {}; |
||||
coreboot = callPackage ./coreboot {}; |
||||
coreboot-payload-grub2 = callPackage ./coreboot-payload-grub2 {}; |
||||
coreboot-payload-tianocore = callPackage ./coreboot-payload-tianocore {}; |
||||
} |
||||
|
Loading…
Reference in new issue