brcm2708: arm8stub is no longer needed
[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/sdcard-img
58 ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
59 $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
60 endef
61
62 ### Devices ###
63 define Device/Default
64 KERNEL := kernel-bin | kernel-img
65 KERNEL_IMG := kernel.img
66 IMAGES := factory.img.gz sysupgrade.img.gz
67 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | sdcard-img | gzip | append-metadata
68 IMAGE/factory.img.gz := boot-common | boot-2708 | sdcard-img | gzip
69 BOOT_CONFIG := config.txt
70 endef
71
72 define Device/rpi
73 DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
74 DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-zero bcm2708-rpi-zero-w
75 SUPPORTED_DEVICES := \
76 rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w \
77 raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,model-b-rev2 \
78 raspberrypi,compute-module raspberrypi,compute-module-1 \
79 raspberrypi,model-zero raspberrypi,model-zero-w
80 DEVICE_PACKAGES := \
81 brcmfmac-firmware-43430-sdio \
82 brcmfmac-firmware-43430-sdio-rpi-zero-w \
83 kmod-brcmfmac wpad-basic
84 endef
85 ifeq ($(SUBTARGET),bcm2708)
86 TARGET_DEVICES += rpi
87 endif
88
89 define Device/rpi-2
90 DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM/4B
91 DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2711-rpi-4-b bcm2710-rpi-cm3
92 SUPPORTED_DEVICES := \
93 rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm \
94 raspberrypi,2-model-b \
95 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
96 raspberrypi,3-compute-module raspberrypi,compute-module-3 \
97 raspberrypi,4-model-b
98 DEVICE_PACKAGES := \
99 brcmfmac-firmware-43430-sdio \
100 brcmfmac-firmware-43430-sdio-rpi-3b \
101 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
102 brcmfmac-firmware-43455-sdio-rpi-3b-plus brcmfmac-firmware-43455-sdio-rpi-4b \
103 kmod-brcmfmac wpad-basic
104 IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip | append-metadata
105 IMAGE/factory.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip
106 endef
107 ifeq ($(SUBTARGET),bcm2709)
108 TARGET_DEVICES += rpi-2
109 endif
110
111 define Device/rpi-3
112 KERNEL_IMG := kernel8.img
113 DEVICE_TITLE := Raspberry Pi 3B/3B+/3CM
114 DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus broadcom/bcm2710-rpi-cm3
115 SUPPORTED_DEVICES := \
116 rpi-3-b rpi-3-b-plus \
117 raspberrypi,3-model-b raspberrypi,3-model-b-plus \
118 raspberrypi,3-compute-module raspberrypi,compute-module-3
119 DEVICE_PACKAGES := \
120 brcmfmac-firmware-43430-sdio \
121 brcmfmac-firmware-43430-sdio-rpi-3b \
122 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
123 brcmfmac-firmware-43455-sdio-rpi-3b-plus \
124 kmod-brcmfmac wpad-basic
125 endef
126 ifeq ($(SUBTARGET),bcm2710)
127 TARGET_DEVICES += rpi-3
128 endif
129
130 define Device/rpi-4
131 KERNEL_IMG := kernel8.img
132 DEVICE_TITLE := Raspberry Pi 4B
133 DEVICE_DTS := broadcom/bcm2711-rpi-4-b
134 SUPPORTED_DEVICES := \
135 raspberrypi,4-model-b
136 DEVICE_PACKAGES := \
137 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
138 brcmfmac-firmware-43455-sdio-rpi-4b \
139 kmod-brcmfmac wpad-basic
140 IMAGE/sysupgrade.img.gz := boot-common | boot-2711 | sdcard-img | gzip | append-metadata
141 IMAGE/factory.img.gz := boot-common | boot-2711 | sdcard-img | gzip
142 BOOT_CONFIG := config-bcm2711-arm64.txt
143 endef
144 ifeq ($(SUBTARGET),bcm2711)
145 TARGET_DEVICES += rpi-4
146 endif
147
148 $(eval $(call BuildImage))