2 # Copyright (C) 2012-2015 OpenWrt.org
3 # Copyright (C) 2016-2017 LEDE project
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
15 $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
19 define Build/kernel-img
20 perl $(LINUX_DIR)/scripts/mkknlimg $@ $@.tmp
26 mkfs.fat -C $@.boot $(FAT32_BLOCKS)
27 mcopy -i $@.boot $(KDIR)/COPYING.linux ::
28 mcopy -i $@.boot $(KDIR)/bootcode.bin ::
29 mcopy -i $@.boot $(KDIR)/LICENCE.broadcom ::
30 mcopy -i $@.boot $(KDIR)/start.elf ::
31 mcopy -i $@.boot $(KDIR)/start_cd.elf ::
32 mcopy -i $@.boot $(KDIR)/fixup.dat ::
33 mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
34 mcopy -i $@.boot cmdline.txt ::
35 mcopy -i $@.boot config.txt ::
36 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
37 $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
38 mmd -i $@.boot ::/overlays
39 mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
40 mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
43 define Build/sdcard-img
44 ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
45 $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
51 KERNEL := kernel-bin | kernel-img
52 KERNEL_IMG := kernel.img
54 IMAGE/sdcard.img := boot-img | sdcard-img
58 DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
59 DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w
61 ifeq ($(SUBTARGET),bcm2708)
66 DEVICE_TITLE := Raspberry Pi 2B/3B/3CM
67 DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3
69 ifeq ($(SUBTARGET),bcm2709)
70 TARGET_DEVICES += rpi-2
74 KERNEL_IMG := kernel8.img
75 DEVICE_TITLE := Raspberry Pi 3B (64 bit)
76 DEVICE_DTS := broadcom/bcm2710-rpi-3-b
78 ifeq ($(SUBTARGET),bcm2710)
79 TARGET_DEVICES += rpi-3
82 $(eval $(call BuildImage))