mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 01:37:24 +08:00
chore: format repo using treefmt-nix and nixfmt-rfc-style
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
{ lib, fetchgit, enable-tee, stdenv, buildPackages, pkgsCross, openssl, }:
|
||||
{
|
||||
lib,
|
||||
fetchgit,
|
||||
enable-tee,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
pkgsCross,
|
||||
openssl,
|
||||
}:
|
||||
let
|
||||
opteedflag = if enable-tee then "SPD=opteed" else "";
|
||||
target-board = "imx8mq";
|
||||
in stdenv.mkDerivation rec {
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx8mq-atf";
|
||||
version = "lf6.1.55_2.2.0";
|
||||
platform = target-board;
|
||||
@@ -48,8 +57,7 @@ in stdenv.mkDerivation rec {
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/nxp-imx/imx-atf";
|
||||
description =
|
||||
"Reference implementation of secure world software for ARMv8-A";
|
||||
description = "Reference implementation of secure world software for ARMv8-A";
|
||||
license = [ licenses.bsd3 ];
|
||||
maintainers = with maintainers; [ gngram ];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
|
||||
@@ -2,25 +2,24 @@
|
||||
pkgs,
|
||||
enable-tee ? false,
|
||||
}:
|
||||
with pkgs; let
|
||||
cp-tee =
|
||||
if enable-tee
|
||||
then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin"
|
||||
else "";
|
||||
with pkgs;
|
||||
let
|
||||
cp-tee = if enable-tee then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin" else "";
|
||||
|
||||
imx8mq-atf = pkgs.callPackage ./imx8mq-atf.nix {
|
||||
inherit enable-tee;
|
||||
};
|
||||
imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix {};
|
||||
imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix {};
|
||||
imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix {};
|
||||
imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix { };
|
||||
imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix { };
|
||||
imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix { };
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/nxp-imx/imx-mkimage.git";
|
||||
rev = "c4365450fb115d87f245df2864fee1604d97c06a";
|
||||
sha256 = "sha256-KVIVHwBpAwd1RKy3RrYxGIniE45CDlN5RQTXsMg1Jwk=";
|
||||
};
|
||||
shortRev = builtins.substring 0 8 src.rev;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imx8m-boot = pkgs.stdenv.mkDerivation rec {
|
||||
inherit src;
|
||||
name = "imx8mq-mkimage";
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{pkgs, ...}:
|
||||
{ pkgs, ... }:
|
||||
with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx8mq-firmware";
|
||||
version = "8.22";
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx8mq-firmware";
|
||||
version = "8.22";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin";
|
||||
sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A=";
|
||||
};
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin";
|
||||
sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
dontStrip = true;
|
||||
dontUnpack = true;
|
||||
dontStrip = true;
|
||||
|
||||
installPhase = ''
|
||||
${pkgs.bash}/bin/bash $src --auto-accept --force
|
||||
mv firmware-imx-${version} $out
|
||||
'';
|
||||
}
|
||||
installPhase = ''
|
||||
${pkgs.bash}/bin/bash $src --auto-accept --force
|
||||
mv firmware-imx-${version} $out
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,54 +1,56 @@
|
||||
{pkgs, ...} @ args:
|
||||
{ pkgs, ... }@args:
|
||||
with pkgs;
|
||||
buildLinux (args
|
||||
// rec {
|
||||
version = "6.1.55";
|
||||
name = "imx8mq-linux";
|
||||
buildLinux (
|
||||
args
|
||||
// rec {
|
||||
version = "6.1.55";
|
||||
name = "imx8mq-linux";
|
||||
|
||||
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
|
||||
modDirVersion = version;
|
||||
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
|
||||
modDirVersion = version;
|
||||
|
||||
defconfig = "imx_v8_defconfig";
|
||||
defconfig = "imx_v8_defconfig";
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/pull/366004
|
||||
# introduced a breaking change that if a module is declared but it is not being used it will faill.
|
||||
ignoreConfigErrors = true;
|
||||
# https://github.com/NixOS/nixpkgs/pull/366004
|
||||
# introduced a breaking change that if a module is declared but it is not being used it will faill.
|
||||
ignoreConfigErrors = true;
|
||||
|
||||
kernelPatches = [
|
||||
];
|
||||
kernelPatches = [
|
||||
];
|
||||
|
||||
autoModules = false;
|
||||
autoModules = false;
|
||||
|
||||
extraConfig = ''
|
||||
CRYPTO_TLS m
|
||||
TLS y
|
||||
MD_RAID0 m
|
||||
MD_RAID1 m
|
||||
MD_RAID10 m
|
||||
MD_RAID456 m
|
||||
DM_VERITY m
|
||||
LOGO y
|
||||
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n
|
||||
FB_EFI n
|
||||
EFI_STUB y
|
||||
EFI y
|
||||
VIRTIO y
|
||||
VIRTIO_PCI y
|
||||
VIRTIO_BLK y
|
||||
DRM_VIRTIO_GPU y
|
||||
EXT4_FS y
|
||||
USBIP_CORE m
|
||||
USBIP_VHCI_HCD m
|
||||
USBIP_HOST m
|
||||
USBIP_VUDC m
|
||||
'';
|
||||
extraConfig = ''
|
||||
CRYPTO_TLS m
|
||||
TLS y
|
||||
MD_RAID0 m
|
||||
MD_RAID1 m
|
||||
MD_RAID10 m
|
||||
MD_RAID456 m
|
||||
DM_VERITY m
|
||||
LOGO y
|
||||
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n
|
||||
FB_EFI n
|
||||
EFI_STUB y
|
||||
EFI y
|
||||
VIRTIO y
|
||||
VIRTIO_PCI y
|
||||
VIRTIO_BLK y
|
||||
DRM_VIRTIO_GPU y
|
||||
EXT4_FS y
|
||||
USBIP_CORE m
|
||||
USBIP_VHCI_HCD m
|
||||
USBIP_HOST m
|
||||
USBIP_VUDC m
|
||||
'';
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "linux-imx";
|
||||
# tag: lf-6.1.55-2.2.0
|
||||
rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e";
|
||||
sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0=";
|
||||
};
|
||||
}
|
||||
// (args.argsOverride or {}))
|
||||
src = fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "linux-imx";
|
||||
# tag: lf-6.1.55-2.2.0
|
||||
rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e";
|
||||
sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0=";
|
||||
};
|
||||
}
|
||||
// (args.argsOverride or { })
|
||||
)
|
||||
|
||||
@@ -1,66 +1,67 @@
|
||||
{pkgs}: let
|
||||
{ pkgs }:
|
||||
let
|
||||
python3 = pkgs.buildPackages.python3;
|
||||
toolchain = pkgs.gcc9Stdenv.cc;
|
||||
binutils = pkgs.gcc9Stdenv.cc.bintools.bintools_bin;
|
||||
cpp = pkgs.gcc;
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "imx8mq-optee-os";
|
||||
version = "lf-6.1.55-2.2.0";
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "imx8mq-optee-os";
|
||||
version = "lf-6.1.55-2.2.0";
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
pycryptodomex
|
||||
pyelftools
|
||||
cryptography
|
||||
];
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
pycryptodomex
|
||||
pyelftools
|
||||
cryptography
|
||||
];
|
||||
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/nxp-imx/imx-optee-os.git";
|
||||
rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee";
|
||||
sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s=";
|
||||
};
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/nxp-imx/imx-optee-os.git";
|
||||
rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee";
|
||||
sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/arm32_sysreg.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/gen_tee_bin.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/pem_to_pub_c.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \
|
||||
--replace '/bin/bash' '${pkgs.bash}/bin/bash'
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp
|
||||
'';
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/arm32_sysreg.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/gen_tee_bin.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/pem_to_pub_c.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \
|
||||
--replace '/bin/bash' '${pkgs.bash}/bin/bash'
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"PLATFORM=imx"
|
||||
"PLATFORM_FLAVOR=mx8mqevk"
|
||||
"CFG_ARM64_core=y"
|
||||
"CFG_TEE_TA_LOG_LEVEL=0"
|
||||
"CFG_TEE_CORE_LOG_LEVEL=0"
|
||||
"CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}"
|
||||
"CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}"
|
||||
];
|
||||
makeFlags = [
|
||||
"PLATFORM=imx"
|
||||
"PLATFORM_FLAVOR=mx8mqevk"
|
||||
"CFG_ARM64_core=y"
|
||||
"CFG_TEE_TA_LOG_LEVEL=0"
|
||||
"CFG_TEE_CORE_LOG_LEVEL=0"
|
||||
"CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}"
|
||||
"CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin
|
||||
'';
|
||||
}
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,90 +1,91 @@
|
||||
{ stdenv
|
||||
, lib
|
||||
, bison
|
||||
, dtc
|
||||
, fetchgit
|
||||
, flex
|
||||
, gnutls
|
||||
, libuuid
|
||||
, ncurses
|
||||
, openssl
|
||||
, which
|
||||
, perl
|
||||
, buildPackages
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
bison,
|
||||
dtc,
|
||||
fetchgit,
|
||||
flex,
|
||||
gnutls,
|
||||
libuuid,
|
||||
ncurses,
|
||||
openssl,
|
||||
which,
|
||||
perl,
|
||||
buildPackages,
|
||||
}:
|
||||
let
|
||||
ubsrc = fetchgit {
|
||||
url = "https://github.com/nxp-imx/uboot-imx.git";
|
||||
# tag: "lf-6.1.55-2.2.0"
|
||||
rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f";
|
||||
sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA=";
|
||||
};
|
||||
url = "https://github.com/nxp-imx/uboot-imx.git";
|
||||
# tag: "lf-6.1.55-2.2.0"
|
||||
rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f";
|
||||
sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA=";
|
||||
};
|
||||
in
|
||||
(stdenv.mkDerivation {
|
||||
pname = "imx8mq-uboot";
|
||||
version = "2023.04";
|
||||
src = ubsrc;
|
||||
(stdenv.mkDerivation {
|
||||
pname = "imx8mq-uboot";
|
||||
version = "2023.04";
|
||||
src = ubsrc;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs tools
|
||||
patchShebangs scripts
|
||||
'';
|
||||
postPatch = ''
|
||||
patchShebangs tools
|
||||
patchShebangs scripts
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
bison
|
||||
flex
|
||||
openssl
|
||||
which
|
||||
ncurses
|
||||
libuuid
|
||||
gnutls
|
||||
openssl
|
||||
perl
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
bison
|
||||
flex
|
||||
openssl
|
||||
which
|
||||
ncurses
|
||||
libuuid
|
||||
gnutls
|
||||
openssl
|
||||
perl
|
||||
];
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
hardeningDisable = [ "all" ];
|
||||
enableParallelBuilding = true;
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
hardeningDisable = [ "all" ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
makeFlags = [
|
||||
"DTC=${lib.getExe buildPackages.dtc}"
|
||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||
];
|
||||
makeFlags = [
|
||||
"DTC=${lib.getExe buildPackages.dtc}"
|
||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; "
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_BOOTEFI=y
|
||||
CONFIG_EFI_LOADER=y
|
||||
CONFIG_BLK=y
|
||||
CONFIG_PARTITIONS=y
|
||||
CONFIG_DM_DEVICE_REMOVE=n
|
||||
CONFIG_CMD_CACHE=y
|
||||
'';
|
||||
extraConfig = ''
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; "
|
||||
CONFIG_CMD_BOOTEFI_SELFTEST=y
|
||||
CONFIG_CMD_BOOTEFI=y
|
||||
CONFIG_EFI_LOADER=y
|
||||
CONFIG_BLK=y
|
||||
CONFIG_PARTITIONS=y
|
||||
CONFIG_DM_DEVICE_REMOVE=n
|
||||
CONFIG_CMD_CACHE=y
|
||||
'';
|
||||
|
||||
passAsFile = [ "extraConfig" ];
|
||||
passAsFile = [ "extraConfig" ];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
make imx8mq_evk_defconfig
|
||||
cat $extraConfigPath >> .config
|
||||
make imx8mq_evk_defconfig
|
||||
cat $extraConfigPath >> .config
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp ./u-boot-nodtb.bin $out
|
||||
cp ./spl/u-boot-spl.bin $out
|
||||
cp ./arch/arm/dts/imx8mq-evk.dtb $out
|
||||
cp .config $out
|
||||
mkdir -p $out
|
||||
cp ./u-boot-nodtb.bin $out
|
||||
cp ./spl/u-boot-spl.bin $out
|
||||
cp ./arch/arm/dts/imx8mq-evk.dtb $out
|
||||
cp .config $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
})
|
||||
dontStrip = true;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user