Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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)/fixup.dat ::
  29. mcopy -i [email protected] $(KDIR)/fixup_cd.dat ::
  30. mcopy -i [email protected] cmdline.txt ::
  31. mcopy -i [email protected] config.txt ::
  32. mcopy -i [email protected] $(IMAGE_KERNEL) ::$(KERNEL_IMG)
  33. $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i [email protected] $(DTS_DIR)/$(dts).dtb ::;)
  34. mmd -i [email protected] ::/overlays
  35. mcopy -i [email protected] $(DTS_DIR)/overlays/*.dtbo ::/overlays/
  36. mcopy -i [email protected] $(DTS_DIR)/overlays/README ::/overlays/
  37. endef
  38. define Build/sdcard-img
  39. ./gen_rpi_sdcard_img.sh $@ [email protected] $(IMAGE_ROOTFS) \
  40. $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  41. endef
  42. ### Devices ###
  43. define Device/Default
  44. FILESYSTEMS := ext4
  45. KERNEL := kernel-bin | kernel-img
  46. KERNEL_IMG := kernel.img
  47. IMAGES := sdcard.img.gz
  48. IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata
  49. endef
  50. define Device/rpi
  51. DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
  52. DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w
  53. 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
  54. endef
  55. ifeq ($(SUBTARGET),bcm2708)
  56. TARGET_DEVICES += rpi
  57. endif
  58. define Device/rpi-2
  59. DEVICE_TITLE := Raspberry Pi 2B/3B/3CM
  60. DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3
  61. SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,compute-module-3
  62. endef
  63. ifeq ($(SUBTARGET),bcm2709)
  64. TARGET_DEVICES += rpi-2
  65. endif
  66. define Device/rpi-3
  67. KERNEL_IMG := kernel8.img
  68. DEVICE_TITLE := Raspberry Pi 3B (64 bit)
  69. DEVICE_DTS := broadcom/bcm2710-rpi-3-b
  70. SUPPORTED_DEVICES := rpi-3-b raspberrypi,3-model-b
  71. endef
  72. ifeq ($(SUBTARGET),bcm2710)
  73. TARGET_DEVICES += rpi-3
  74. endif
  75. $(eval $(call BuildImage))