Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. #################################################
  10. # Images
  11. #################################################
  12. DEVICE_VARS += MKUBIFS_OPTS UBOOT BOOT_SCRIPT
  13. define Build/boot-overlay
  14. rm -rf [email protected]
  15. mkdir -p [email protected]
  16. $(CP) $@ [email protected]/$(IMG_PREFIX)-uImage
  17. ln -sf $(IMG_PREFIX)-uImage [email protected]/uImage
  18. $(foreach dts,$(DEVICE_DTS), \
  19. $(CP) \
  20. $(DTS_DIR)/$(dts).dtb \
  21. [email protected]/$(IMG_PREFIX)-$(dts).dtb; \
  22. ln -sf \
  23. $(IMG_PREFIX)-$(dts).dtb \
  24. [email protected]/$(dts).dtb; \
  25. )
  26. mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
  27. -n '$(DEVICE_ID) OpenWrt bootscript' \
  28. -d ./bootscript-$(DEVICE_NAME) \
  29. [email protected]/6x_bootscript-$(DEVICE_NAME)
  30. $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
  31. --space-fixup --compr=zlib --squash-uids \
  32. $(MKUBIFS_OPTS) -c 8124 \
  33. -o [email protected] -d [email protected]
  34. $(TAR) -C [email protected] -cf [email protected] .
  35. endef
  36. define Build/bootfs.tar.gz
  37. rm -rf [email protected]
  38. mkdir -p [email protected]
  39. $(TAR) -C [email protected] -xf $(IMAGE_KERNEL).boot.tar
  40. $(TAR) -C [email protected] \
  41. --numeric-owner --owner=0 --group=0 --transform "s,./,./boot/," \
  42. -czvf $@ .
  43. endef
  44. define Build/boot-scr
  45. mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
  46. -n '$(DEVICE_ID) OpenWrt bootscript' \
  47. -d ./bootscript-$(DEVICE_NAME) \
  48. $(BIN_DIR)/boot.scr
  49. endef
  50. define Build/recovery-scr
  51. mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
  52. -n '$(DEVICE_ID) OpenWrt recovery bootscript' \
  53. -d ./recovery-$(DEVICE_NAME) $@
  54. endef
  55. define Build/imx6-combined-image-prepare
  56. rm -rf [email protected]
  57. mkdir -p [email protected]
  58. endef
  59. define Build/imx6-combined-image-clean
  60. rm -rf [email protected] [email protected]
  61. endef
  62. define Build/imx6-combined-image
  63. $(CP) $(IMAGE_KERNEL) [email protected]/uImage
  64. $(foreach dts,$(DEVICE_DTS), \
  65. $(CP) \
  66. $(DTS_DIR)/$(dts).dtb \
  67. [email protected]/;
  68. )
  69. mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
  70. -n '$(DEVICE_ID) OpenWrt bootscript' \
  71. -d $(BOOT_SCRIPT) \
  72. [email protected]/boot.scr
  73. cp $@ [email protected]
  74. $(SCRIPT_DIR)/gen_image_generic.sh $@ \
  75. $(CONFIG_TARGET_KERNEL_PARTSIZE) \
  76. [email protected] \
  77. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  78. [email protected] \
  79. 1024
  80. endef
  81. define Build/imx6-sdcard
  82. $(Build/imx6-combined-image-prepare)
  83. $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img [email protected]/u-boot.img
  84. $(Build/imx6-combined-image)
  85. dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
  86. $(Build/imx6-combined-image-clean)
  87. endef
  88. define Build/apalis-emmc
  89. $(Build/imx6-combined-image-prepare)
  90. $(Build/imx6-combined-image)
  91. $(Build/imx6-combined-image-clean)
  92. endef
  93. #################################################
  94. # Devices
  95. #################################################
  96. KERNEL_LOADADDR=0x10008000
  97. define Device/Default
  98. PROFILES := Generic
  99. FILESYSTEMS := squashfs ext4
  100. KERNEL_INSTALL := 1
  101. KERNEL_SUFFIX := -uImage
  102. KERNEL_NAME := zImage
  103. KERNEL_PREFIX := $$(IMAGE_PREFIX)
  104. KERNEL := kernel-bin | uImage none
  105. IMAGES :=
  106. endef
  107. define Device/ventana
  108. DEVICE_VENDOR := Gateworks
  109. DEVICE_MODEL := Ventana family
  110. DEVICE_VARIANT := normal NAND flash
  111. DEVICE_DTS:= \
  112. imx6dl-gw51xx \
  113. imx6dl-gw52xx \
  114. imx6dl-gw53xx \
  115. imx6dl-gw54xx \
  116. imx6dl-gw551x \
  117. imx6dl-gw552x \
  118. imx6dl-gw553x \
  119. imx6dl-gw5904 \
  120. imx6q-gw51xx \
  121. imx6q-gw52xx \
  122. imx6q-gw53xx \
  123. imx6q-gw54xx \
  124. imx6q-gw5400-a \
  125. imx6q-gw551x \
  126. imx6q-gw552x \
  127. imx6q-gw553x \
  128. imx6q-gw5904
  129. DEVICE_PACKAGES := kmod-sky2 kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
  130. kmod-can kmod-can-flexcan kmod-can-raw \
  131. kmod-hwmon-gsc \
  132. kmod-leds-gpio kmod-pps-gpio \
  133. kobs-ng
  134. KERNEL += | boot-overlay
  135. IMAGES := nand.ubi bootfs.tar.gz dtb
  136. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
  137. UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
  138. BOOT_SCRIPT := bootscript-ventana
  139. IMAGE/nand.ubi := append-ubi
  140. IMAGE/bootfs.tar.gz := bootfs.tar.gz
  141. IMAGE/dtb := install-dtb
  142. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
  143. PAGESIZE := 2048
  144. BLOCKSIZE := 128k
  145. MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
  146. endef
  147. TARGET_DEVICES += ventana
  148. define Device/ventana-large
  149. $(Device/ventana)
  150. DEVICE_VENDOR := Gateworks
  151. DEVICE_MODEL := Ventana family
  152. DEVICE_VARIANT := large NAND flash
  153. DEVICE_NAME := ventana
  154. IMAGES := nand.ubi
  155. PAGESIZE := 4096
  156. BLOCKSIZE := 256k
  157. MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB
  158. endef
  159. TARGET_DEVICES += ventana-large
  160. define Device/wandboard
  161. DEVICE_VENDOR := Wandboard
  162. DEVICE_MODEL := Dual
  163. DEVICE_DTS := imx6dl-wandboard
  164. endef
  165. TARGET_DEVICES += wandboard
  166. define Device/cubox-i
  167. DEVICE_VENDOR := SolidRun
  168. DEVICE_MODEL := CuBox-i
  169. KERNEL := kernel-bin
  170. UBOOT := mx6cuboxi
  171. BOOT_SCRIPT = bootscript-cubox
  172. DEVICE_NAME := cubox
  173. DEVICE_PACKAGES := kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
  174. DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i imx6q-hummingboard imx6dl-hummingboard
  175. IMAGES := combined.bin dtb
  176. FILESYSTEMS := squashfs
  177. IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard
  178. IMAGE/dtb := install-dtb
  179. endef
  180. TARGET_DEVICES += cubox-i
  181. define Device/apalis
  182. DEVICE_VENDOR := Toradex
  183. DEVICE_MODEL := Apalis family
  184. SUPPORTED_DEVICES := apalis,ixora apalis,eval
  185. DEVICE_DTS := \
  186. imx6q-apalis-eval \
  187. imx6q-apalis-ixora \
  188. imx6q-apalis-ixora-v1.1
  189. DEVICE_PACKAGES := \
  190. kmod-can kmod-can-flexcan kmod-can-raw \
  191. kmod-leds-gpio kmod-gpio-button-hotplug \
  192. kmod-pps-gpio kmod-rtc-ds1307
  193. BOOT_SCRIPT := bootscript-apalis
  194. UBOOT := apalis_imx6
  195. FILESYSTEMS := squashfs
  196. IMAGES := combined.bin sysupgrade.bin
  197. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
  198. IMAGE/combined.bin := append-rootfs | pad-extra 128k | apalis-emmc
  199. IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  200. ARTIFACTS := recovery.scr
  201. ARTIFACT/recovery.scr := recovery-scr
  202. endef
  203. TARGET_DEVICES += apalis
  204. $(eval $(call BuildImage))