Makefile 2.3 KB

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