diff --git a/lib/systems/default.nix b/lib/systems/default.nix index d9d0918c1cc6..b34147e95289 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -135,6 +135,14 @@ rec { powerpc64le = "ppc64le"; }.${final.parsed.cpu.name} or final.parsed.cpu.name; + # Name used by UEFI for architectures. + efiArch = + if final.isx86_32 then "ia32" + else if final.isx86_64 then "x64" + else if final.isAarch32 then "arm" + else if final.isAarch64 then "aa64" + else final.parsed.cpu.name; + darwinArch = { armv7a = "armv7"; aarch64 = "arm64"; diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index d1ccc6c2072f..c112454798d6 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -53,6 +53,13 @@ let image = "/boot/${config.system.boot.loader.kernelFile}"; initrd = "/boot/initrd"; }; + + targetArch = + if config.boot.loader.grub.forcei686 then + "ia32" + else + stdenv.hostPlatform.efiArch; + in menuBuilderGrub2 finalCfg @@ -431,19 +438,6 @@ let fsck.vfat -vn "$out" ''; # */ - # Name used by UEFI for architectures. - targetArch = - if pkgs.stdenv.isi686 || config.boot.loader.grub.forcei686 then - "ia32" - else if pkgs.stdenv.isx86_64 then - "x64" - else if pkgs.stdenv.isAarch32 then - "arm" - else if pkgs.stdenv.isAarch64 then - "aa64" - else - throw "Unsupported architecture"; - # Syslinux (and isolinux) only supports x86-based architectures. canx86BiosBoot = pkgs.stdenv.hostPlatform.isx86; diff --git a/pkgs/applications/window-managers/weston/default.nix b/pkgs/applications/window-managers/weston/default.nix index 905af7579549..1def0f87d003 100644 --- a/pkgs/applications/window-managers/weston/default.nix +++ b/pkgs/applications/window-managers/weston/default.nix @@ -25,7 +25,8 @@ stdenv.mkDerivation rec { }) ]; - nativeBuildInputs = [ meson ninja pkg-config /* wayland-scanner */ python3 ]; + depsBuildBuild = [pkg-config]; + nativeBuildInputs = [ meson ninja pkg-config wayland-scanner python3 ]; buildInputs = [ wayland libGL mesa libxkbcommon cairo /* libxcb libXcursor xlibsWrapper udev */ libdrm /* mtdev libjpeg pam dbus */ libinput libevdev /* pango libunwind freerdp vaapi libva */ pixman diff --git a/pkgs/development/libraries/libudev-zero/default.nix b/pkgs/development/libraries/libudev-zero/default.nix index 1c12504aa38c..601ea7c14dbb 100644 --- a/pkgs/development/libraries/libudev-zero/default.nix +++ b/pkgs/development/libraries/libudev-zero/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub }: +{ lib, stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec { pname = "libudev-zero"; diff --git a/pkgs/misc/arm-trusted-firmware/default.nix b/pkgs/misc/arm-trusted-firmware/default.nix index 49fdc7a829c5..8665f479fe8a 100644 --- a/pkgs/misc/arm-trusted-firmware/default.nix +++ b/pkgs/misc/arm-trusted-firmware/default.nix @@ -126,4 +126,28 @@ in { extraMeta.platforms = ["aarch64-linux"]; filesToInstall = [ "build/${platform}/release/bl31.bin"]; }; + + armTrustedFirmwareIMX8QXP = buildArmTrustedFirmware rec { + src = fetchGit { + url = "https://source.codeaurora.org/external/imx/imx-atf"; + ref = "lf_v2.6"; + }; + platform = "imx8qx"; + enableParallelBuilding = true; + extraMakeFlags = [ "bl31" ]; + extraMeta.platforms = [ "aarch64-linux" ]; + filesToInstall = [ "build/${platform}/release/bl31.bin" ]; + }; + + armTrustedFirmwareIMX8QM = buildArmTrustedFirmware rec { + src = fetchGit { + url = "https://source.codeaurora.org/external/imx/imx-atf"; + ref = "lf_v2.6"; + }; + platform = "imx8qm"; + enableParallelBuilding = true; + extraMakeFlags = [ "bl31" ]; + extraMeta.platforms = [ "aarch64-linux" ]; + filesToInstall = [ "build/${platform}/release/bl31.bin" ]; + }; } diff --git a/pkgs/misc/imx-firmware/default.nix b/pkgs/misc/imx-firmware/default.nix new file mode 100644 index 000000000000..24bf09c01012 --- /dev/null +++ b/pkgs/misc/imx-firmware/default.nix @@ -0,0 +1,60 @@ +{ lib, stdenv, fetchurl}: + +let + + imxurl = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO"; + + fwHdmiVersion = "8.16"; + fwScVersion = "1.13.0"; + fwSecoVersion = "3.8.6"; + + firmwareHdmi = fetchurl rec { + url = "${imxurl}/firmware-imx-${fwHdmiVersion}.bin"; + sha256 = "Bun+uxE5z7zvxnlRwI0vjowKFqY4CgKyiGjbZuilER0="; + executable = true; + }; + + firmwareSc = fetchurl rec { + url = "${imxurl}/imx-sc-firmware-${fwScVersion}.bin"; + sha256 = "YUaBIVCeOOTvifhiEIbKgyGsLZYufv5rs2isdSrw4dc="; + executable = true; + }; + + firmwareSeco = fetchurl rec { + url = "${imxurl}/imx-seco-${fwSecoVersion}.bin"; + sha256 = "eoG19xn283fsP2jP49hD4dIBRwEQqFQ9k3yVWOM8uKQ="; + executable = true; + }; + +in + +stdenv.mkDerivation rec { + pname = "imx-firmware"; + version = "5.15.X_1.0.0-Yocto"; + + dontPatch = true; + dontConfigure = true; + dontBuild = true; + + sourceRoot = "."; + + unpackPhase = '' + ${firmwareHdmi} --auto-accept --force + ${firmwareSc} --auto-accept --force + ${firmwareSeco} --auto-accept --force + ''; + + filesToInstall = [ + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin" + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin" + "imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin" + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img" + "imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin" + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img" + ]; + + installPhase = '' + mkdir -p $out + cp ${lib.concatStringsSep " " filesToInstall} $out + ''; +} diff --git a/pkgs/misc/imx-mkimage/default.nix b/pkgs/misc/imx-mkimage/default.nix new file mode 100644 index 000000000000..0218f642fc54 --- /dev/null +++ b/pkgs/misc/imx-mkimage/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, fetchgit, git, glibc, gcc }: + +stdenv.mkDerivation rec { + pname = "imx-mkimage"; + version = "lf-5.15.32-2.0.0"; + + src = fetchgit { + url = "https://source.codeaurora.org/external/imx/imx-mkimage.git"; + rev = version; + sha256 = "sha256-31pib5DTDPVfiAAoOSzK8HWUlnuiNnfXQIsxbjneMCc="; + leaveDotGit = true; + }; + + patches = [ + ./fix-gcc-for-nix.patch + ]; + + nativeBuildInputs = [ + git + ]; + + buildInputs = [ + gcc + glibc.static + ]; + + makeFlags = [ + "bin" + ]; + + installPhase = '' + mkdir -p $out/bin + install -m 0755 mkimage_imx8 $out/bin + ''; +} diff --git a/pkgs/misc/imx-mkimage/fix-gcc-for-nix.patch b/pkgs/misc/imx-mkimage/fix-gcc-for-nix.patch new file mode 100644 index 000000000000..8c46b02ac95a --- /dev/null +++ b/pkgs/misc/imx-mkimage/fix-gcc-for-nix.patch @@ -0,0 +1,12 @@ +diff --git a/Makefile b/Makefile +index 1c0b039..d379f08 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + + MKIMG = $(PWD)/mkimage_imx8 +-CC = gcc ++CC ?= gcc + CFLAGS ?= -g -O2 -Wall -std=c99 -static + INCLUDE += $(CURR_DIR)/src + diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index fc874e3d3a8e..5fb637c895b7 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -16,7 +16,11 @@ , armTrustedFirmwareRK3328 , armTrustedFirmwareRK3399 , armTrustedFirmwareS905 +, armTrustedFirmwareIMX8QXP +, armTrustedFirmwareIMX8QM , buildPackages +, imx-firmware +, imx-mkimage }: let @@ -515,4 +519,56 @@ in { BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; filesToInstall = [ "u-boot.itb" "idbloader.img"]; }; + + ubootIMX8QXP = buildUBoot { + version = "2022.04"; + src = fetchGit { + url = "https://github.com/tiiuae/uboot-imx8.git"; + ref = "lf_v2022.04-uefi"; + }; + BL31 = "${armTrustedFirmwareIMX8QXP}/bl31.bin"; + enableParallelBuilding = true; + defconfig = "imx8qxp_mek_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + filesToInstall = [ "flash.bin" ]; + preBuildPhases = [ "copyBinaries" ]; + copyBinaries = '' + install -m 0644 ${armTrustedFirmwareIMX8QXP}/bl31.bin ./bl31.bin + install -m 0644 ${imx-firmware}/mx8qxc0-ahab-container.img ./ahab-container.img + install -m 0644 ${imx-firmware}/mx8qx-mek-scfw-tcm.bin ./mx8qx-mek-scfw-tcm.bin + ''; + postBuild = '' + ${buildPackages.imx-mkimage}/bin/mkimage_imx8 -commit > head.hash + cat u-boot.bin head.hash > u-boot-hash.bin + cp bl31.bin u-boot-atf.bin + dd if=u-boot-hash.bin of=u-boot-atf.bin bs=1K seek=128 + ${buildPackages.imx-mkimage}/bin/mkimage_imx8 -soc QX -rev B0 -append ahab-container.img -c -scfw mx8qx-mek-scfw-tcm.bin -ap u-boot-atf.bin a35 0x80000000 -out flash.bin + ''; + }; + + ubootIMX8QM = buildUBoot { + version = "2022.04"; + src = fetchGit { + url = "https://github.com/tiiuae/uboot-imx8.git"; + ref = "lf_v2022.04-uefi"; + }; + BL31 = "${armTrustedFirmwareIMX8QM}/bl31.bin"; + enableParallelBuilding = true; + defconfig = "imx8qm_mek_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + filesToInstall = [ "flash.bin" ]; + preBuildPhases = [ "copyBinaries" ]; + copyBinaries = '' + install -m 0644 ${armTrustedFirmwareIMX8QM}/bl31.bin ./bl31.bin + install -m 0644 ${imx-firmware}/mx8qmb0-ahab-container.img ./ahab-container.img + install -m 0644 ${imx-firmware}/mx8qm-mek-scfw-tcm.bin ./mx8qm-mek-scfw-tcm.bin + ''; + postBuild = '' + ${buildPackages.imx-mkimage}/bin/mkimage_imx8 -commit > head.hash + cat u-boot.bin head.hash > u-boot-hash.bin + cp bl31.bin u-boot-atf.bin + dd if=u-boot-hash.bin of=u-boot-atf.bin bs=1K seek=128 + ${buildPackages.imx-mkimage}/bin/mkimage_imx8 -soc QM -rev B0 -append ahab-container.img -c -scfw mx8qm-mek-scfw-tcm.bin -ap u-boot-atf.bin a35 0x80000000 -out flash.bin + ''; + }; } diff --git a/pkgs/os-specific/linux/kernel/linux-imx8.nix b/pkgs/os-specific/linux/kernel/linux-imx8.nix index b8da9875bd42..0be22ef8d365 100644 --- a/pkgs/os-specific/linux/kernel/linux-imx8.nix +++ b/pkgs/os-specific/linux/kernel/linux-imx8.nix @@ -3,33 +3,31 @@ with lib; buildLinux (args // rec { - version = "5.10.109"; - nxp_ref = "5.10-2.1.x-imx"; + version = "5.15.32"; + nxp_ref = "lf-5.15.y"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; defconfig = "imx_v8_defconfig"; + autoModules = false; + extraConfig = '' - SECURE_KEYS n - FB n - FB_MXC n - FB_MXS n - MFD_MAX17135 n - REGULATOR_ARM_SCMI n - REGULATOR_PF1550_RPMSG n - MXC_PXP y - SND_IMX_SOC n - VIDEO_MXC_CAPTURE n - SENSORS_MAG3110 n - SENSORS_MAX17135 n - CRYPTO_TLS n - STAGING n + 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 ''; src = fetchGit { - url = "https://github.com/Freescale/linux-fslc.git"; + url = "https://source.codeaurora.org/external/imx/linux-imx"; ref = nxp_ref; }; } // (args.argsOverride or { })) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 24744e9eefd4..688ddf9012c0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22825,8 +22825,14 @@ with pkgs; armTrustedFirmwareRK3328 armTrustedFirmwareRK3399 armTrustedFirmwareS905 + armTrustedFirmwareIMX8QXP + armTrustedFirmwareIMX8QM ; + imx-firmware = callPackage ../misc/imx-firmware { }; + + imx-mkimage = callPackage ../misc/imx-mkimage { }; + microcodeAmd = callPackage ../os-specific/linux/microcode/amd.nix { }; microcodeIntel = callPackage ../os-specific/linux/microcode/intel.nix { }; @@ -23932,6 +23938,8 @@ with pkgs; ubootSopine ubootUtilite ubootWandboard + ubootIMX8QXP + ubootIMX8QM ; # Upstream Barebox: