Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. sun6i-a31-m9 \
  19. sun7i-a20-bananapi \
  20. sun7i-a20-bananapro \
  21. sun7i-a20-cubieboard2 \
  22. sun7i-a20-cubietruck \
  23. sun7i-a20-olinuxino-lime \
  24. sun7i-a20-olinuxino-micro \
  25. sun7i-a20-pcduino3 \
  26. sun7i-a20-lamobo-r1
  27. define Image/BuildKernel
  28. mkimage -A arm -O linux -T kernel -C none \
  29. -a 0x40008000 -e 0x40008000 \
  30. -n 'ARM libreCMC Linux-$(LINUX_VERSION)' \
  31. -d $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
  32. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  33. $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
  34. echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
  35. $(call Image/BuildKernel/MkuImage, \
  36. none, 0x40008000, 0x40008000, \
  37. $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
  38. $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
  39. )
  40. endif
  41. $(foreach board,$(BOARDS),
  42. $(CP) $(DTS_DIR)/$(board).dtb $(BIN_DIR)/
  43. )
  44. endef
  45. define Image/Build/SDCard
  46. rm -f $(KDIR)/boot.img
  47. mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
  48. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/uboot-sunxi-$(PROFILE)/$(IMG_PREFIX)-$(PROFILE)-boot.scr ::boot.scr
  49. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::dtb
  50. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
  51. ./gen_sunxi_sdcard_img.sh \
  52. $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
  53. $(KDIR)/boot.img \
  54. $(KDIR)/root.$(1) \
  55. $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
  56. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  57. $(BIN_DIR)/uboot-sunxi-$(PROFILE)/$(IMG_PREFIX)-$(PROFILE)-u-boot-with-spl.bin
  58. endef
  59. define Image/Build/Profile/A10-OLinuXino-Lime
  60. $(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime)
  61. endef
  62. define Image/Build/Profile/A13-OLinuXino
  63. $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
  64. endef
  65. define Image/Build/Profile/A20-OLinuXino-Lime
  66. $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-lime)
  67. endef
  68. define Image/Build/Profile/A20-OLinuXino_MICRO
  69. $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro)
  70. endef
  71. define Image/Build/Profile/Bananapi
  72. $(call Image/Build/SDCard,$(1),sun7i-a20-bananapi)
  73. endef
  74. define Image/Build/Profile/Bananapro
  75. $(call Image/Build/SDCard,$(1),sun7i-a20-bananapro)
  76. endef
  77. define Image/Build/Profile/Lamobo_R1
  78. $(call Image/Build/SDCard,$(1),sun7i-a20-lamobo-r1)
  79. endef
  80. define Image/Build/Profile/Cubieboard
  81. $(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard)
  82. endef
  83. define Image/Build/Profile/Cubieboard2
  84. $(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2)
  85. endef
  86. define Image/Build/Profile/Cubietruck
  87. $(call Image/Build/SDCard,$(1),sun7i-a20-cubietruck)
  88. endef
  89. define Image/Build/Profile/OLIMEX_A13_SOM
  90. $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
  91. endef
  92. define Image/Build/Profile/Mele_M9
  93. $(call Image/Build/SDCard,$(1),sun6i-a31-hummingbird)
  94. endef
  95. define Image/Build/Profile/Linksprite_pcDuino
  96. $(call Image/Build/SDCard,$(1),sun4i-a10-pcduino)
  97. endef
  98. define Image/Build/Profile/Linksprite_pcDuino3
  99. $(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3)
  100. endef
  101. define Image/Build
  102. $(call Image/Build/$(1),$(1))
  103. $(call Image/Build/Profile/$(PROFILE),$(1))
  104. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  105. endef
  106. $(eval $(call BuildImage))