Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. mkdir -p $(TARGET_DIR)/boot
  23. cp \
  24. $(KDIR)/zImage $(KDIR)/uImage \
  25. $(foreach board,$(BOARDS),$(DTS_DIR)/$(board).dtb) \
  26. $(TARGET_DIR)/boot/
  27. endef
  28. define Image/Build/SDCard-vfat-ext4
  29. rm -f $(KDIR)/boot.img
  30. mkfs.fat $(KDIR)/boot.img -C $(FAT32_BLOCKS)
  31. mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(3).dtb ::$(3).dtb
  32. mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
  33. ./gen_sdcard_vfat_ext4.sh \
  34. $(BIN_DIR)/$(2) \
  35. $(BIN_DIR)/uboot-mxs-$(4)/uboot-mxs-$(4).sb \
  36. $(KDIR)/boot.img \
  37. $(KDIR)/root.$(1) \
  38. $(CONFIG_TARGET_BOOTFS_PARTSIZE) \
  39. $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  40. $(call Image/Gzip,$(BIN_DIR)/$(2))
  41. endef
  42. define Image/Build/SDCard-ext4-ext4
  43. ./gen_sdcard_ext4_ext4.sh \
  44. $(BIN_DIR)/$(2) \
  45. $(BIN_DIR)/uboot-mxs-$(4)/uboot-mxs-$(4).sb \
  46. $(KDIR)/root.$(1) \
  47. $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  48. $(call Image/Gzip,$(BIN_DIR)/$(2))
  49. endef
  50. define Image/Build/Profile/olinuxino-maxi
  51. $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
  52. endef
  53. define Image/Build/Profile/olinuxino-micro
  54. $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
  55. endef
  56. define Image/Build/Profile/duckbill
  57. $(call Image/Build/SDCard-ext4-ext4,$(1),$(2),imx28-duckbill,duckbill)
  58. endef
  59. define Image/Build
  60. $(call Image/Build/$(1),$(1))
  61. $(call Image/Build/Profile/$(PROFILE),$(1),$(IMG_PREFIX)-$(PROFILE)-sdcard.img)
  62. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  63. $(call Image/Gzip,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1))
  64. endef
  65. $(eval $(call BuildImage))