zynq: convert to new image build code

Convert the Zynq target to use the new image build code in order to fix
broken image generation after 9945a1dca5
changed the handling of CPIO images.

Also remove the misapplied ubifs feature flag since the image generation is
not using UBIFS for building FIT images.

As part of the conversion, move the DTB building and the uImage ramdisk
generation into separate build steps which can be generalized and shared
with other targets, like APM821xx, in the long run.

Also remove the legacy profile declarations and use new-style per-device
profiles which will allow different package sets per image in the future.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2016-07-28 14:19:16 +02:00
parent 3c4858eeb2
commit a1248daddf
5 changed files with 38 additions and 96 deletions

View file

@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/host.mk
ARCH:=arm ARCH:=arm
BOARD:=zynq BOARD:=zynq
BOARDNAME:=Xilinx Zynq 7000 SoCs BOARDNAME:=Xilinx Zynq 7000 SoCs
FEATURES:=fpu gpio rtc usb usbgadget targz ubifs FEATURES:=fpu gpio rtc usb usbgadget targz
CPU_TYPE:=cortex-a9 CPU_TYPE:=cortex-a9
CPU_SUBTYPE:=neon CPU_SUBTYPE:=neon
MAINTAINER:=Jason Wu <jason.wu.misc@gamil.com> MAINTAINER:=Jason Wu <jason.wu.misc@gamil.com>

View file

@ -11,33 +11,32 @@ include $(INCLUDE_DIR)/image.mk
# Images # Images
################################################# #################################################
define Image/boot-imgs # $(1): rootfs contents directory
# Copy zImage to BIN_DIR define Image/mkfs/cpio
$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage ( cd $(call mkfs_target_dir,$(1))/; find . | cpio -o -H newc | gzip -9n > $@ )
endef
$(call Image/BuildKernel/MkuImage, none, $(KERNEL_LOADADDR), \ # $(1): zynq board id
$(KERNEL_ENTRY_POINT), $(KDIR)/zImage, \ define Build/dtb
$(BIN_DIR)/$(IMG_PREFIX)-uImage) $(call Image/BuildDTB,$(DTS_DIR)/zynq-$(1).dts,$@.dtb)
endef
$(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,\
$(BIN_DIR)/$(IMG_PREFIX)-system.dtb)
define Build/uRamdisk
# Create uboot cpio.gz # Create uboot cpio.gz
mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \ mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \
-d $(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz \ -d $(IMAGE_ROOTFS) $@.new
$(BIN_DIR)/$(IMG_PREFIX)-uramdisk.image.gz mv $@.new $@
endef
# $(1): FIT name/description
define Build/fit
# create FIT image with rootfs # create FIT image with rootfs
./mkits.sh \ ./mkits.sh \
-D $(DEVICE_LC) -o $(KDIR)/fit-$(DEVICE_LC).its -k $(KDIR)/zImage \ -D $(1) -o $@.its -k $(IMAGE_KERNEL) -d $(IMAGE_KERNEL).dtb \
-d $(BIN_DIR)/$(IMG_PREFIX)-system.dtb \ -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \
-C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY_POINT) \ -A $(ARCH) -v $(LINUX_VERSION) -r $(IMAGE_ROOTFS) -z gzip
-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
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
endef endef
################################################# #################################################
@ -46,36 +45,27 @@ endef
# default kernel load address # default kernel load address
KERNEL_LOADADDR=0x8000 KERNEL_LOADADDR=0x8000
KERNEL_ENTRY_POINT=0x8000 KERNEL_ENTRY=0x8000
### Device macros ### TARGET_FILESYSTEMS += cpio
define Device/Default
IMG_PREFIX := zynq # $(1): canonical device name
PROFILE_SANITIZED := # $(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 endef
define Device/DefaultConfig $(eval $(call ZynqDevice,ZC702,zc702))
DEVICE_LC = $(1) $(eval $(call ZynqDevice,ZedBoard,zed))
IMG_PREFIX = zynq-$(1) $(eval $(call ZynqDevice,ZYBO,zybo))
DEVICE_DTS = zynq-$(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 BuildImage)) $(eval $(call BuildImage))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/ZC702
NAME:=ZC702 development baord
endef
define Profile/ZC702/Description
Build firmware image for Xilinx Zynq ZC702 development board.
endef
$(eval $(call Profile,ZC702))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/ZED
NAME:=ZedBoard development baord
endef
define Profile/ZED/Description
Build firmware image for Avnet Digilent ZedBoard development board.
endef
$(eval $(call Profile,ZED))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/ZYBO
NAME:=ZYBO development baord
endef
define Profile/ZYBO/Description
Build firmware image for Digilent ZYBO development board.
endef
$(eval $(call Profile,ZYBO))