brcm2708: add bcm2711 subtarget (RPi 4B aarch64)
[openwrt/staging/lynxis.git] / target / linux / brcm2708 / 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/kernel-img
20 perl $(LINUX_DIR)/scripts/mkknlimg $@ $@.tmp
21 mv $@.tmp $@
22 endef
23
24 define Build/boot-common
25 rm -f $@.boot
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 cmdline.txt ::
31 mcopy -i $@.boot $(BOOT_CONFIG) ::config.txt
32 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
33 $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
34 mmd -i $@.boot ::/overlays
35 mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
36 mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
37 endef
38
39 define Build/boot-2708
40 mcopy -i $@.boot $(KDIR)/start.elf ::
41 mcopy -i $@.boot $(KDIR)/start_cd.elf ::
42 mcopy -i $@.boot $(KDIR)/start_x.elf ::
43 mcopy -i $@.boot $(KDIR)/fixup.dat ::
44 mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
45 mcopy -i $@.boot $(KDIR)/fixup_x.dat ::
46 endef
47
48 define Build/boot-2711
49 mcopy -i $@.boot $(KDIR)/start4.elf ::
50 mcopy -i $@.boot $(KDIR)/start4cd.elf ::
51 mcopy -i $@.boot $(KDIR)/start4x.elf ::
52 mcopy -i $@.boot $(KDIR)/fixup4.dat ::
53 mcopy -i $@.boot $(KDIR)/fixup4cd.dat ::
54 mcopy -i $@.boot $(KDIR)/fixup4x.dat ::
55 endef
56
57 define Build/boot-armstub8
58 mcopy -i $@.boot $(KDIR)/armstub8-gic.bin ::
59 endef
60
61 define Build/sdcard-img
62 ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
63 $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
64 endef
65
66 ### Devices ###
67 define Device/Default
68 KERNEL := kernel-bin | kernel-img
69 KERNEL_IMG := kernel.img
70 IMAGES := factory.img.gz sysupgrade.img.gz
71 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | sdcard-img | gzip | append-metadata
72 IMAGE/factory.img.gz := boot-common | boot-2708 | sdcard-img | gzip
73 BOOT_CONFIG := config.txt
74 endef
75
76 define Device/rpi
77 DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
78 DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-zero bcm2708-rpi-zero-w
79 SUPPORTED_DEVICES := \
80 rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w \
81 raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,model-b-rev2 \
82 raspberrypi,compute-module raspberrypi,compute-module-1 \
83 raspberrypi,model-zero raspberrypi,model-zero-w
84 DEVICE_PACKAGES := \
85 brcmfmac-firmware-43430-sdio \
86 brcmfmac-firmware-43430-sdio-rpi-zero-w \
87 kmod-brcmfmac wpad-basic
88 endef
89 ifeq ($(SUBTARGET),bcm2708)
90 TARGET_DEVICES += rpi
91 endif
92
93 define Device/rpi-2
94 DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM/4B
95 DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2711-rpi-4-b bcm2710-rpi-cm3
96 SUPPORTED_DEVICES := \
97 rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm \
98 raspberrypi,2-model-b \
99 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
100 raspberrypi,3-compute-module raspberrypi,compute-module-3 \
101 raspberrypi,4-model-b
102 DEVICE_PACKAGES := \
103 brcmfmac-firmware-43430-sdio \
104 brcmfmac-firmware-43430-sdio-rpi-3b \
105 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
106 brcmfmac-firmware-43455-sdio-rpi-3b-plus brcmfmac-firmware-43455-sdio-rpi-4b \
107 kmod-brcmfmac wpad-basic
108 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip | append-metadata
109 IMAGE/factory.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip
110 endef
111 ifeq ($(SUBTARGET),bcm2709)
112 TARGET_DEVICES += rpi-2
113 endif
114
115 define Device/rpi-3
116 KERNEL_IMG := kernel8.img
117 DEVICE_TITLE := Raspberry Pi 3B/3B+/3CM
118 DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus broadcom/bcm2710-rpi-cm3
119 SUPPORTED_DEVICES := \
120 rpi-3-b rpi-3-b-plus \
121 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
122 raspberrypi,3-compute-module raspberrypi,compute-module-3
123 DEVICE_PACKAGES := \
124 brcmfmac-firmware-43430-sdio \
125 brcmfmac-firmware-43430-sdio-rpi-3b \
126 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
127 brcmfmac-firmware-43455-sdio-rpi-3b-plus \
128 kmod-brcmfmac wpad-basic
129 endef
130 ifeq ($(SUBTARGET),bcm2710)
131 TARGET_DEVICES += rpi-3
132 endif
133
134 define Device/rpi-4
135 KERNEL_IMG := kernel8.img
136 DEVICE_TITLE := Raspberry Pi 4B
137 DEVICE_DTS := broadcom/bcm2711-rpi-4-b
138 SUPPORTED_DEVICES := \
139 raspberrypi,4-model-b
140 DEVICE_PACKAGES := \
141 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
142 brcmfmac-firmware-43455-sdio-rpi-4b \
143 kmod-brcmfmac wpad-basic \
144 brcm27xx-armstub
145 IMAGE/sysupgrade.img.gz := boot-common | boot-2711 | boot-armstub8 | sdcard-img | gzip | append-metadata
146 IMAGE/factory.img.gz := boot-common | boot-2711 | boot-armstub8 | sdcard-img | gzip
147 BOOT_CONFIG := config-bcm2711-arm64.txt
148 endef
149 ifeq ($(SUBTARGET),bcm2711)
150 TARGET_DEVICES += rpi-4
151 endif
152
153 $(eval $(call BuildImage))