Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Copyright (C) 2012-2015 OpenWrt.org
  3. # Copyright (C) 2016-2017 LEDE project
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. include $(INCLUDE_DIR)/image.mk
  10. FAT32_BLOCK_SIZE=1024
  11. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  12. define Build/Compile
  13. $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
  14. endef
  15. ### Image scripts ###
  16. define Build/kernel-img
  17. perl $(LINUX_DIR)/scripts/mkknlimg $@ [email protected]
  18. mv [email protected] $@
  19. endef
  20. define Build/boot-img
  21. rm -f [email protected]
  22. mkfs.fat -C [email protected] $(FAT32_BLOCKS)
  23. mcopy -i [email protected] $(KDIR)/COPYING.linux ::
  24. mcopy -i [email protected] $(KDIR)/bootcode.bin ::
  25. mcopy -i [email protected] $(KDIR)/LICENCE.broadcom ::
  26. mcopy -i [email protected] $(KDIR)/start.elf ::
  27. mcopy -i [email protected] $(KDIR)/start_cd.elf ::
  28. mcopy -i [email protected] $(KDIR)/start_x.elf ::
  29. mcopy -i [email protected] $(KDIR)/fixup.dat ::
  30. mcopy -i [email protected] $(KDIR)/fixup_cd.dat ::
  31. mcopy -i [email protected] $(KDIR)/fixup_x.dat ::
  32. mcopy -i [email protected] cmdline.txt ::
  33. mcopy -i [email protected] config.txt ::
  34. mcopy -i [email protected] $(IMAGE_KERNEL) ::$(KERNEL_IMG)
  35. $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i [email protected] $(DTS_DIR)/$(dts).dtb ::;)
  36. mmd -i [email protected] ::/overlays
  37. mcopy -i [email protected] $(DTS_DIR)/overlays/*.dtbo ::/overlays/
  38. mcopy -i [email protected] $(DTS_DIR)/overlays/README ::/overlays/
  39. endef
  40. define Build/sdcard-img
  41. ./gen_rpi_sdcard_img.sh $@ [email protected] $(IMAGE_ROOTFS) \
  42. $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  43. endef
  44. ### Devices ###
  45. define Device/Default
  46. KERNEL := kernel-bin | kernel-img
  47. KERNEL_IMG := kernel.img
  48. IMAGES := factory.img.gz sysupgrade.img.gz
  49. IMAGE/sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata
  50. IMAGE/factory.img.gz := boot-img | sdcard-img | gzip
  51. endef
  52. define Device/rpi
  53. DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
  54. DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w
  55. SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,compute-module-1 raspberrypi,model-b-rev2 raspberrypi,model-zero raspberrypi,model-zero-w
  56. DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 kmod-brcmfmac wpad-basic
  57. endef
  58. ifeq ($(SUBTARGET),bcm2708)
  59. TARGET_DEVICES += rpi
  60. endif
  61. define Device/rpi-2
  62. DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM
  63. DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3
  64. SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,3-model-b-plus raspberrypi,compute-module-3
  65. DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-firmware-43455-sdio brcmfmac-board-rpi2 brcmfmac-board-rpi3 kmod-brcmfmac wpad-basic
  66. endef
  67. ifeq ($(SUBTARGET),bcm2709)
  68. TARGET_DEVICES += rpi-2
  69. endif
  70. define Device/rpi-3
  71. KERNEL_IMG := kernel8.img
  72. DEVICE_TITLE := Raspberry Pi 3B/3B+
  73. DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus
  74. SUPPORTED_DEVICES := rpi-3-b rpi-3-b-plus raspberrypi,3-model-b raspberrypi,3-model-b-plus
  75. DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 brcmfmac-firmware-43455-sdio brcmfmac-board-rpi3 kmod-brcmfmac wpad-basic
  76. endef
  77. ifeq ($(SUBTARGET),bcm2710)
  78. TARGET_DEVICES += rpi-3
  79. endif
  80. $(eval $(call BuildImage))