[PATCH v2] imx: add imx8m support

Tim Harvey tharvey at gateworks.com
Fri Jan 12 13:38:11 PST 2024


Add imx8m support:
 - add a cortexa53 subtarget to imx
 - move ARCH and KERNELNAME to subtargets

No device-specific targets or firmware images are created yet but all
imx8m* dtbs will be built.

enabling CONFIG_TARGET_ROOTFS_INITRAMFS results in
openwrt-imx-cortexa53-imx8m-initramfs-kernel.bin which has been
successfully booted on an imx8mm-evk using the following:

u-boot=> tftpboot $fdt_addr_r image-imx8mm-evk.dtb && \
tftpboot $kernel_addr_r openwrt-imx-cortexa53-imx8m-initramfs-kernel.bin && \
booti $kernel_addr_r - $fdt_addr_r

Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
v2:
 - fix build failure regarding ubifs image generation
 - remove kernel patches (these all go away when we move to 6.1
   and I've already submitted a series to add 6.1 support to imx)
 - add a generic imx8m device that picks up imx8m dtb's
 - show example of how I'm booting this in commit log
---
 target/linux/imx/Makefile                 |  5 +-
 target/linux/imx/cortexa53/config-default | 96 +++++++++++++++++++++++
 target/linux/imx/cortexa53/target.mk      |  8 ++
 target/linux/imx/cortexa7/target.mk       |  2 +
 target/linux/imx/cortexa9/target.mk       |  2 +
 target/linux/imx/image/cortexa53.mk       | 16 ++++
 6 files changed, 125 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/imx/cortexa53/config-default
 create mode 100644 target/linux/imx/cortexa53/target.mk
 create mode 100644 target/linux/imx/image/cortexa53.mk

diff --git a/target/linux/imx/Makefile b/target/linux/imx/Makefile
index 5f7f9db589..53c1ccce0c 100644
--- a/target/linux/imx/Makefile
+++ b/target/linux/imx/Makefile
@@ -4,19 +4,16 @@
 
 include $(TOPDIR)/rules.mk
 
-ARCH:=arm
 BOARD:=imx
 BOARDNAME:=NXP i.MX
 FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs boot-part rootfs-part
-SUBTARGETS:=cortexa7 cortexa9
+SUBTARGETS:=cortexa7 cortexa9 cortexa53
 
 KERNEL_PATCHVER:=5.15
 KERNEL_TESTING_PATCHVER:=6.1
 
 include $(INCLUDE_DIR)/target.mk
 
-KERNELNAME:=zImage dtbs
-
 DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/imx/cortexa53/config-default b/target/linux/imx/cortexa53/config-default
new file mode 100644
index 0000000000..de52260489
--- /dev/null
+++ b/target/linux/imx/cortexa53/config-default
@@ -0,0 +1,96 @@
+CONFIG_64BIT=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_VA_BITS_39=y
+CONFIG_ARM64_CRYPTO=y
+CONFIG_ARCH_NXP=y
+CONFIG_CRYPTO_AES_ARM64=y
+CONFIG_CRYPTO_AES_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
+CONFIG_CRYPTO_BLAKE2S=y
+CONFIG_CRYPTO_GHASH_ARM64_CE=y
+CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
+CONFIG_CRYPTO_SHA1_ARM64_CE=y
+CONFIG_CRYPTO_SHA256_ARM64=y
+CONFIG_CRYPTO_SHA2_ARM64_CE=y
+CONFIG_CRYPTO_SHA512_ARM64=y
+CONFIG_CRYPTO_SHA512_ARM64_CE=y
+CONFIG_CRYPTO_ZSTD=y
+CONFIG_UNMAP_KERNEL_AT_EL0=y
+CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_VMAP_STACK=y
+CONFIG_MEMORY_ISOLATION=y
+CONFIG_CMA=y
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+# CONFIG_CMA_SYSFS is not set
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_CONTIG_ALLOC=y
+CONFIG_ZONE_DMA32=y
+CONFIG_ARM_IMX_CPUFREQ_DT=y
+CONFIG_ARM64_CRYPTO=y
+CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx7d.bin"
+CONFIG_EXTRA_FIRMWARE_DIR="firmware"
+CONFIG_PCI=y
+CONFIG_PCIEAER=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIE_PME=y
+CONFIG_PHY_FSL_IMX8M_PCIE=y
+CONFIG_PCIEAER=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIE_DW=y
+CONFIG_PCIE_DW_HOST=y
+CONFIG_PCIE_PME=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_DOMAINS_GENERIC=y
+CONFIG_PCI_IMX6=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_MSI_IRQ_DOMAIN=y
+CONFIG_PINCTRL_IMX=y
+CONFIG_DWMAC_DWC_QOS_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_PINCTRL_IMX=y
+CONFIG_PINCTRL_IMX8MM=y
+CONFIG_PINCTRL_IMX8MN=y
+CONFIG_PINCTRL_IMX8MP=y
+CONFIG_PINCTRL_IMX8MQ=y
+CONFIG_THERMAL=y
+CONFIG_IMX8MM_THERMAL=y
+CONFIG_REGULATOR_MP5416=y
+CONFIG_REGULATOR_PCA9450=y
+CONFIG_USB_CONN_GPIO=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_USB_OTG=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_DUAL_ROLE=y
+# CONFIG_USB_DWC3_GADGET is not set
+# CONFIG_USB_DWC3_HOST is not set
+CONFIG_USB_DWC3_IMX8MP=y
+# CONFIG_MMC_SDHCI_PCI is not set
+CONFIG_CLK_IMX8MM=y
+CONFIG_CLK_IMX8MN=y
+CONFIG_CLK_IMX8MP=y
+CONFIG_CLK_IMX8MQ=y
+CONFIG_CLK_IMX8QXP=y
+CONFIG_SOC_IMX8M=y
+# CONFIG_IMX_DSP is not set
+# CONFIG_IMX_SCU is not set
+CONFIG_EXTCON_USB_GPIO=y
+CONFIG_PHY_FSL_IMX8MQ_USB=y
+# CONFIG_PHY_MIXEL_LVDS_PHY is not set
+CONFIG_RESET_IMX7=y
+CONFIG_INTERCONNECT=y
+CONFIG_INTERCONNECT_IMX=y
+CONFIG_INTERCONNECT_IMX8MM=y
+CONFIG_INTERCONNECT_IMX8MN=y
+CONFIG_INTERCONNECT_IMX8MQ=y
+CONFIG_INTERCONNECT_IMX8MP=y
+# CONFIG_DMA_CMA is not set
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
diff --git a/target/linux/imx/cortexa53/target.mk b/target/linux/imx/cortexa53/target.mk
new file mode 100644
index 0000000000..b9b32d1829
--- /dev/null
+++ b/target/linux/imx/cortexa53/target.mk
@@ -0,0 +1,8 @@
+ARCH:=aarch64
+BOARDNAME:=NXP i.MX with Cortex-A53 (ARM64)
+CPU_TYPE:=cortex-a53
+KERNELNAME:=Image dtbs
+
+define Target/Description
+	Build firmware images for NXP i.MX (Cortex-A53) based boards.
+endef
diff --git a/target/linux/imx/cortexa7/target.mk b/target/linux/imx/cortexa7/target.mk
index 11de87507d..1fec64b00c 100644
--- a/target/linux/imx/cortexa7/target.mk
+++ b/target/linux/imx/cortexa7/target.mk
@@ -1,6 +1,8 @@
+ARCH:=arm
 BOARDNAME:=NXP i.MX with Cortex-A7
 CPU_TYPE:=cortex-a7
 CPU_SUBTYPE:=neon-vfpv4
+KERNELNAME:=zImage dtbs
 
 define Target/Description
 	Build firmware images for NXP i.MX (Cortex-A7) based boards.
diff --git a/target/linux/imx/cortexa9/target.mk b/target/linux/imx/cortexa9/target.mk
index 9bd63c7be1..cc48a8dbd0 100644
--- a/target/linux/imx/cortexa9/target.mk
+++ b/target/linux/imx/cortexa9/target.mk
@@ -1,6 +1,8 @@
+ARCH:=arm
 BOARDNAME:=NXP i.MX with Cortex-A9
 CPU_TYPE:=cortex-a9
 CPU_SUBTYPE:=neon
+KERNELNAME:=zImage dtbs
 
 define Target/Description
 	Build firmware images for NXP i.MX (Cortex-A9) based boards.
diff --git a/target/linux/imx/image/cortexa53.mk b/target/linux/imx/image/cortexa53.mk
new file mode 100644
index 0000000000..075f86c8c1
--- /dev/null
+++ b/target/linux/imx/image/cortexa53.mk
@@ -0,0 +1,15 @@
+define Device/Default
+  PROFILES := Default
+  FILESYSTEMS := squashfs ubifs ext4
+  DEVICE_DTS_DIR := $(DTS_DIR)/freescale
+  KERNEL_INSTALL := 1
+  KERNEL_NAME := Image
+  KERNEL := kernel-bin
+endef
+
+define Device/imx8m
+  DEVICE_VENDOR := NXP
+  DEVICE_MODEL := i.MX8M
+  DEVICE_DTS := $(basename $(notdir $(wildcard $(DTS_DIR)/freescale/imx8m*.dts)))
+endef
+TARGET_DEVICES += imx8m
-- 
2.34.1




More information about the openwrt-devel mailing list