Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #
  2. # Copyright (C) 2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/image.mk
  9. #################################################
  10. # Images
  11. #################################################
  12. # $(1): rootfs contents directory
  13. define Image/mkfs/cpio
  14. ( cd $(call mkfs_target_dir,$(1))/; find . | cpio -o -H newc | gzip -9n > $@ )
  15. endef
  16. # $(1): zynq board id
  17. define Build/dtb
  18. $(call Image/BuildDTB,$(DTS_DIR)/zynq-$(1).dts,$@.dtb)
  19. endef
  20. define Build/uRamdisk
  21. # Create uboot cpio.gz
  22. mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \
  23. -d $(IMAGE_ROOTFS) $@.new
  24. mv $@.new $@
  25. endef
  26. # $(1): FIT name/description
  27. define Build/fit
  28. # create FIT image with rootfs
  29. ./mkits.sh \
  30. -D $(1) -o $@.its -k $(IMAGE_KERNEL) -d $(IMAGE_KERNEL).dtb \
  31. -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \
  32. -A $(ARCH) -v $(LINUX_VERSION) -r $(IMAGE_ROOTFS) -z gzip
  33. PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
  34. endef
  35. #################################################
  36. # Devices
  37. #################################################
  38. # default kernel load address
  39. KERNEL_LOADADDR=0x8000
  40. KERNEL_ENTRY=0x8000
  41. TARGET_FILESYSTEMS += cpio
  42. # $(1): canonical device name
  43. # $(2): lowercase device id
  44. define ZynqDevice
  45. define Device/$(1)
  46. DEVICE_TITLE := $(1) development board
  47. KERNEL := dtb $(2) | kernel-bin | uImage none
  48. KERNEL_NAME = zImage
  49. IMAGES := uramdisk.image.gz fit.itb
  50. IMAGE/uramdisk.image.gz := uRamdisk
  51. IMAGE/fit.itb := fit $(2)
  52. IMAGE_NAME = $$$$(IMG_PREFIX)-$(2)-$$$$(2)
  53. endef
  54. TARGET_DEVICES += $(1)
  55. endef
  56. $(eval $(call ZynqDevice,ZC702,zc702))
  57. $(eval $(call ZynqDevice,ZedBoard,zed))
  58. $(eval $(call ZynqDevice,ZYBO,zybo))
  59. $(eval $(call BuildImage))