aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/zynq/image
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/zynq/image')
-rw-r--r--target/linux/zynq/image/Makefile86
1 files changed, 38 insertions, 48 deletions
diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile
index 4c85bc283d..a4400c7287 100644
--- a/target/linux/zynq/image/Makefile
+++ b/target/linux/zynq/image/Makefile
@@ -11,33 +11,32 @@ include $(INCLUDE_DIR)/image.mk
# Images
#################################################
-define Image/boot-imgs
- # Copy zImage to BIN_DIR
- $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
-
- $(call Image/BuildKernel/MkuImage, none, $(KERNEL_LOADADDR), \
- $(KERNEL_ENTRY_POINT), $(KDIR)/zImage, \
- $(BIN_DIR)/$(IMG_PREFIX)-uImage)
+# $(1): rootfs contents directory
+define Image/mkfs/cpio
+ ( cd $(call mkfs_target_dir,$(1))/; find . | cpio -o -H newc | gzip -9n > $@ )
+endef
- $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,\
- $(BIN_DIR)/$(IMG_PREFIX)-system.dtb)
+# $(1): zynq board id
+define Build/dtb
+ $(call Image/BuildDTB,$(DTS_DIR)/zynq-$(1).dts,$@.dtb)
+endef
+define Build/uRamdisk
# Create uboot cpio.gz
mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \
- -d $(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz \
- $(BIN_DIR)/$(IMG_PREFIX)-uramdisk.image.gz
+ -d $(IMAGE_ROOTFS) $@.new
+ mv $@.new $@
+endef
+# $(1): FIT name/description
+define Build/fit
# create FIT image with rootfs
./mkits.sh \
- -D $(DEVICE_LC) -o $(KDIR)/fit-$(DEVICE_LC).its -k $(KDIR)/zImage \
- -d $(BIN_DIR)/$(IMG_PREFIX)-system.dtb \
- -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY_POINT) \
- -A $(ARCH) -v $(LINUX_VERSION) \
- -r $(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz -z gzip
- PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(DEVICE_LC).its $(KDIR)/fit-$(DEVICE_LC).itb
- $(CP) $(KDIR)/fit-$(DEVICE_LC).itb $(BIN_DIR)/$(IMG_PREFIX)-fit.itb
- ln -fs $(IMG_PREFIX)-fit.itb $(BIN_DIR)/fit.itb
+ -D $(1) -o $@.its -k $(IMAGE_KERNEL) -d $(IMAGE_KERNEL).dtb \
+ -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \
+ -A $(ARCH) -v $(LINUX_VERSION) -r $(IMAGE_ROOTFS) -z gzip
+ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
endef
#################################################
@@ -46,36 +45,27 @@ endef
# default kernel load address
KERNEL_LOADADDR=0x8000
-KERNEL_ENTRY_POINT=0x8000
-
-### Device macros ###
-define Device/Default
- IMG_PREFIX := zynq
- PROFILE_SANITIZED :=
-endef
-
-define Device/DefaultConfig
- DEVICE_LC = $(1)
- IMG_PREFIX = zynq-$(1)
- DEVICE_DTS = zynq-$(1)
+KERNEL_ENTRY=0x8000
+
+TARGET_FILESYSTEMS += cpio
+
+# $(1): canonical device name
+# $(2): lowercase device id
+define ZynqDevice
+ define Device/$(1)
+ DEVICE_TITLE := $(1) development board
+ KERNEL := dtb $(2) | kernel-bin | uImage none
+ KERNEL_NAME = zImage
+ IMAGES := uramdisk.image.gz fit.itb
+ IMAGE/uramdisk.image.gz := uRamdisk
+ IMAGE/fit.itb := fit $(2)
+ IMAGE_NAME = $$$$(IMG_PREFIX)-$(2)-$$$$(2)
+ endef
+ TARGET_DEVICES += $(1)
endef
-### ZC702 ###
-define Device/ZC702
- $(call Device/DefaultConfig,zc702)
-endef
-
-define Device/ZED
- $(call Device/DefaultConfig,zed)
-endef
-
-define Device/ZYBO
- $(call Device/DefaultConfig,zybo)
-endef
-
-define Image/BuildKernel
- $(eval $(call Device/$(PROFILE)))
- $(call Image/boot-imgs)
-endef
+$(eval $(call ZynqDevice,ZC702,zc702))
+$(eval $(call ZynqDevice,ZedBoard,zed))
+$(eval $(call ZynqDevice,ZYBO,zybo))
$(eval $(call BuildImage))