aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/imx/image/common.mk
diff options
context:
space:
mode:
authorLech Perczak <lech.perczak@gmail.com>2022-04-28 23:31:34 +0200
committerPiotr Dymacz <pepe2k@gmail.com>2022-07-11 14:18:40 +0200
commitd545825cb36bb119d7941386c017ffa8b24c810d (patch)
tree540c31a260cdf625227fc9a339df85de6bccdd65 /target/linux/imx/image/common.mk
parent2e297377bf77f6051e5fed8c4fb684fd17d41987 (diff)
downloadupstream-d545825cb36bb119d7941386c017ffa8b24c810d.tar.gz
upstream-d545825cb36bb119d7941386c017ffa8b24c810d.tar.bz2
upstream-d545825cb36bb119d7941386c017ffa8b24c810d.zip
imx: extract common combined image operations between subtargets
The same combined image format can be used to boot both i.MX 6 and i.MX 7 platforms - extract the common part. Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Diffstat (limited to 'target/linux/imx/image/common.mk')
-rw-r--r--target/linux/imx/image/common.mk51
1 files changed, 51 insertions, 0 deletions
diff --git a/target/linux/imx/image/common.mk b/target/linux/imx/image/common.mk
new file mode 100644
index 00000000000..8a9b2605842
--- /dev/null
+++ b/target/linux/imx/image/common.mk
@@ -0,0 +1,51 @@
+define Build/imx-combined-image-prepare
+ rm -rf $@.boot
+ mkdir -p $@.boot
+endef
+
+define Build/imx-combined-image-clean
+ rm -rf $@.boot $@.fs
+endef
+
+define Build/imx-combined-image
+ $(CP) $(IMAGE_KERNEL) $@.boot/uImage
+
+ $(foreach dts,$(DEVICE_DTS), \
+ $(CP) \
+ $(DTS_DIR)/$(dts).dtb \
+ $@.boot/;
+ )
+
+ mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
+ -n '$(DEVICE_ID) OpenWrt bootscript' \
+ -d bootscript-$(DEVICE_NAME) \
+ $@.boot/boot.scr
+
+ cp $@ $@.fs
+
+ $(SCRIPT_DIR)/gen_image_generic.sh $@ \
+ $(CONFIG_TARGET_KERNEL_PARTSIZE) \
+ $@.boot \
+ $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
+ $@.fs \
+ 1024
+endef
+
+define Build/imx-sdcard
+ $(Build/imx-combined-image-prepare)
+
+ if [ -f $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img ]; then \
+ $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img \
+ $@.boot/u-boot.img; \
+ fi
+
+ if [ -f $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot-dtb.img ]; then \
+ $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot-dtb.img \
+ $@.boot/u-boot-dtb.img; \
+ fi
+
+ $(Build/imx-combined-image)
+ dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
+
+ $(Build/imx-combined-image-clean)
+endef