bcm27xx: add bit variant to redundant RaspberryPi
[openwrt/openwrt.git] / target / linux / bcm27xx / image / Makefile
1 #
2 # Copyright (C) 2012-2019 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
11 FAT32_BLOCK_SIZE=1024
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_KERNEL_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
13
14 define Build/Compile
15 $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
16 endef
17
18 ### Image scripts ###
19 define Build/boot-common
20 rm -f $@.boot
21 mkfs.fat -n boot -C $@.boot $(FAT32_BLOCKS)
22 mcopy -i $@.boot $(KDIR)/COPYING.linux ::
23 mcopy -i $@.boot $(KDIR)/LICENCE.broadcom ::
24 mcopy -i $@.boot cmdline.txt ::
25 mcopy -i $@.boot config.txt ::
26 mcopy -i $@.boot distroconfig.txt ::
27 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
28 $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
29 mmd -i $@.boot ::/overlays
30 mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
31 mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
32 endef
33
34 define Build/boot-2708
35 mcopy -i $@.boot $(KDIR)/bootcode.bin ::
36 mcopy -i $@.boot $(KDIR)/start.elf ::
37 mcopy -i $@.boot $(KDIR)/start_cd.elf ::
38 mcopy -i $@.boot $(KDIR)/start_x.elf ::
39 mcopy -i $@.boot $(KDIR)/fixup.dat ::
40 mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
41 mcopy -i $@.boot $(KDIR)/fixup_x.dat ::
42 endef
43
44 define Build/boot-2711
45 mcopy -i $@.boot $(KDIR)/start4.elf ::
46 mcopy -i $@.boot $(KDIR)/start4cd.elf ::
47 mcopy -i $@.boot $(KDIR)/start4x.elf ::
48 mcopy -i $@.boot $(KDIR)/fixup4.dat ::
49 mcopy -i $@.boot $(KDIR)/fixup4cd.dat ::
50 mcopy -i $@.boot $(KDIR)/fixup4x.dat ::
51 endef
52
53 define Build/sdcard-img
54 ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
55 $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
56 endef
57
58 ### Devices ###
59 define Device/Default
60 DEVICE_VENDOR := Raspberry Pi
61 KERNEL := kernel-bin
62 KERNEL_IMG := kernel.img
63 IMAGES := factory.img.gz sysupgrade.img.gz
64 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | sdcard-img | gzip | append-metadata
65 IMAGE/factory.img.gz := boot-common | boot-2708 | sdcard-img | gzip
66 endef
67
68 define Device/rpi
69 DEVICE_MODEL := B/B+/CM/Zero/ZeroW
70 DEVICE_DTS := \
71 bcm2708-rpi-b bcm2708-rpi-b-plus \
72 bcm2708-rpi-cm \
73 bcm2708-rpi-zero bcm2708-rpi-zero-w
74 SUPPORTED_DEVICES := \
75 rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w \
76 raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,model-b-rev2 \
77 raspberrypi,compute-module raspberrypi,compute-module-1 \
78 raspberrypi,model-zero raspberrypi,model-zero-w
79 DEVICE_PACKAGES := \
80 cypress-firmware-43430-sdio \
81 cypress-nvram-43430-sdio-rpi-zero-w \
82 kmod-brcmfmac wpad-basic-wolfssl
83 endef
84 ifeq ($(SUBTARGET),bcm2708)
85 TARGET_DEVICES += rpi
86 endif
87
88 define Device/rpi-2
89 DEVICE_MODEL := 2B/2B 1.2
90 DEVICE_VARIANT := (32bit)
91 DEVICE_ALT0_VENDOR := Raspberry Pi
92 DEVICE_ALT0_MODEL := 3B/3B+/3CM
93 DEVICE_ALT0_VARIANT := (32bit)
94 DEVICE_ALT1_VENDOR := Raspberry Pi
95 DEVICE_ALT1_MODEL := 4B
96 DEVICE_ALT1_VARIANT := (32bit)
97 DEVICE_DTS := \
98 bcm2709-rpi-2-b bcm2710-rpi-2-b \
99 bcm2710-rpi-3-b bcm2710-rpi-3-b-plus \
100 bcm2711-rpi-4-b \
101 bcm2710-rpi-cm3
102 SUPPORTED_DEVICES := \
103 rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm \
104 raspberrypi,2-model-b raspberrypi,2-model-b-rev2 \
105 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
106 raspberrypi,3-compute-module raspberrypi,compute-module-3 \
107 raspberrypi,4-model-b
108 DEVICE_PACKAGES := \
109 cypress-firmware-43430-sdio \
110 cypress-nvram-43430-sdio-rpi-3b \
111 cypress-firmware-43455-sdio \
112 cypress-nvram-43455-sdio-rpi-3b-plus cypress-nvram-43455-sdio-rpi-4b \
113 kmod-brcmfmac wpad-basic-wolfssl
114 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip | append-metadata
115 IMAGE/factory.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip
116 endef
117 ifeq ($(SUBTARGET),bcm2709)
118 TARGET_DEVICES += rpi-2
119 endif
120
121 define Device/rpi-3
122 DEVICE_MODEL := 3B/3B+/3CM
123 DEVICE_VARIANT := (64bit)
124 DEVICE_ALT0_VENDOR := Raspberry Pi
125 DEVICE_ALT0_MODEL := 2B-1.2
126 DEVICE_ALT0_VARIANT := (64bit)
127 KERNEL_IMG := kernel8.img
128 DEVICE_DTS := \
129 broadcom/bcm2710-rpi-2-b \
130 broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus \
131 broadcom/bcm2710-rpi-cm3
132 SUPPORTED_DEVICES := \
133 rpi-3-b rpi-3-b-plus \
134 raspberrypi,2-model-b-rev2 \
135 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
136 raspberrypi,3-compute-module raspberrypi,compute-module-3
137 DEVICE_PACKAGES := \
138 cypress-firmware-43430-sdio \
139 cypress-nvram-43430-sdio-rpi-3b \
140 cypress-firmware-43455-sdio \
141 cypress-nvram-43455-sdio-rpi-3b-plus \
142 kmod-brcmfmac wpad-basic-wolfssl
143 endef
144 ifeq ($(SUBTARGET),bcm2710)
145 TARGET_DEVICES += rpi-3
146 endif
147
148 define Device/rpi-4
149 DEVICE_MODEL := 4B
150 DEVICE_VARIANT := (64bit)
151 KERNEL_IMG := kernel8.img
152 DEVICE_DTS := broadcom/bcm2711-rpi-4-b
153 SUPPORTED_DEVICES := \
154 raspberrypi,4-model-b
155 DEVICE_PACKAGES := \
156 cypress-firmware-43455-sdio \
157 cypress-nvram-43455-sdio-rpi-4b \
158 kmod-brcmfmac wpad-basic-wolfssl
159 IMAGE/sysupgrade.img.gz := boot-common | boot-2711 | sdcard-img | gzip | append-metadata
160 IMAGE/factory.img.gz := boot-common | boot-2711 | sdcard-img | gzip
161 endef
162 ifeq ($(SUBTARGET),bcm2711)
163 TARGET_DEVICES += rpi-4
164 endif
165
166 $(eval $(call BuildImage))