mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-23 03:19:42 +01:00
nxp imx8mp-evk platform support
Signed-off-by: Ganga Ram <Ganga.Ram@tii.ae>
This commit is contained in:
parent
a597c4ad63
commit
5c2a5c00a0
10 changed files with 328 additions and 0 deletions
|
@ -183,6 +183,7 @@
|
||||||
morefine-m600 = import ./morefine/m600;
|
morefine-m600 = import ./morefine/m600;
|
||||||
msi-gs60 = import ./msi/gs60;
|
msi-gs60 = import ./msi/gs60;
|
||||||
msi-gl62 = import ./msi/gl62;
|
msi-gl62 = import ./msi/gl62;
|
||||||
|
nxp-imx8mp-evk = import ./nxp/imx8mp-evk;
|
||||||
nxp-imx8qm-mek = import ./nxp/imx8qm-mek;
|
nxp-imx8qm-mek = import ./nxp/imx8qm-mek;
|
||||||
hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4;
|
hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4;
|
||||||
hardkernel-odroid-h3 = import ./hardkernel/odroid-h3;
|
hardkernel-odroid-h3 = import ./hardkernel/odroid-h3;
|
||||||
|
|
34
nxp/imx8mp-evk/bsp/imx8mp-atf.nix
Normal file
34
nxp/imx8mp-evk/bsp/imx8mp-atf.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
buildArmTrustedFirmware,
|
||||||
|
fetchgit,
|
||||||
|
enable-tee,
|
||||||
|
}:
|
||||||
|
with pkgs; let
|
||||||
|
opteedflag =
|
||||||
|
if enable-tee
|
||||||
|
then "SPD=opteed"
|
||||||
|
else "";
|
||||||
|
target-board = "imx8mp";
|
||||||
|
in
|
||||||
|
buildArmTrustedFirmware rec {
|
||||||
|
pname = "imx8mp-atf";
|
||||||
|
platform = target-board;
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
extraMeta.platforms = ["aarch64-linux"];
|
||||||
|
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://github.com/nxp-imx/imx-atf.git";
|
||||||
|
#lf6.1.55_2.2.0
|
||||||
|
rev = "08e9d4eef2262c0dd072b4325e8919e06d349e02";
|
||||||
|
sha256 = "sha256-96EddJXlFEkP/LIGVgNBvUP4IDI3BbDE/c9Yub22gnc=";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraMakeFlags = lib.concatLists [
|
||||||
|
(lib.optional (lib.versionAtLeast pkgs.binutils.version "2.39") "LDFLAGS=--no-warn-rwx-segments")
|
||||||
|
["PLAT=${platform}" "bl31" "${opteedflag}"]
|
||||||
|
];
|
||||||
|
|
||||||
|
filesToInstall = ["build/${target-board}/release/bl31.bin"];
|
||||||
|
}
|
80
nxp/imx8mp-evk/bsp/imx8mp-boot.nix
Normal file
80
nxp/imx8mp-evk/bsp/imx8mp-boot.nix
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
enable-tee ? false,
|
||||||
|
}:
|
||||||
|
with pkgs; let
|
||||||
|
fw-ver = "202006";
|
||||||
|
cp-tee =
|
||||||
|
if enable-tee
|
||||||
|
then "install -m 0644 ${optee-os}/tee.bin ./iMX8M/tee.bin"
|
||||||
|
else "";
|
||||||
|
|
||||||
|
imx8mp-atf = pkgs.callPackage ./imx8mp-atf.nix {
|
||||||
|
inherit (pkgs) buildArmTrustedFirmware;
|
||||||
|
inherit enable-tee;
|
||||||
|
};
|
||||||
|
imx8mp-firmware = pkgs.callPackage ./imx8mp-firmware.nix {};
|
||||||
|
imx8mp-uboot = pkgs.callPackage ./imx8mp-uboot.nix {};
|
||||||
|
imx8mp-optee-os = pkgs.callPackage ./imx8mp-optee-os.nix {};
|
||||||
|
in {
|
||||||
|
imx8m-boot = pkgs.stdenv.mkDerivation rec {
|
||||||
|
name = "imx8mp-mkimage";
|
||||||
|
version = "lf-6.1.55-2.2.0";
|
||||||
|
src = pkgs.fetchgit {
|
||||||
|
url = "https://github.com/nxp-imx/imx-mkimage.git";
|
||||||
|
rev = "c4365450fb115d87f245df2864fee1604d97c06a";
|
||||||
|
sha256 = "sha256-xycEaWKVM63BlDyBKNN0OefyK6iX/fQOTvv4fRVM55U=";
|
||||||
|
leaveDotGit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace Makefile \
|
||||||
|
--replace 'CC = gcc' 'CC = clang'
|
||||||
|
patchShebangs scripts
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
clang
|
||||||
|
git
|
||||||
|
dtc
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
git
|
||||||
|
glibc.static
|
||||||
|
zlib
|
||||||
|
zlib.static
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
make bin
|
||||||
|
make SOC=iMX8MP mkimage_imx8
|
||||||
|
|
||||||
|
cp -v ${pkgs.ubootTools}/bin/mkimage ./iMX8M/mkimage_uboot
|
||||||
|
|
||||||
|
install -m 0644 ${imx8mp-uboot}/u-boot-spl.bin ./iMX8M/u-boot-spl.bin
|
||||||
|
install -m 0644 ${imx8mp-uboot}/u-boot-nodtb.bin ./iMX8M/u-boot-nodtb.bin
|
||||||
|
install -m 0644 ${imx8mp-uboot}/imx8mp-evk.dtb ./iMX8M/imx8mp-evk.dtb
|
||||||
|
install -m 0644 ${imx8mp-firmware}/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_${fw-ver}.bin ./iMX8M/lpddr4_pmu_train_1d_dmem_${fw-ver}.bin
|
||||||
|
install -m 0644 ${imx8mp-firmware}/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_${fw-ver}.bin ./iMX8M/lpddr4_pmu_train_1d_imem_${fw-ver}.bin
|
||||||
|
install -m 0644 ${imx8mp-firmware}/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_${fw-ver}.bin ./iMX8M/lpddr4_pmu_train_2d_dmem_${fw-ver}.bin
|
||||||
|
install -m 0644 ${imx8mp-firmware}/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_${fw-ver}.bin ./iMX8M/lpddr4_pmu_train_2d_imem_${fw-ver}.bin
|
||||||
|
install -m 0644 ${imx8mp-firmware}/firmware/hdmi/cadence/signed_hdmi_imx8m.bin ./iMX8M/signed_hdmi_imx8m.bin
|
||||||
|
install -m 0644 ${imx8mp-atf}/bl31.bin ./iMX8M/bl31.bin
|
||||||
|
${cp-tee}
|
||||||
|
|
||||||
|
make SOC=iMX8MP flash_evk
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out/image
|
||||||
|
install -m 0644 ./iMX8M/flash.bin $out/image
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
19
nxp/imx8mp-evk/bsp/imx8mp-firmware.nix
Normal file
19
nxp/imx8mp-evk/bsp/imx8mp-firmware.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{pkgs, ...}:
|
||||||
|
with pkgs;
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "imx8mp-firmware";
|
||||||
|
version = "8.22";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin";
|
||||||
|
sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A=";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
${pkgs.bash}/bin/bash $src --auto-accept --force
|
||||||
|
mv firmware-imx-${version} $out
|
||||||
|
'';
|
||||||
|
}
|
50
nxp/imx8mp-evk/bsp/imx8mp-linux.nix
Normal file
50
nxp/imx8mp-evk/bsp/imx8mp-linux.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{pkgs, ...} @ args:
|
||||||
|
with pkgs;
|
||||||
|
buildLinux (args
|
||||||
|
// rec {
|
||||||
|
version = "6.1.55";
|
||||||
|
name = "imx8mp-linux";
|
||||||
|
|
||||||
|
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
|
||||||
|
modDirVersion = version;
|
||||||
|
|
||||||
|
defconfig = "imx_v8_defconfig";
|
||||||
|
|
||||||
|
kernelPatches = [
|
||||||
|
];
|
||||||
|
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "nxp-imx";
|
||||||
|
repo = "linux-imx";
|
||||||
|
# tag: lf-6.1.55-2.2.0
|
||||||
|
rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e";
|
||||||
|
sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// (args.argsOverride or {}))
|
66
nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix
Normal file
66
nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{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 = "imx8mp-optee-os";
|
||||||
|
version = "lf-6.1.55-2.2.0";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
python3
|
||||||
|
];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
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=";
|
||||||
|
};
|
||||||
|
|
||||||
|
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=mx8qmmek"
|
||||||
|
"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
|
||||||
|
'';
|
||||||
|
}
|
41
nxp/imx8mp-evk/bsp/imx8mp-uboot.nix
Normal file
41
nxp/imx8mp-evk/bsp/imx8mp-uboot.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{pkgs}:
|
||||||
|
with pkgs; let
|
||||||
|
inherit buildUBoot;
|
||||||
|
in
|
||||||
|
(buildUBoot {
|
||||||
|
pname = "imx8mp-uboot";
|
||||||
|
version = "2023.04";
|
||||||
|
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://github.com/nxp-imx/uboot-imx.git";
|
||||||
|
# tag: "lf-6.1.55-2.2.0"
|
||||||
|
rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f";
|
||||||
|
sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
defconfig = "imx8mp_evk_defconfig";
|
||||||
|
extraMeta.platforms = ["aarch64-linux"];
|
||||||
|
|
||||||
|
filesToInstall = [
|
||||||
|
"./u-boot-nodtb.bin"
|
||||||
|
"./spl/u-boot-spl.bin"
|
||||||
|
"./arch/arm/dts/imx8mp-evk.dtb"
|
||||||
|
".config"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
.overrideAttrs (old: {
|
||||||
|
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.perl];
|
||||||
|
})
|
18
nxp/imx8mp-evk/default.nix
Normal file
18
nxp/imx8mp-evk/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(import ./overlay.nix)
|
||||||
|
];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./modules.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.loader.grub.extraFiles = {
|
||||||
|
"imx8mp-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mp-linux.nix {}}/dtbs/freescale/imx8mp-evk.dtb";
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware.deviceTree = {
|
||||||
|
filter = "imx8mp-*.dtb";
|
||||||
|
name = "imx8mp-evk.dtb";
|
||||||
|
};
|
||||||
|
}
|
16
nxp/imx8mp-evk/modules.nix
Normal file
16
nxp/imx8mp-evk/modules.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
nixpkgs.hostPlatform = "aarch64-linux";
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mp-linux.nix {});
|
||||||
|
initrd.includeDefaultModules = lib.mkForce false;
|
||||||
|
};
|
||||||
|
|
||||||
|
disabledModules = ["profiles/all-hardware.nix"];
|
||||||
|
|
||||||
|
hardware.deviceTree.enable = true;
|
||||||
|
}
|
3
nxp/imx8mp-evk/overlay.nix
Normal file
3
nxp/imx8mp-evk/overlay.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
final: prev: {
|
||||||
|
inherit (final.callPackage ./bsp/imx8mp-boot.nix {pkgs = final;}) imx8m-boot;
|
||||||
|
}
|
Loading…
Reference in a new issue