Skip to content

Commit 7756bdc

Browse files
committed
Add support for UCM-iMX95 Evaluation Kit platform
The CompuLab UCM-iMX95 Evaluation Kit provides a platform for comprehensive evaluation of the NXP i.MX95 application processor. This change adds support in NixOS hardware to provide a template for customized i.MX95-based platforms. UCM-iMX95: https://www.compulab.com/products/som-evaluation-kits/ucm-imx95-evaluation-kit/ Signed-off-by: Govind Singh <[email protected]>
1 parent d6645c3 commit 7756bdc

13 files changed

+643
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
lib,
3+
fetchgit,
4+
stdenv,
5+
buildPackages,
6+
pkgsCross,
7+
openssl,
8+
}:
9+
10+
let
11+
target-board = "imx95";
12+
in
13+
stdenv.mkDerivation rec {
14+
pname = "imx95-atf";
15+
version = "2.13.0";
16+
platform = target-board;
17+
enableParallelBuilding = true;
18+
19+
src = fetchgit {
20+
url = "https://github.com/nxp-imx/imx-atf.git";
21+
rev = "28affcae957cb8194917b5246276630f9e6343e1";
22+
sha256 = "sha256-a8F+Lf8pwML+tCwawS0N/mrSXWPmFhlUeOg0MCRK3VE=";
23+
};
24+
25+
# Compiler dependencies
26+
depsBuildBuild = [ buildPackages.stdenv.cc ];
27+
nativeBuildInputs = [ pkgsCross.aarch64-embedded.stdenv.cc ];
28+
29+
buildInputs = [ openssl ];
30+
31+
makeFlags = [
32+
"HOSTCC=$(CC_FOR_BUILD)"
33+
"CROSS_COMPILE=${pkgsCross.aarch64-embedded.stdenv.cc.targetPrefix}"
34+
"PLAT=${platform}"
35+
"SPD=opteed"
36+
"bl31"
37+
"LDFLAGS=-no-warn-rwx-segments"
38+
];
39+
40+
installPhase = ''
41+
runHook preInstall
42+
mkdir -p $out
43+
cp build/${target-board}/release/bl31.bin $out
44+
runHook postInstall
45+
'';
46+
47+
hardeningDisable = [ "all" ];
48+
dontStrip = true;
49+
50+
meta = with lib; {
51+
homepage = "https://github.com/nxp-imx/imx-atf";
52+
description = "Reference implementation of secure world software for ARMv8-A";
53+
license = [ licenses.bsd3 ];
54+
maintainers = with maintainers; [ govindsi ];
55+
platforms = [ "aarch64-linux" ];
56+
};
57+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
pkgs,
3+
}:
4+
with pkgs;
5+
let
6+
7+
imx95-atf = pkgs.callPackage ./ucm-imx95-atf.nix { };
8+
imx95-firmware = pkgs.callPackage ./ucm-imx95-firmware.nix { };
9+
imx95-uboot = pkgs.callPackage ./ucm-imx95-uboot.nix { };
10+
imx95-optee-os = pkgs.callPackage ./ucm-imx95-optee-os.nix { };
11+
imx95-sm-fw = pkgs.callPackage ./ucm-imx95-sm-fw.nix { };
12+
imx95-oei-ddr = pkgs.callPackage ./ucm-imx95-oei-ddr.nix { };
13+
imx95-oei-tcm = pkgs.callPackage ./ucm-imx95-oei-tcm.nix { };
14+
src = pkgs.fetchgit {
15+
url = "https://github.com/nxp-imx/imx-mkimage.git";
16+
#tag: lf-6.6.36
17+
rev = "4622115cbc037f79039c4522faeced4aabea986b";
18+
sha256 = "sha256-2gz0GxlB3jwy8PC6+cP3+MpyUzqE1vDTw8nuxK6vo3g=";
19+
};
20+
shortRev = builtins.substring 0 8 src.rev;
21+
in
22+
{
23+
imx95-boot = pkgs.stdenv.mkDerivation rec {
24+
inherit src;
25+
name = "imx95-mkimage";
26+
version = "lf-6.6.36";
27+
28+
postPatch = ''
29+
substituteInPlace Makefile \
30+
--replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}'
31+
substituteInPlace Makefile \
32+
--replace 'CC = gcc' 'CC = clang'
33+
substituteInPlace iMX95/soc.mak \
34+
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
35+
substituteInPlace scripts/fspi_fcb_gen.sh \
36+
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
37+
substituteInPlace scripts/fspi_packer.sh \
38+
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
39+
patchShebangs scripts
40+
'';
41+
42+
nativeBuildInputs = [
43+
clang
44+
git
45+
dtc
46+
];
47+
48+
buildInputs = [
49+
git
50+
glibc.static
51+
zlib
52+
zlib.static
53+
];
54+
55+
buildPhase = ''
56+
runHook preBuild
57+
58+
if [ -f ${imx95-uboot}/u-boot.bin ]; then
59+
install -m 0644 ${imx95-uboot}/u-boot.bin ./iMX95/u-boot.bin
60+
else
61+
cat ${imx95-uboot}/u-boot-nodtb.bin ${imx95-uboot}/ucm-imx95.dtb > ./iMX95/u-boot.bin
62+
fi
63+
install -m 0644 ${imx95-uboot}/u-boot-spl.bin ./iMX95/u-boot-spl.bin
64+
install -m 0644 ${imx95-uboot}/u-boot-nodtb.bin ./iMX95/u-boot-nodtb.bin
65+
install -m 0644 ${imx95-uboot}/ucm-imx95.dtb ./iMX95/ucm-imx95.dtb
66+
install -m 0644 ${imx95-optee-os}/tee.bin ./iMX95/tee.bin
67+
install -m 0644 ${imx95-atf}/bl31.bin ./iMX95/bl31.bin
68+
install -m 0644 ${imx95-sm-fw}/m33_image.bin ./iMX95/m33_image.bin
69+
install -m 0644 ${imx95-oei-ddr}/oei-m33-ddr.bin ./iMX95/oei-m33-ddr.bin
70+
install -m 0644 ${imx95-oei-tcm}/oei-m33-tcm.bin ./iMX95/oei-m33-tcm.bin
71+
install -m 0644 ${imx95-firmware}/ucm-imx95/lpddr5* ./iMX95/
72+
install -m 0644 ${imx95-firmware}/ucm-imx95/mx95a0-ahab-container.img ./iMX95/
73+
install -m 0644 ${imx95-firmware}/ucm-imx95/m7_image.bin ./iMX95/
74+
75+
make SOC=iMX95 REV=A0 OEI=YES LPDDR_TYPE=lpddr5 flash_all
76+
77+
runHook postBuild
78+
'';
79+
80+
installPhase = ''
81+
runHook preInstall
82+
mkdir -p $out/image
83+
install -m 0644 ./iMX95/flash.bin $out/image
84+
runHook postInstall
85+
'';
86+
};
87+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ pkgs, ... }:
2+
with pkgs;
3+
stdenv.mkDerivation rec {
4+
pname = "comms-sbc-firmware";
5+
version = "v0_6.36";
6+
7+
src = builtins.fetchGit {
8+
url = "[email protected]:tiiuae/comms-sbc-firmware.git";
9+
rev = "06394d6d983955734257fdc7f719e454a3ce07f4";
10+
};
11+
12+
nativeBuildInputs = [
13+
pkgs.rsync
14+
pkgs.coreutils
15+
];
16+
dontUnpack = true;
17+
dontStrip = true;
18+
19+
installPhase = ''
20+
mkdir -p $out
21+
# copy everything except .git
22+
rsync -a --exclude='.git' $src/ $out/
23+
'';
24+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{ lib, pkgs, ... }@args:
2+
with pkgs;
3+
buildLinux (
4+
args
5+
// rec {
6+
version = "6.6.36";
7+
name = "imx95-linux";
8+
9+
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
10+
modDirVersion = version;
11+
12+
defconfig = "compulab-mx95_defconfig";
13+
14+
# https://github.com/NixOS/nixpkgs/pull/366004
15+
# introduced a breaking change that if a module is declared but it is not being used it will faill.
16+
ignoreConfigErrors = true;
17+
18+
kernelPatches = [
19+
];
20+
21+
autoModules = false;
22+
23+
extraConfig = ''
24+
CRYPTO_TLS m
25+
TLS y
26+
MD_RAID0 m
27+
MD_RAID1 m
28+
MD_RAID10 m
29+
MD_RAID456 m
30+
DM_VERITY m
31+
LOGO y
32+
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n
33+
FB_EFI n
34+
EFI_STUB y
35+
EFI y
36+
VIRTIO y
37+
VIRTIO_PCI y
38+
VIRTIO_BLK y
39+
DRM_VIRTIO_GPU y
40+
EXT4_FS y
41+
USBIP_CORE m
42+
USBIP_VHCI_HCD m
43+
USBIP_HOST m
44+
USBIP_VUDC m
45+
'';
46+
47+
src = fetchFromGitHub {
48+
owner = "compulab-yokneam";
49+
repo = "linux-compulab";
50+
# tag: linux-compulab_6.6.36
51+
rev = "b93daaad0807fb15d4f3f1a6e5be843ac7532ef7";
52+
sha256 = "sha256-wCeuGXBTz3H6OFWBA1M1/t/9WgxBVjQ8FU/wvAUVW2w=";
53+
};
54+
meta = with lib; {
55+
homepage = "https://github.com/compulab-yokneam/linux-compulab";
56+
license = [ licenses.gpl2Only ];
57+
maintainers = with maintainers; [ govindsi ];
58+
platforms = [ "aarch64-linux" ];
59+
};
60+
}
61+
// (args.argsOverride or { })
62+
)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
lib,
3+
pkgs,
4+
}:
5+
pkgs.stdenv.mkDerivation rec {
6+
pname = "imx95-imx-oei";
7+
version = "lf-6.6.36-2.1.0";
8+
9+
nativeBuildInputs = [
10+
pkgs.buildPackages.python3
11+
pkgs.gcc-arm-embedded
12+
];
13+
14+
src = pkgs.fetchgit {
15+
url = "https://github.com/nxp-imx/imx-oei.git";
16+
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
17+
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
18+
};
19+
20+
patches = [
21+
(pkgs.fetchpatch {
22+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
23+
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
24+
})
25+
(pkgs.fetchpatch {
26+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0002-board-mx95lp5-Fix-default-DDR_CONFIG-timing-name.patch";
27+
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
28+
})
29+
(pkgs.fetchpatch {
30+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0003-Add-CompuLab-lpddr5_timing_4g.c.patch";
31+
sha256 = "sha256-yyierv2USZlM8Cuxf4FDj4+UtILvJQH9BJSj+fmayL8=";
32+
})
33+
];
34+
35+
postPatch = ''
36+
substituteInPlace oei/makefiles/build_info.mak \
37+
--replace "/bin/echo" "echo"
38+
substituteInPlace Makefile \
39+
--replace "/bin/echo" "echo"
40+
'';
41+
42+
makeFlags = [
43+
"board=mx95lp5"
44+
"CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
45+
"OEI_CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
46+
"ARCH=arm"
47+
"DDR_CONFIG=lpddr5_timing"
48+
"oei=ddr"
49+
];
50+
51+
installPhase = ''
52+
mkdir -p $out
53+
cp build/mx95lp5/ddr/oei-m33-ddr.bin $out/
54+
'';
55+
56+
meta = with lib; {
57+
homepage = "https://github.com/nxp-imx/imx-oei";
58+
description = "Optional Executable Image assembler for i.MX95 processors";
59+
license = [ licenses.bsd3 ];
60+
maintainers = with maintainers; [ govindsi ];
61+
platforms = [ "aarch64-linux" ];
62+
};
63+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
lib,
3+
pkgs,
4+
}:
5+
pkgs.stdenv.mkDerivation rec {
6+
pname = "imx95-imx-oei-tcm";
7+
version = "lf-6.6.36-2.1.0";
8+
9+
nativeBuildInputs = [
10+
pkgs.buildPackages.python3
11+
pkgs.gcc-arm-embedded
12+
];
13+
14+
src = pkgs.fetchgit {
15+
url = "https://github.com/nxp-imx/imx-oei.git";
16+
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
17+
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
18+
};
19+
20+
patches = [
21+
(pkgs.fetchpatch {
22+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
23+
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
24+
})
25+
(pkgs.fetchpatch {
26+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0002-board-mx95lp5-Fix-default-DDR_CONFIG-timing-name.patch";
27+
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
28+
})
29+
(pkgs.fetchpatch {
30+
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0003-Add-CompuLab-lpddr5_timing_4g.c.patch";
31+
sha256 = "sha256-yyierv2USZlM8Cuxf4FDj4+UtILvJQH9BJSj+fmayL8=";
32+
})
33+
];
34+
35+
postPatch = ''
36+
substituteInPlace oei/makefiles/build_info.mak \
37+
--replace "/bin/echo" "echo"
38+
substituteInPlace Makefile \
39+
--replace "/bin/echo" "echo"
40+
'';
41+
42+
makeFlags = [
43+
"board=mx95lp5"
44+
"CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
45+
"OEI_CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
46+
"ARCH=arm"
47+
"DDR_CONFIG=lpddr5_timing"
48+
"oei=tcm"
49+
];
50+
51+
installPhase = ''
52+
mkdir -p $out
53+
cp build/mx95lp5/tcm/oei-m33-tcm.bin $out/
54+
'';
55+
56+
meta = with lib; {
57+
homepage = "https://github.com/nxp-imx/imx-oei";
58+
description = "Optional Executable Image assembler for i.MX95 processors";
59+
license = [ licenses.bsd3 ];
60+
maintainers = with maintainers; [ govindsi ];
61+
platforms = [ "aarch64-linux" ];
62+
};
63+
}

0 commit comments

Comments
 (0)