Makefile 3.2 KB

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