tools: add i.MX8/8X image support
Subsystems (3)
PATCH 1/3 tools: add i.MX8/8X image support
i.MX8/8X bootable image type is container type.
The bootable image, containers a container set which supports two container. The 1st container is for SECO firmware, the 2nd container needs to include scfw, m4_0/1 image, ACore images per your requirement.
---
Note:
This is a porting from imx-mkimage to U-Boot mkimage for i.MX8/8X.
The README file is not included, this will be added later.
To test this patchset, need apply https://lists.denx.de/pipermail/u-boot/2018-September/341920.html
common/image.c | 1 + include/image.h | 1 + include/imx8image.h | 273 +++++++++++++++ tools/Makefile | 1 + tools/imagetool.h | 1 + tools/imx8image.c | 961 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/mkimage.c | 7 + 7 files changed, 1245 insertions(+) create mode 100644 include/imx8image.h create mode 100644 tools/imx8image.c
common/image.c +1 -0
@@ -139,6 +139,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_KERNEL_NOLOAD, "kernel_noload", "Kernel Image (no loading done)", }, { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",}, + { IH_TYPE_IMX8IMAGE, "imx8image", "NXP i.MX8 Boot Image",}, { IH_TYPE_INVALID, "invalid", "Invalid Image", }, { IH_TYPE_MULTI, "multi", "Multi-File Image", }, { IH_TYPE_OMAPIMAGE, "omapimage", "TI OMAP SPL With GP CH",},
include/image.h +1 -0
@@ -251,6 +251,7 @@ enum {IH_TYPE_FLATDT ,/* Binary Flat Device Tree Blob */ IH_TYPE_KWBIMAGE ,/* Kirkwood Boot Image */ IH_TYPE_IMXIMAGE ,/* Freescale IMXBoot Image */ +IH_TYPE_IMX8IMAGE ,/* Freescale IMX8Boot Image */ IH_TYPE_UBLIMAGE ,/* Davinci UBL Image */ IH_TYPE_OMAPIMAGE ,/* TI OMAP Config Header Image */ IH_TYPE_AISIMAGE, /* TI Davinci AIS Image */
include/imx8image.h new file +273 -0
273 lines not on this page · raw message
tools/Makefile +1 -0
@@ -93,6 +93,7 @@ dumpimage-mkimage-objs := aisimage.o \ common/image.o \ imagetool.o \ imximage.o \ + imx8image.o \ kwbimage.o \ lib/md5.o \ lpc32xximage.o \
tools/imagetool.h +1 -0
@@ -232,6 +232,7 @@ time_t imagetool_get_source_date(void pbl_load_uboot (int fd,struct image_tool_params *mparams);int zynqmpbif_copy_image (int fd,struct image_tool_params *mparams); +int imx8image_copy_image (int fd,struct image_tool_params *mparams);#define ___cat (a, b) a ## b#define __cat (a, b) ___cat(a, b)
tools/imx8image.c new file +961 -0
961 lines not on this page · raw message
tools/mkimage.c +7 -0
@@ -523,6 +523,13 @@ int main(int argc, char **argv) ret =zynqmpbif_copy_image (ifd, ¶ms);if (ret)return ret; + }else if (params.type ==IH_TYPE_IMX8IMAGE ) { +/* i.MX8/8X has special Image format */ +int ret; + + ret =imx8image_copy_image (ifd, ¶ms); +if (ret) +return ret; }else {copy_file (ifd, params.datafile, pad_len); }
Signature · 1 line
2.14.1
PATCH 2/3 arm: imx: include imx8image support
When building i.MX8/8X board, use imx8image type.
-e $(CONFIG_SYS_TEXT_BASE) is not needed, but
no harm to keep it for i.MX8/8X
--- arch/arm/mach-imx/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
arch/arm/mach-imx/Makefile +11 -6
@@ -84,24 +84,29 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%) $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cpp_cfg) -MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ - -e $(CONFIG_SYS_TEXT_BASE) +IMAGE_TYPE = imximage +ifeq ($(CONFIG_ARCH_IMX8), y) +IMAGE_TYPE = imx8image +endif + +MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ + -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE) u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE $(call if_changed,mkimage) ifeq ($(CONFIG_OF_SEPARATE),y) -MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ - -e $(CONFIG_SYS_TEXT_BASE) +MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ + -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE) u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log u-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE $(call if_changed,mkimage) endif -MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ - -e $(CONFIG_SPL_TEXT_BASE) +MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ + -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) SPL: MKIMAGEOUTPUT = SPL.log SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout $(PLUGIN).bin FORCE
Signature · 1 line
2.14.1
PATCH 3/3 imx: imx8qxp_mek: update to build image in U-Boot
In reply to Peng FanUpdate README
Add imximage.cfg
Update defconfig to include imximage.cfg
--- board/freescale/imx8qxp_mek/README | 41 ++++++++++---------------------- board/freescale/imx8qxp_mek/imximage.cfg | 25 +++++++++++++++++++ configs/imx8qxp_mek_defconfig | 1 + 3 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 board/freescale/imx8qxp_mek/imximage.cfg
board/freescale/imx8qxp_mek/README +12 -29
@@ -3,20 +3,12 @@ U-Boot for the NXP i.MX8QXP EVK board Quick Start =========== -- Build U-Boot - Build the ARM Trusted firmware binary - Get scfw_tcm.bin and ahab-container.img -- Get mkimage tool -- Generate flash.bin using imx-mkimage +- Build U-Boot - Flash the binary into the SD card - Boot -Build U-Boot -============ - -$ make imx8qxp_mek_defconfig -$ make - Get and Build the ARM Trusted firmware ======================================
@@ -35,37 +27,28 @@ $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.6.bin $ chmod +x firmware-imx-7.6.bin $ ./firmware-imx-7.6.bin -Get imx-mkimage tool -============================== -Download the imx-mkimage tool: +Copy the following binaries to U-Boot folder: -$ git clone https://source.codeaurora.org/external/imx/imx-mkimage/ -$ cd imx-mkimage/ -$ git checkout origin/imx_4.9.88_imx8qxp_beta2 -b imx_4.9.88_imx8qxp_beta2 - - -Generate flash.bin using imx-mkimage -==================================== - -Copy the following binaries to imx-mkimage/iMX8M folder: +$ cp imx-atf/build/imx8qxp/release/bl31.bin . +$ cp u-boot/u-boot.bin . -$ cp imx-atf/build/imx8qxp/release/bl31.bin imx-mkimage/iMX8QX/ -$ cp u-boot/u-boot.bin imx-mkimage/iMX8QX/ +Copy the following firmwares U-Boot folder : -Copy the following firmwares to imx-mkimage/iMX8 folder : +$ cp firmware-imx-7.6/firmware/seco/ahab-container.img . +$ cp imx-sc-firmware-0.7/mx8qx-mek-scfw-tcm.bin . -$ cp firmware-imx-7.6/firmware/seco/ahab-container.img imx-mkimage/iMX8QX/ -$ cp imx-sc-firmware-0.7/mx8qx-mek-scfw-tcm.bin imx-mkimage/iMX8QX/scfw_tcm.bin +Build U-Boot +============ -$ cd imx-mkimage/ -$ make SOC=iMX8QX flash +$ make imx8qxp_mek_defconfig +$ make Flash the binary into the SD card ================================= Burn the flash.bin binary to SD card offset 32KB: -$ sudo dd if=iMX8QX/flash.bin of=/dev/sd[x] bs=1024 seek=32 +$ sudo dd if=u-boot-dtb.imx of=/dev/sd[x] bs=1024 seek=32 Boot ====
board/freescale/imx8qxp_mek/imximage.cfg new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2018 NXP + * + * Refer doc/README.imx8image for more details about how-to configure + * and create imx8image boot image + */ + +#define __ASSEMBLY__ +#include <config.h> + +/* Boot from SD, sector size 0x400 */ +BOOT_FROM SD 0x400 +/* SoC type IMX8QX */ +SOC_TYPE IMX8QX +/* Append seco container image */ +APPEND ahab-container.img +/* Create the 2nd container */ +CONTAINER +/* Add scfw image with exec attribute */ +IMAGE SCU mx8qx-mek-scfw-tcm.bin +/* Add ATF image with exec attribute */ +IMAGE A35 bl31.bin 0x80000000 +/* Add U-Boot image with load attribute */ +DATA A35 u-boot-dtb.bin 0x80020000
configs/imx8qxp_mek_defconfig +1 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_IMX8=y CONFIG_SYS_TEXT_BASE=0x80020000 +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8qxp_mek/imximage.cfg" CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_IMX8QXP_MEK=y CONFIG_NR_DRAM_BANKS=3
Signature · 1 line
2.14.1