2 # Copyright (C) 2012-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9 include $(INCLUDE_DIR)/host.mk
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
14 ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
16 gzip -9n -c $(1) > $(1).gz
26 cat config.txt > $@.config
27 echo -e "\ndevice_tree=$(DEVICE_DTS).dtb" >> $@.config
32 mkfs.fat -C $@.boot $(FAT32_BLOCKS)
33 mcopy -i $@.boot $(KDIR)/bootcode.bin ::
34 mcopy -i $@.boot $(KDIR)/COPYING.linux ::
35 mcopy -i $@.boot $(KDIR)/LICENCE.broadcom ::
36 mcopy -i $@.boot $(KDIR)/start.elf ::
37 mcopy -i $@.boot $(KDIR)/start_cd.elf ::
38 mcopy -i $@.boot $(KDIR)/fixup.dat ::
39 mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
40 mcopy -i $@.boot cmdline.txt ::
41 mcopy -i $@.boot $@.config ::config.txt
42 mcopy -i $@.boot $(word 1,$^) ::kernel.img
43 mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb
46 define Build/sdcard-img
47 ./gen_rpi_sdcard_img.sh $@ $@.boot $(word 2,$^) \
48 $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
55 PROFILES = Default $$(DEVICE_PROFILE)
58 IMAGE/sdcard.bin := gen-cfg | boot-img | sdcard-img
62 DEVICE_VARS += DEVICE_PROFILE DEVICE_DTS
69 DEVICE_PROFILE := $(1)
72 TARGET_DEVICES += $(2)
75 ### BCM2708/BCM2835 ###
76 ifeq ($(SUBTARGET),bcm2708)
77 # Raspberry Pi Model B
78 $(eval $(call add_bcm2708,RaspberryPi_B,rpi-b,bcm2708-rpi-b))
79 # Raspberry Pi Model B+
80 $(eval $(call add_bcm2708,RaspberryPi_BPlus,rpi-b-plus,bcm2708-rpi-b-plus))
81 # Raspberry Pi Compute Module
82 $(eval $(call add_bcm2708,RaspberryPi_CM,rpi-cm,bcm2708-rpi-cm))
85 ### BCM2709/BCM2836 ###
86 ifeq ($(SUBTARGET),bcm2709)
87 # Raspberry Pi 2 Model B
88 $(eval $(call add_bcm2708,RaspberryPi_2,rpi-2-b,bcm2709-rpi-2-b))
91 $(eval $(call BuildImage))