summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2024-10-14 10:59:18 +0200
committerGitHub <noreply@github.com>2024-10-14 10:59:18 +0200
commit36ea34c18763440d0b1f2f60a42e7ccc9584ff51 (patch)
tree6a1105e5a634866c188d80db8258c4321d5a3696
parentbuildPython*: Deprecate and remove (buildPython* { ... }).override (#333670) (diff)
parent{seabios-coreboot, seabios-csm, seabios-qemu}: "init" (diff)
downloadnixpkgs-36ea34c18763440d0b1f2f60a42e7ccc9584ff51.tar.gz
seabios refactors (#342692)
-rw-r--r--pkgs/by-name/se/seabios/package.nix90
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 68 insertions, 26 deletions
diff --git a/pkgs/by-name/se/seabios/package.nix b/pkgs/by-name/se/seabios/package.nix
index 713f58702113..ac647e93b195 100644
--- a/pkgs/by-name/se/seabios/package.nix
+++ b/pkgs/by-name/se/seabios/package.nix
@@ -1,11 +1,37 @@
-{ lib
-, stdenv
-, fetchgit
-, acpica-tools
-, python3
-, writeText
+{
+ lib,
+ acpica-tools,
+ fetchgit,
+ python3,
+ stdenv,
+ writeText,
+ # Configurable options
+ ___build-type ? "csm",
}:
+assert lib.elem (___build-type) [
+ "coreboot"
+ # SeaBIOS with CSM (Compatible Support Module) support; learn more at
+ # https://www.electronicshub.org/what-is-csm-bios/
+ "csm"
+ "qemu"
+];
+let
+ biosfile =
+ {
+ "coreboot" = "bios.bin.elf";
+ "csm" = "Csm16.bin";
+ "qemu" = "bios.bin";
+ }
+ .${___build-type};
+ configuration-string =
+ {
+ "coreboot" = "CONFIG_COREBOOT";
+ "csm" = "CONFIG_CSM";
+ "qemu" = "CONFIG_QEMU";
+ }
+ .${___build-type};
+in
stdenv.mkDerivation (finalAttrs: {
pname = "seabios";
version = "1.16.3";
@@ -16,7 +42,10 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-hWemj83cxdY8p+Jhkh5GcPvI0Sy5aKYZJCsKDjHTUUk=";
};
- outputs = [ "out" "doc" ];
+ outputs = [
+ "out"
+ "doc"
+ ];
nativeBuildInputs = [ python3 ];
@@ -29,31 +58,42 @@ stdenv.mkDerivation (finalAttrs: {
"EXTRAVERSION=\"-nixpkgs\""
];
- hardeningDisable = [ "pic" "stackprotector" "fortify" ];
+ hardeningDisable = [
+ "fortify"
+ "pic"
+ "stackprotector"
+ ];
- postConfigure = let
- config = writeText "config.txt" (lib.generators.toKeyValue { } {
- # SeaBIOS with CSM (Compatible Support Module) support; learn more at
- # https://www.electronicshub.org/what-is-csm-bios/
- "CONFIG_CSM" = "y";
- "CONFIG_PERMIT_UNALIGNED_PCIROM" = "y";
- "CONFIG_QEMU_HARDWARE" = "y";
- });
- in ''
- cp ${config} .config
- make olddefconfig
- '';
+ postConfigure =
+ let
+ config = writeText "config.txt" (
+ lib.generators.toKeyValue { } {
+ "${configuration-string}" = "y";
+ "CONFIG_PERMIT_UNALIGNED_PCIROM" = "y";
+ "CONFIG_QEMU_HARDWARE" = "y";
+ }
+ );
+ in
+ ''
+ cp ${config} .config
+ make olddefconfig
+ '';
installPhase = ''
runHook preInstall
- mkdir -pv $doc/share/doc/seabios-${finalAttrs.version}/
- cp -v docs/* $doc/share/doc/seabios-${finalAttrs.version}/
- install -Dm644 out/Csm16.bin -t $out/share/seabios/
+ mkdir -pv ''${!outputDoc}/share/doc/seabios-${finalAttrs.version}/
+ cp -v docs/* ''${!outputDoc}/share/doc/seabios-${finalAttrs.version}/
+ install -Dm644 out/${biosfile} -t $out/share/seabios/
runHook postInstall
'';
+ passthru = {
+ build-type = ___build-type;
+ firmware = "${finalAttrs.finalPackage}/share/seabios/${biosfile}";
+ };
+
meta = {
homepage = "https://www.seabios.org";
description = "Open source implementation of a 16bit x86 BIOS";
@@ -64,9 +104,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
license = with lib.licenses; [ lgpl3Plus ];
maintainers = with lib.maintainers; [ AndersonTorres ];
- platforms = lib.systems.inspect.patternLogicalAnd
- lib.systems.inspect.patterns.isUnix
- lib.systems.inspect.patterns.isx86;
+ platforms = lib.systems.inspect.patternLogicalAnd lib.systems.inspect.patterns.isUnix lib.systems.inspect.patterns.isx86;
badPlatforms = [ lib.systems.inspect.patterns.isDarwin ];
};
})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index fd9030521407..de8e84293055 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5607,6 +5607,10 @@ with pkgs;
nltk-data = callPackage ../tools/text/nltk-data { };
+ seabios-coreboot = seabios.override { ___build-type = "coreboot"; };
+ seabios-csm = seabios.override { ___build-type = "csm"; };
+ seabios-qemu = seabios.override { ___build-type = "qemu"; };
+
seaborn-data = callPackage ../tools/misc/seaborn-data { };
nodepy-runtime = with python3.pkgs; toPythonApplication nodepy-runtime;