mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-08 11:36:10 +01:00
Merge pull request #1650 from govindsi/feat/ucm-imx95-platform
Add support for UCM-iMX95 Evaluation Kit platform
This commit is contained in:
commit
bffe23e699
17 changed files with 820 additions and 20 deletions
29
compulab/README.md
Normal file
29
compulab/README.md
Normal 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, including device-tree, kernel, and bootloader components, is 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.
|
||||
64
compulab/ucm-imx95/bsp/ucm-imx95-atf.nix
Normal file
64
compulab/ucm-imx95/bsp/ucm-imx95-atf.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
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
|
||||
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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
}
|
||||
94
compulab/ucm-imx95/bsp/ucm-imx95-boot.nix
Normal file
94
compulab/ucm-imx95/bsp/ucm-imx95-boot.nix
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
stdenv,
|
||||
clang,
|
||||
git,
|
||||
dtc,
|
||||
glibc,
|
||||
zlib,
|
||||
vim,
|
||||
}:
|
||||
let
|
||||
|
||||
imx95-atf = callPackage ./ucm-imx95-atf.nix { };
|
||||
imx95-firmware = callPackage ./ucm-imx95-firmware.nix { };
|
||||
imx95-uboot = callPackage ./ucm-imx95-uboot.nix { };
|
||||
imx95-optee-os = callPackage ./ucm-imx95-optee-os.nix { };
|
||||
imx95-sm-fw = callPackage ./ucm-imx95-sm-fw.nix { };
|
||||
imx95-oei-ddr = callPackage ./ucm-imx95-oei-ddr.nix { };
|
||||
imx95-oei-tcm = callPackage ./ucm-imx95-oei-tcm.nix { };
|
||||
src = 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 = stdenv.mkDerivation rec {
|
||||
inherit src;
|
||||
name = "imx95-mkimage";
|
||||
version = "lf-6.6.52-2.2.1";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'git rev-parse --short=8 HEAD' 'echo ${shortRev}'
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'CC = gcc' 'CC = clang'
|
||||
substituteInPlace iMX95/soc.mak \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_fcb_gen.sh \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_packer.sh \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
patchShebangs scripts
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
clang
|
||||
git
|
||||
dtc
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
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
|
||||
'';
|
||||
};
|
||||
}
|
||||
74
compulab/ucm-imx95/bsp/ucm-imx95-firmware.nix
Normal file
74
compulab/ucm-imx95/bsp/ucm-imx95-firmware.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
stdenv,
|
||||
fetchurl,
|
||||
coreutils,
|
||||
bash,
|
||||
siliconRev ? "A0",
|
||||
...
|
||||
}:
|
||||
|
||||
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
|
||||
# Resolve wildcard and verify at least one file matches
|
||||
lpddr5_files=(firmware-imx-8.28-994fa14/firmware/ddr/synopsys/lpddr5*v202409.bin)
|
||||
if [ ''${#lpddr5_files[@]} -eq 0 ]; then
|
||||
echo "ERROR: No lpddr5*v202409.bin file found in firmware/ddr/synopsys/" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp "''${lpddr5_files[@]}" $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/
|
||||
elif [ "$SILICON" = "B0" ]; then
|
||||
cp firmware-ele-imx-2.0.2-89161a8/mx95b0-ahab-container.img $out/ahab/
|
||||
else
|
||||
echo "ERROR: Invalid SILICON value '$SILICON'. Must be 'A0' or 'B0'." >&2
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
71
compulab/ucm-imx95/bsp/ucm-imx95-linux.nix
Normal file
71
compulab/ucm-imx95/bsp/ucm-imx95-linux.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
lib,
|
||||
buildLinux,
|
||||
fetchFromGitHub,
|
||||
...
|
||||
}@args:
|
||||
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 fail.
|
||||
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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
}
|
||||
// (args.argsOverride or { })
|
||||
)
|
||||
76
compulab/ucm-imx95/bsp/ucm-imx95-oei-ddr.nix
Normal file
76
compulab/ucm-imx95/bsp/ucm-imx95-oei-ddr.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
gcc-arm-embedded,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
}:
|
||||
let
|
||||
metaBspImx95Rev = "5f4c7b5db846fa3a75055054e32215089d15a7b7"; # scarthgap
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx95-imx-oei";
|
||||
version = "lf-6.6.36-2.1.0";
|
||||
|
||||
nativeBuildInputs = [
|
||||
buildPackages.python3
|
||||
gcc-arm-embedded
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "imx-oei";
|
||||
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
|
||||
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
|
||||
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-oei/imx-oei/0002-board-mx95lp5-Fix-default-DDR_CONFIG-timing-name.patch";
|
||||
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/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-fail "/bin/echo" "echo"
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail "/bin/echo" "echo"
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"board=mx95lp5"
|
||||
"CROSS_COMPILE=${gcc-arm-embedded}/bin/arm-none-eabi-"
|
||||
"OEI_CROSS_COMPILE=${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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
}
|
||||
76
compulab/ucm-imx95/bsp/ucm-imx95-oei-tcm.nix
Normal file
76
compulab/ucm-imx95/bsp/ucm-imx95-oei-tcm.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
gcc-arm-embedded,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
}:
|
||||
let
|
||||
metaBspImx95Rev = "5f4c7b5db846fa3a75055054e32215089d15a7b7"; # scarthgap
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx95-imx-oei-tcm";
|
||||
version = "lf-6.6.36-2.1.0";
|
||||
|
||||
nativeBuildInputs = [
|
||||
buildPackages.python3
|
||||
gcc-arm-embedded
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "imx-oei";
|
||||
rev = "5fca9f47544d03c52ca371eadfffbfd2454e6925";
|
||||
sha256 = "sha256-Sb6u1NlhJpDCOKBu3HqUb4BLEy0F8LYVnJE0tRSvzWc=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-oei/imx-oei/0001-Add-CompuLab-lpddr5_timing.c.patch";
|
||||
sha256 = "sha256-6ZpBOXw2aIhD2i9Wx368xfHq6NvdZghWHU9u8+gRTj8=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-oei/imx-oei/0002-board-mx95lp5-Fix-default-DDR_CONFIG-timing-name.patch";
|
||||
sha256 = "sha256-WZ/vYaTC2iKIC+jnHtnPriCxK9gjRsOv2Uy13Ye4698=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/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-fail "/bin/echo" "echo"
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail "/bin/echo" "echo"
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"board=mx95lp5"
|
||||
"CROSS_COMPILE=${gcc-arm-embedded}/bin/arm-none-eabi-"
|
||||
"OEI_CROSS_COMPILE=${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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
}
|
||||
84
compulab/ucm-imx95/bsp/ucm-imx95-optee-os.nix
Normal file
84
compulab/ucm-imx95/bsp/ucm-imx95-optee-os.nix
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
buildPackages,
|
||||
bash,
|
||||
}:
|
||||
let
|
||||
inherit (buildPackages) python3;
|
||||
toolchain = stdenv.cc;
|
||||
binutils = stdenv.cc.bintools.bintools_bin;
|
||||
cpp = stdenv.cc;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "imx95-optee-os";
|
||||
version = "lf-6.6.36_2.1.0";
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
pycryptodomex
|
||||
pyelftools
|
||||
cryptography
|
||||
];
|
||||
|
||||
src = 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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/arm32_sysreg.py \
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/gen_tee_bin.py \
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/pem_to_pub_c.py \
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \
|
||||
--replace-fail '/bin/bash' '${bash}/bin/bash'
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/${toolchain.targetPrefix}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
|
||||
'';
|
||||
}
|
||||
92
compulab/ucm-imx95/bsp/ucm-imx95-sm-fw.nix
Normal file
92
compulab/ucm-imx95/bsp/ucm-imx95-sm-fw.nix
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
gcc-arm-embedded,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
}:
|
||||
let
|
||||
metaBspImx95Rev = "224eed17cddc573061150e9d2ce6f9acb39ea50e"; # scarthgap-6.6.36-EVAL-UCM-iMX95-1.0
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "imx95-sm-fw";
|
||||
version = "lf-6.6.36-2.1.0";
|
||||
|
||||
nativeBuildInputs = [
|
||||
buildPackages.python3
|
||||
gcc-arm-embedded
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with buildPackages.python3.pkgs; [
|
||||
pycryptodomex
|
||||
pyelftools
|
||||
cryptography
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "imx-sm";
|
||||
rev = "709deccd9338399eb39b5cf99a60eab4fa60d539";
|
||||
sha256 = "sha256-02Cl+XhWGSFswspdBJ/4B/mBm4XTs/qKotx0BXMQpJk=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-system-manager/imx-system-manager/0001-Add-mcimx95cust-board.patch";
|
||||
sha256 = "sha256-zvZ4bNew+yRPmaZQMrAH087KpCLRqz6zdElfe72Dtuc=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-system-manager/imx-system-manager/0002-Fix-null-pionter-except.patch";
|
||||
sha256 = "sha256-q72VEvJqm2CmOxdWMqGibgXS5lY08mC4srEcy00QdrE=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-system-manager/imx-system-manager/0001-update-for-yocto-6.6.36-compatibility.patch";
|
||||
sha256 = "sha256-JzHqDiD/ZOu6VQQI0JxY17RQ3bA2t1aP3O1sjLPguWs=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/recipes-bsp/imx-system-manager/imx-system-manager/0003-sm-Disable-GPIO1-10-interrupt.patch";
|
||||
sha256 = "sha256-dhcDv7Uq856+MBonczMPznk+tuqUFxTcHiKLX+myCVA=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx95/${metaBspImx95Rev}/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-fail "\$(SM_CROSS_COMPILE)objcopy" ${gcc-arm-embedded}/bin/arm-none-eabi-objcopy
|
||||
substituteInPlace sm/makefiles/build_info.mak \
|
||||
--replace-fail "/bin/echo" "echo"
|
||||
substituteInPlace sm/makefiles/gcc_cross.mak \
|
||||
--replace-fail '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=${gcc-arm-embedded}/bin/arm-none-eabi-"
|
||||
"CROSS_COMPILE64=${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 = [
|
||||
{
|
||||
name = "Govind Singh";
|
||||
email = "govind.singh@tii.ae";
|
||||
}
|
||||
];
|
||||
platforms = [ "aarch64-linux" ];
|
||||
};
|
||||
}
|
||||
95
compulab/ucm-imx95/bsp/ucm-imx95-uboot.nix
Normal file
95
compulab/ucm-imx95/bsp/ucm-imx95-uboot.nix
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
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
|
||||
make olddefconfig
|
||||
|
||||
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;
|
||||
}
|
||||
19
compulab/ucm-imx95/default.nix
Normal file
19
compulab/ucm-imx95/default.nix
Normal 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";
|
||||
};
|
||||
}
|
||||
17
compulab/ucm-imx95/modules.nix
Normal file
17
compulab/ucm-imx95/modules.nix
Normal 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;
|
||||
}
|
||||
3
compulab/ucm-imx95/overlay.nix
Normal file
3
compulab/ucm-imx95/overlay.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
final: _prev: {
|
||||
inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { }) imx95-boot;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
}:
|
||||
let
|
||||
inherit (pkgs.buildPackages) python3;
|
||||
toolchain = pkgs.gccStdenv.cc;
|
||||
binutils = pkgs.gccStdenv.cc.bintools.bintools_bin;
|
||||
cpp = pkgs.gcc;
|
||||
toolchain = pkgs.stdenv.cc;
|
||||
binutils = pkgs.stdenv.cc.bintools.bintools_bin;
|
||||
cpp = pkgs.stdenv.gcc;
|
||||
|
||||
# Determine PLATFORM and PLATFORM_FLAVOR from platformFlavor
|
||||
# Format can be either "imx-mx93evk" (full platform string) or "mx8mpevk" (just flavor, platform is "imx")
|
||||
|
|
@ -48,17 +48,17 @@ pkgs.stdenv.mkDerivation {
|
|||
|
||||
# Patch toolchain paths in mk/gcc.mk
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))cpp"${cpp}/bin/${toolchain.targetPrefix}cpp
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ let
|
|||
cpp = pkgs.buildPackages.gcc;
|
||||
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
||||
pname = "imx-optee-os";
|
||||
version = "5.15.32_2.0.0";
|
||||
|
|
@ -41,25 +41,25 @@ pkgs.stdenv.mkDerivation rec {
|
|||
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/arm32_sysreg.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/gen_tee_bin.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace scripts/pem_to_pub_c.py \
|
||||
--replace '/usr/bin/env python3' '${python3}/bin/python'
|
||||
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
|
||||
substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \
|
||||
--replace '/bin/bash' '${pkgs.bash}/bin/bash'
|
||||
--replace-fail '/bin/bash' '${pkgs.bash}/bin/bash'
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
|
||||
substituteInPlace mk/gcc.mk \
|
||||
--replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp
|
||||
--replace-fail "\$(CROSS_COMPILE_\$(sm))cpp" "${cpp}/bin/${toolchain.targetPrefix}cpp"
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ let
|
|||
"raspberry-pi-3"
|
||||
"raspberry-pi-4"
|
||||
"raspberry-pi-5"
|
||||
"nxp-imx8mp-evk"
|
||||
"nxp-imx8mq-evk"
|
||||
"nxp-imx8qm-mek"
|
||||
"nxp-imx93-evk"
|
||||
"ucm-imx95"
|
||||
];
|
||||
|
||||
matchArch =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue