4 Commits

Author SHA1 Message Date
Jörg Thalheim
8650454db6 ucm-imx95: fix firmware parameter collision and update imx-mkimage
Fixed parameter name collision in ucm-imx95-firmware.nix where the
'silicon' parameter conflicted with the nixpkgs silicon package, causing
the wrong AHAB container to be selected. Renamed to 'siliconRev'.

Updated imx-mkimage from lf-6.6.36 to lf-6.6.52-2.2.1 to match the
firmware version expectations (v202409 instead of v202311).
2025-10-30 14:48:44 +01:00
Govind Singh
11ea8b8477 ucm-imx95: firmware: fetch firmware files from NXP release
Fetch AHAB container, M7 firmware, and DDR PHY firmware binaries
from the NXP release packages. The derivation extracts the correct
LPDDR5 PHY images and selects the appropriate AHAB container for
A0 or B0 silicon revisions.

Signed-off-by: Govind Singh <govind.singh@tii.ae>
2025-10-30 14:29:53 +01:00
Govind Singh
a3576f0f3c chore: Add README for UCM-iMX95 SOM support
Added README.md for UCM-iMX95 SOM support.
2025-10-30 14:29:53 +01:00
Govind Singh
fe21eda733 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 <govind.singh@tii.ae>
2025-10-30 14:29:53 +01:00
14 changed files with 718 additions and 0 deletions

29
compulab/README.md Normal file
View File

@@ -0,0 +1,29 @@
# UCM-iMX95 SOM support
## Supported devices
- [UCM-iMX95 System-on-Module](https://www.compulab.com/products/som-evaluation-kits/ucm-imx95-evaluation-kit/) (**ucm-imx95**) based on the NXP i.MX95 SoC (A0 silicon), with device-specific boot components(OEI, SM, ATF), U-Boot, and Linux kernel support, including a NixOS configuration example.
## How to use
This overlay provides configuration and hardware support for the **CompuLab UCM-iMX95** platform, based on the **NXP i.MX95 A0 silicon**. It enables generating NixOS images suitable for booting via U-Boot, using the CompuLab UCM-iMX95 Evaluation Kit carrier board.
### Boot flow
The boot flow for the UCM-iMX95 platform follows the standard NXP i.MX95 sequence:
Boot ROM → OEI (initially in TCM, then DDR) → System Manager (SM) → ARM Trusted Firmware (ATF) → U-Boot → Linux kernel → NixOS userspace
Boot ROM initializes the SoC and loads OEI, which runs in TCM to perform early setup, then configures DDR and loads the System Manager (SM). SM completes SoC initialization and passes control to ATF, which handles secure world setup and then transfers execution to U-Boot, eventually booting the Linux kernel and NixOS root filesystem.
### Example NixOS configuration
```nix
{ nixos-hardware, }: {
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.ucm-imx95
];
}
```
### Notes
- The configuration includes device-tree, kernel, and bootloader components are optimized for the UCM-iMX95 SoM and evk.
- The generated NixOS image supports booting from SD card or eMMC, depending on the hardware configuration.
- The boot components (OEI in TCM/DDR, SM, ATF, U-Boot) follow the standard NXP release layout for i.MX95 platforms.

View File

@@ -0,0 +1,58 @@
{
lib,
fetchFromGitHub,
stdenv,
buildPackages,
pkgsCross,
openssl,
}:
let
target-board = "imx95";
in
stdenv.mkDerivation rec {
pname = "imx95-atf";
version = "2.13.0";
platform = target-board;
enableParallelBuilding = true;
src = fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-atf";
rev = "28affcae957cb8194917b5246276630f9e6343e1";
sha256 = "sha256-a8F+Lf8pwML+tCwawS0N/mrSXWPmFhlUeOg0MCRK3VE=";
};
# Compiler dependencies
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ pkgsCross.aarch64-embedded.stdenv.cc ];
buildInputs = [ openssl ];
makeFlags = [
"HOSTCC=$(CC_FOR_BUILD)"
"CROSS_COMPILE=${pkgsCross.aarch64-embedded.stdenv.cc.targetPrefix}"
"PLAT=${platform}"
"SPD=opteed"
"bl31"
"LDFLAGS=-no-warn-rwx-segments"
];
installPhase = ''
runHook preInstall
mkdir -p $out
cp build/${target-board}/release/bl31.bin $out
runHook postInstall
'';
hardeningDisable = [ "all" ];
dontStrip = true;
meta = with lib; {
homepage = "https://github.com/nxp-imx/imx-atf";
description = "Reference implementation of secure world software for ARMv8-A";
license = [ licenses.bsd3 ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
}

View File

@@ -0,0 +1,88 @@
{
pkgs,
}:
with pkgs;
let
imx95-atf = pkgs.callPackage ./ucm-imx95-atf.nix { };
imx95-firmware = pkgs.callPackage ./ucm-imx95-firmware.nix { };
imx95-uboot = pkgs.callPackage ./ucm-imx95-uboot.nix { };
imx95-optee-os = pkgs.callPackage ./ucm-imx95-optee-os.nix { };
imx95-sm-fw = pkgs.callPackage ./ucm-imx95-sm-fw.nix { };
imx95-oei-ddr = pkgs.callPackage ./ucm-imx95-oei-ddr.nix { };
imx95-oei-tcm = pkgs.callPackage ./ucm-imx95-oei-tcm.nix { };
src = pkgs.fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-mkimage";
#tag: lf-6.6.52-2.2.1
rev = "f620fb8ef7a04c8dbed8119880f5eeffe3e69746";
sha256 = "sha256-JZlX122uZntCIISI1H3Hw+tnk+N/gBJpFFDaZoY8W3c=";
};
shortRev = builtins.substring 0 8 src.rev;
in
{
imx95-boot = pkgs.stdenv.mkDerivation rec {
inherit src;
name = "imx95-mkimage";
version = "lf-6.6.36";
postPatch = ''
substituteInPlace Makefile \
--replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}'
substituteInPlace Makefile \
--replace 'CC = gcc' 'CC = clang'
substituteInPlace iMX95/soc.mak \
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
substituteInPlace scripts/fspi_fcb_gen.sh \
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
substituteInPlace scripts/fspi_packer.sh \
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
patchShebangs scripts
'';
nativeBuildInputs = [
clang
git
dtc
];
buildInputs = [
git
glibc.static
zlib
zlib.static
];
buildPhase = ''
runHook preBuild
if [ -f ${imx95-uboot}/u-boot.bin ]; then
install -m 0644 ${imx95-uboot}/u-boot.bin ./iMX95/u-boot.bin
else
cat ${imx95-uboot}/u-boot-nodtb.bin ${imx95-uboot}/ucm-imx95.dtb > ./iMX95/u-boot.bin
fi
install -m 0644 ${imx95-uboot}/u-boot-spl.bin ./iMX95/u-boot-spl.bin
install -m 0644 ${imx95-uboot}/u-boot-nodtb.bin ./iMX95/u-boot-nodtb.bin
install -m 0644 ${imx95-uboot}/ucm-imx95.dtb ./iMX95/ucm-imx95.dtb
install -m 0644 ${imx95-optee-os}/tee.bin ./iMX95/tee.bin
install -m 0644 ${imx95-atf}/bl31.bin ./iMX95/bl31.bin
install -m 0644 ${imx95-sm-fw}/m33_image.bin ./iMX95/m33_image.bin
install -m 0644 ${imx95-oei-ddr}/oei-m33-ddr.bin ./iMX95/oei-m33-ddr.bin
install -m 0644 ${imx95-oei-tcm}/oei-m33-tcm.bin ./iMX95/oei-m33-tcm.bin
install -m 0644 ${imx95-firmware}/ddr/lpddr5* ./iMX95/
install -m 0644 ${imx95-firmware}/ahab/mx95a0-ahab-container.img ./iMX95/
install -m 0644 ${imx95-firmware}/m7_image.bin ./iMX95/
make SOC=iMX95 REV=A0 OEI=YES LPDDR_TYPE=lpddr5 flash_all
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/image
install -m 0644 ./iMX95/flash.bin $out/image
runHook postInstall
'';
};
}

View File

@@ -0,0 +1,63 @@
{
pkgs,
siliconRev ? "A0",
...
}:
with pkgs;
stdenv.mkDerivation rec {
pname = "nxp-firmware-imx95";
version = "nxp-firmware-8.28-994fa14";
m7Firmware = fetchurl {
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx95-m7-demo-25.09.00.bin";
sha256 = "sha256-3nA6uka6WPtXH5aZhaaKHKRM0tJ0pxHQdPEupNic1Ks=";
};
ddrFirmware = fetchurl {
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.28-994fa14.bin";
sha256 = "sha256-VZlvNA6HglaFoAzTCZARiQZuyVRe5gdzT5QsPN5Nadw=";
};
ahabFirmware = fetchurl {
url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-2.0.2-89161a8.bin";
sha256 = "sha256-LSnwpN42YroV9qfZBpcC1OrtQV2WoX8p1bEn8sb91jQ=";
};
nativeBuildInputs = [
coreutils
bash
];
dontUnpack = true;
dontStrip = true;
installPhase = ''
mkdir -p $out
export SILICON=${siliconRev}
# M7 firmware
echo "Copying M7 firmware..."
cp ${m7Firmware} $out/m7_image.bin
# DDR firmware
cp ${ddrFirmware} ./firmware-imx-8.28-994fa14.bin
chmod +x firmware-imx-8.28-994fa14.bin
./firmware-imx-8.28-994fa14.bin --auto-accept
mkdir -p $out/ddr
cp firmware-imx-8.28-994fa14/firmware/ddr/synopsys/lpddr5*v202409.bin $out/ddr/
# AHAB container
cp ${ahabFirmware} ./firmware-ele-imx-2.0.2-89161a8.bin
chmod +x firmware-ele-imx-2.0.2-89161a8.bin
./firmware-ele-imx-2.0.2-89161a8.bin --auto-accept
mkdir -p $out/ahab
if [ "$SILICON" = "A0" ]; then
cp firmware-ele-imx-2.0.2-89161a8/mx95a0-ahab-container.img $out/ahab/
else
cp firmware-ele-imx-2.0.2-89161a8/mx95b0-ahab-container.img $out/ahab/
fi
'';
}

View File

@@ -0,0 +1,62 @@
{ lib, pkgs, ... }@args:
with pkgs;
buildLinux (
args
// rec {
version = "6.6.36";
name = "imx95-linux";
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
modDirVersion = version;
defconfig = "compulab-mx95_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;
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 = "compulab-yokneam";
repo = "linux-compulab";
# tag: linux-compulab_6.6.36
rev = "b93daaad0807fb15d4f3f1a6e5be843ac7532ef7";
sha256 = "sha256-wCeuGXBTz3H6OFWBA1M1/t/9WgxBVjQ8FU/wvAUVW2w=";
};
meta = with lib; {
homepage = "https://github.com/compulab-yokneam/linux-compulab";
license = [ licenses.gpl2Only ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
}
// (args.argsOverride or { })
)

View File

@@ -0,0 +1,64 @@
{
lib,
pkgs,
}:
pkgs.stdenv.mkDerivation rec {
pname = "imx95-imx-oei";
version = "lf-6.6.36-2.1.0";
nativeBuildInputs = [
pkgs.buildPackages.python3
pkgs.gcc-arm-embedded
];
src = pkgs.fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-oei";
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
};
patches = [
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
})
(pkgs.fetchpatch {
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";
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
})
(pkgs.fetchpatch {
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";
sha256 = "sha256-yyierv2USZlM8Cuxf4FDj4+UtILvJQH9BJSj+fmayL8=";
})
];
postPatch = ''
substituteInPlace oei/makefiles/build_info.mak \
--replace "/bin/echo" "echo"
substituteInPlace Makefile \
--replace "/bin/echo" "echo"
'';
makeFlags = [
"board=mx95lp5"
"CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"OEI_CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"ARCH=arm"
"DDR_CONFIG=lpddr5_timing"
"oei=ddr"
];
installPhase = ''
mkdir -p $out
cp build/mx95lp5/ddr/oei-m33-ddr.bin $out/
'';
meta = with lib; {
homepage = "https://github.com/nxp-imx/imx-oei";
description = "Optional Executable Image assembler for i.MX95 processors";
license = [ licenses.bsd3 ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
}

View File

@@ -0,0 +1,64 @@
{
lib,
pkgs,
}:
pkgs.stdenv.mkDerivation rec {
pname = "imx95-imx-oei-tcm";
version = "lf-6.6.36-2.1.0";
nativeBuildInputs = [
pkgs.buildPackages.python3
pkgs.gcc-arm-embedded
];
src = pkgs.fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-oei";
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
};
patches = [
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
})
(pkgs.fetchpatch {
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";
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
})
(pkgs.fetchpatch {
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";
sha256 = "sha256-yyierv2USZlM8Cuxf4FDj4+UtILvJQH9BJSj+fmayL8=";
})
];
postPatch = ''
substituteInPlace oei/makefiles/build_info.mak \
--replace "/bin/echo" "echo"
substituteInPlace Makefile \
--replace "/bin/echo" "echo"
'';
makeFlags = [
"board=mx95lp5"
"CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"OEI_CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"ARCH=arm"
"DDR_CONFIG=lpddr5_timing"
"oei=tcm"
];
installPhase = ''
mkdir -p $out
cp build/mx95lp5/tcm/oei-m33-tcm.bin $out/
'';
meta = with lib; {
homepage = "https://github.com/nxp-imx/imx-oei";
description = "Optional Executable Image assembler for i.MX95 processors";
license = [ licenses.bsd3 ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
}

View File

@@ -0,0 +1,76 @@
{
lib,
pkgs,
}:
let
inherit (pkgs.buildPackages) python3;
toolchain = pkgs.gccStdenv.cc;
binutils = pkgs.gccStdenv.cc.bintools.bintools_bin;
cpp = pkgs.gcc;
in
pkgs.stdenv.mkDerivation rec {
pname = "imx95-optee-os";
version = "lf-6.6.36_2.1.0";
nativeBuildInputs = [
python3
];
enableParallelBuilding = true;
propagatedBuildInputs = with python3.pkgs; [
pycryptodomex
pyelftools
cryptography
];
src = pkgs.fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-optee-os";
rev = "612bc5a642a4608d282abeee2349d86de996d7ee";
sha256 = "sha256-l8GKkrlBs5kgw6jrzGLT9WAeTSDqo8XWZDFT2+Fisv4=";
};
meta = with lib; {
homepage = "https://github.com/nxp-imx/imx-optee-os";
license = [ licenses.bsd2 ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
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-mx95evk"
"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
'';
}

View File

@@ -0,0 +1,80 @@
{
lib,
pkgs,
}:
pkgs.stdenv.mkDerivation rec {
pname = "imx95-sm-fw";
version = "lf-6.6.36-2.1.0";
nativeBuildInputs = [
pkgs.buildPackages.python3
pkgs.gcc-arm-embedded
];
propagatedBuildInputs = with pkgs.buildPackages.python3.pkgs; [
pycryptodomex
pyelftools
cryptography
];
src = pkgs.fetchFromGitHub {
owner = "nxp-imx";
repo = "imx-sm";
rev = "709deccd9338399eb39b5cf99a60eab4fa60d539";
sha256 = "sha256-02Cl+XhWGSFswspdBJ/4B/mBm4XTs/qKotx0BXMQpJk=";
};
patches = [
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap-6.6.36-EVAL-UCM-iMX95-1.0/recipes-bsp/imx-system-manager/imx-system-manager/0001-Add-mcimx95cust-board.patch";
sha256 = "sha256-zvZ4bNew+yRPmaZQMrAH087KpCLRqz6zdElfe72Dtuc=";
})
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap-6.6.36-EVAL-UCM-iMX95-1.0/recipes-bsp/imx-system-manager/imx-system-manager/0002-Fix-null-pionter-except.patch";
sha256 = "sha256-q72VEvJqm2CmOxdWMqGibgXS5lY08mC4srEcy00QdrE=";
})
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap-6.6.36-EVAL-UCM-iMX95-1.0/recipes-bsp/imx-system-manager/imx-system-manager/0001-update-for-yocto-6.6.36-compatibility.patch";
sha256 = "sha256-JzHqDiD/ZOu6VQQI0JxY17RQ3bA2t1aP3O1sjLPguWs=";
})
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap-6.6.36-EVAL-UCM-iMX95-1.0/recipes-bsp/imx-system-manager/imx-system-manager/0003-sm-Disable-GPIO1-10-interrupt.patch";
sha256 = "sha256-dhcDv7Uq856+MBonczMPznk+tuqUFxTcHiKLX+myCVA=";
})
(pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/scarthgap-6.6.36-EVAL-UCM-iMX95-1.0/recipes-bsp/imx-system-manager/imx-system-manager/0004-configs-mx95cust-change-LPTPM1-ownership.patch";
sha256 = "sha256-NcLu6+zXpiSz1bHKW14Zuf6F/4pzKsekb+zaRtKjSTY=";
})
];
postPatch = ''
substituteInPlace sm/makefiles/gcc_cross.mak \
--replace "\$(SM_CROSS_COMPILE)objcopy" ${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-objcopy
substituteInPlace sm/makefiles/build_info.mak \
--replace "/bin/echo" "echo"
substituteInPlace sm/makefiles/gcc_cross.mak \
--replace 'SM_CROSS_COMPILE ?= $(TOOLS)/arm-gnu-toolchain-*-none-eabi/bin/arm-none-eabi-' \
'SM_CROSS_COMPILE ?= $(CROSS_COMPILE)'
'';
makeFlags = [
"config=mx95cust"
"M=2"
"CROSS_COMPILE=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"CROSS_COMPILE64=${pkgs.gcc-arm-embedded}/bin/arm-none-eabi-"
"ARCH=arm"
];
installPhase = ''
mkdir -p $out
cp build/mx95cust/m33_image.bin $out/
'';
meta = with lib; {
homepage = "https://github.com/nxp-imx/imx-sm";
description = "System Manager firmware for i.MX processors";
license = [ licenses.bsd3 ];
maintainers = with maintainers; [ govindsi ];
platforms = [ "aarch64-linux" ];
};
}

View File

@@ -0,0 +1,94 @@
{
stdenv,
lib,
bison,
dtc,
fetchFromGitHub,
flex,
gnutls,
libuuid,
ncurses,
openssl,
which,
perl,
buildPackages,
efitools,
}:
let
ubsrc = fetchFromGitHub {
owner = "compulab-yokneam";
repo = "u-boot-compulab";
# tag: lf_v2024.04
rev = "824401fe487d7d3cbcf251bd60270bd7fe8d21d0";
sha256 = "sha256-m+YW7+XF/jcNKfyb5533LXGyOWvStqY+MCczAdcNGZI=";
};
in
stdenv.mkDerivation {
pname = "imx95-uboot";
version = "2024.04";
src = ubsrc;
postPatch = ''
patchShebangs tools
patchShebangs scripts
'';
nativeBuildInputs = [
bison
flex
openssl
which
ncurses
libuuid
gnutls
openssl
perl
efitools
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
hardeningDisable = [ "all" ];
enableParallelBuilding = true;
makeFlags = [
"DTC=${lib.getExe buildPackages.dtc}"
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
extraConfig = ''
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x97000000; setenv fdt_addr_r 0x96000000; 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" ];
configurePhase = ''
runHook preConfigure
make ucm-imx95_defconfig
cat $extraConfigPath >> .config
runHook postConfigure
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp ./u-boot-nodtb.bin $out
cp ./spl/u-boot-spl.bin $out
cp ./arch/arm/dts/ucm-imx95.dtb $out
cp .config $out
runHook postInstall
'';
dontStrip = true;
}

View File

@@ -0,0 +1,19 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(import ./overlay.nix)
];
imports = [
./modules.nix
];
boot.loader.grub.extraFiles = {
"ucm-imx95.dtb" = "${pkgs.callPackage ./bsp/ucm-imx95-linux.nix { }}/dtbs/compulab/ucm-imx95.dtb";
};
hardware.deviceTree = {
filter = "ucm-imx95.dtb";
name = "ucm-imx95.dtb";
};
}

View File

@@ -0,0 +1,17 @@
{
pkgs,
lib,
...
}:
{
nixpkgs.hostPlatform = "aarch64-linux";
boot = {
kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/ucm-imx95-linux.nix { });
initrd.includeDefaultModules = lib.mkForce false;
};
disabledModules = [ "profiles/all-hardware.nix" ];
hardware.deviceTree.enable = true;
}

View File

@@ -0,0 +1,3 @@
final: _prev: {
inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { pkgs = final; }) imx95-boot;
}

View File

@@ -364,6 +364,7 @@
nxp-imx8mq-evk = import ./nxp/imx8mq-evk;
nxp-imx8qm-mek = import ./nxp/imx8qm-mek;
nxp-imx93-evk = import ./nxp/imx93-evk;
ucm-imx95 = import ./compulab/ucm-imx95;
hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4;
hardkernel-odroid-h3 = import ./hardkernel/odroid-h3;
hardkernel-odroid-h4 = import ./hardkernel/odroid-h4;