Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #
  2. # Copyright (C) 2013 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. include $(INCLUDE_DIR)/host.mk
  10. BOARDS:= \
  11. imx23-olinuxino \
  12. imx28-duckbill
  13. FAT32_BLOCK_SIZE=1024
  14. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_MXS_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  15. define Image/BuildKernel
  16. mkimage -A arm -O linux -T kernel -C none \
  17. -a 0x40008000 -e 0x40008000 \
  18. -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \
  19. -d $(KDIR)/zImage $(KDIR)/uImage
  20. cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
  21. endef
  22. define Image/InstallKernel
  23. ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE),)
  24. mkdir -p $(TARGET_DIR)/boot
  25. cp $(KDIR)/zImage $(TARGET_DIR)/boot/
  26. endif
  27. ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE),)
  28. mkdir -p $(TARGET_DIR)/boot
  29. cp $(KDIR)/uImage $(TARGET_DIR)/boot/
  30. endif
  31. ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
  32. mkdir -p $(TARGET_DIR)/boot
  33. $(foreach board,$(BOARDS),
  34. $(CP) $(DTS_DIR)/$(board).dtb $(TARGET_DIR)/boot/
  35. )
  36. endif
  37. endef
  38. define Image/Build/SDCard
  39. rm -f $(KDIR)/boot.img
  40. mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
  41. mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(2).dtb ::$(2).dtb
  42. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
  43. ./gen_mxs_sdcard_img.sh \
  44. $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
  45. $(KDIR)/boot.img \
  46. $(KDIR)/root.$(1) \
  47. $(CONFIG_MXS_SD_BOOT_PARTSIZE) \
  48. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  49. $(BIN_DIR)/uboot-mxs-$(3).sb
  50. endef
  51. define Image/Build/Profile/olinuxino-maxi
  52. $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
  53. endef
  54. define Image/Build/Profile/olinuxino-micro
  55. $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
  56. endef
  57. define Image/Build/Profile/duckbill
  58. $(call Image/Build/SDCard,$(1),imx28-duckbill,duckbill)
  59. endef
  60. define Image/Build
  61. $(call Image/Build/$(1),$(1))
  62. $(call Image/Build/Profile/$(PROFILE),$(1))
  63. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  64. endef
  65. $(eval $(call BuildImage))