Makefile 3.7 KB

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