Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. FAT32_BLOCK_SIZE=1024
  11. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  12. BOARDS:= \
  13. sun4i-a10-cubieboard \
  14. sun4i-a10-olinuxino-lime \
  15. sun4i-a10-pcduino \
  16. sun5i-a13-olinuxino \
  17. sun6i-a31-colombus \
  18. sun7i-a20-bananapi \
  19. sun7i-a20-cubieboard2 \
  20. sun7i-a20-cubietruck \
  21. sun7i-a20-olinuxino-lime \
  22. sun7i-a20-olinuxino-micro \
  23. sun7i-a20-pcduino3
  24. define Image/BuildKernel
  25. mkimage -A arm -O linux -T kernel -C none \
  26. -a 0x40008000 -e 0x40008000 \
  27. -n 'ARM libreCMC Linux-$(LINUX_VERSION)' \
  28. -d $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
  29. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  30. $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
  31. echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
  32. $(call Image/BuildKernel/MkuImage, \
  33. none, 0x40008000, 0x40008000, \
  34. $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
  35. $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
  36. )
  37. endif
  38. $(foreach board,$(BOARDS),
  39. $(CP) $(DTS_DIR)/$(board).dtb $(BIN_DIR)/
  40. )
  41. endef
  42. define Image/Build/SDCard
  43. rm -f $(KDIR)/boot.img
  44. mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
  45. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/uboot-sunxi-$(PROFILE)/librecmc-sunxi-$(PROFILE)-uEnv.txt ::uEnv.txt
  46. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::dtb
  47. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
  48. ./gen_sunxi_sdcard_img.sh \
  49. $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
  50. $(KDIR)/boot.img \
  51. $(KDIR)/root.$(1) \
  52. $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
  53. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  54. $(BIN_DIR)/uboot-sunxi-$(PROFILE)/librecmc-sunxi-$(PROFILE)-u-boot-with-spl.bin
  55. endef
  56. define Image/Build/Profile/A10-OLinuXino-Lime
  57. $(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime)
  58. endef
  59. define Image/Build/Profile/A13-OLinuXino
  60. $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
  61. endef
  62. define Image/Build/Profile/A20-OLinuXino_Lime
  63. $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-lime)
  64. endef
  65. define Image/Build/Profile/A20-OLinuXino_MICRO
  66. $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro)
  67. endef
  68. define Image/Build/Profile/Bananapi
  69. $(call Image/Build/SDCard,$(1),sun7i-a20-bananapi)
  70. endef
  71. define Image/Build/Profile/Cubieboard
  72. $(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard)
  73. endef
  74. define Image/Build/Profile/Cubieboard2
  75. $(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2)
  76. endef
  77. define Image/Build/Profile/OLIMEX-A13-SOM
  78. $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
  79. endef
  80. define Image/Build/Profile/pcDuino
  81. $(call Image/Build/SDCard,$(1),sun4i-a10-pcduino)
  82. endef
  83. define Image/Build/Profile/Linksprite_pcDuino3
  84. $(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3)
  85. endef
  86. define Image/Build
  87. $(call Image/Build/$(1),$(1))
  88. $(call Image/Build/Profile/$(PROFILE),$(1))
  89. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/librecmc-$(BOARD)-root.$(1) bs=128k conv=sync
  90. endef
  91. $(eval $(call BuildImage))