Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #
  2. # Copyright (C) 2012-2015 OpenWrt.org
  3. # Copyright (C) 2016 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. include $(INCLUDE_DIR)/host.mk
  11. FAT32_BLOCK_SIZE=1024
  12. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  13. ### Image scripts ###
  14. define Build/kernel-img
  15. perl $(LINUX_DIR)/scripts/mkknlimg $@ [email protected]
  16. mv [email protected] $@
  17. endef
  18. define Build/boot-img
  19. rm -f [email protected]
  20. mkfs.fat -C [email protected] $(FAT32_BLOCKS)
  21. mcopy -i [email protected] $(LINUX_DIR)/COPYING ::COPYING.linux
  22. mcopy -i [email protected] $(KDIR)/bootcode.bin ::
  23. mcopy -i [email protected] $(KDIR)/LICENCE.broadcom ::
  24. mcopy -i [email protected] $(KDIR)/start.elf ::
  25. mcopy -i [email protected] $(KDIR)/start_cd.elf ::
  26. mcopy -i [email protected] $(KDIR)/fixup.dat ::
  27. mcopy -i [email protected] $(KDIR)/fixup_cd.dat ::
  28. mcopy -i [email protected] cmdline.txt ::
  29. mcopy -i [email protected] config.txt ::
  30. mcopy -i [email protected] $(word 1,$^) ::kernel.img
  31. $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i [email protected] $(DTS_DIR)/$(dts).dtb ::;)
  32. mmd -i [email protected] ::/overlays
  33. mcopy -i [email protected] $(DTS_DIR)/overlays/*.dtbo ::/overlays/
  34. mcopy -i [email protected] $(DTS_DIR)/overlays/README ::/overlays/
  35. endef
  36. define Build/sdcard-img
  37. ./gen_rpi_sdcard_img.sh $@ [email protected] $(word 2,$^) \
  38. $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  39. $(if $(CONFIG_TARGET_IMAGES_GZIP),gzip -9n -c $@ > $(BIN_DIR)/$(notdir $@).gz)
  40. endef
  41. ### Devices ###
  42. define Device/Default
  43. FILESYSTEMS := ext4
  44. KERNEL := kernel-bin | kernel-img
  45. IMAGES := sdcard.img
  46. IMAGE/sdcard.img := boot-img | sdcard-img
  47. DEVICE_DTS :=
  48. endef
  49. DEVICE_VARS += DEVICE_DTS
  50. define Device/rpi
  51. DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero
  52. DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm
  53. endef
  54. ifeq ($(SUBTARGET),bcm2708)
  55. TARGET_DEVICES += rpi
  56. endif
  57. define Device/rpi-2
  58. DEVICE_TITLE := Raspberry Pi 2 B
  59. DEVICE_DTS := bcm2709-rpi-2-b
  60. endef
  61. ifeq ($(SUBTARGET),bcm2709)
  62. TARGET_DEVICES += rpi-2
  63. endif
  64. define Device/rpi-3
  65. DEVICE_TITLE := Raspberry Pi 3 B
  66. DEVICE_DTS := bcm2710-rpi-3-b
  67. DEVICE_PACKAGES := brcmfmac43430-firmware-sdio kmod-brcmfmac wpad-mini
  68. endef
  69. ifeq ($(SUBTARGET),bcm2710)
  70. TARGET_DEVICES += rpi-3
  71. endif
  72. $(eval $(call BuildImage))