mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 01:37:24 +08:00
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>
89 lines
2.8 KiB
Nix
89 lines
2.8 KiB
Nix
{
|
|
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.36
|
|
rev = "4622115cbc037f79039c4522faeced4aabea986b";
|
|
sha256 = "sha256-2gz0GxlB3jwy8PC6+cP3+MpyUzqE1vDTw8nuxK6vo3g=";
|
|
};
|
|
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
|
|
'';
|
|
};
|
|
}
|