2 # Copyright (C) 2012-2019 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_TARGET_KERNEL_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
24 define Build
/boot-common
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
/
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
::
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
::
57 define Build
/boot-armstub8
58 mcopy
-i
$@.boot
$(KDIR
)/armstub8-gic.bin
::
61 define Build
/sdcard-img
62 .
/gen_rpi_sdcard_img.sh
$@
$@.boot
$(IMAGE_ROOTFS
) \
63 $(CONFIG_TARGET_KERNEL_PARTSIZE
) $(CONFIG_TARGET_ROOTFS_PARTSIZE
)
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
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
85 brcmfmac-firmware-43430-sdio \
86 brcmfmac-firmware-43430-sdio-rpi-zero-w \
87 kmod-brcmfmac wpad-basic
89 ifeq ($(SUBTARGET
),bcm2708
)
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
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
111 ifeq ($(SUBTARGET
),bcm2709
)
112 TARGET_DEVICES
+= rpi-2
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
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
130 ifeq ($(SUBTARGET
),bcm2710
)
131 TARGET_DEVICES
+= rpi-3
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
141 brcmfmac-firmware-43455-sdio brcmfmac-firmware-43455-clm_blob \
142 brcmfmac-firmware-43455-sdio-rpi-4b \
143 kmod-brcmfmac wpad-basic \
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
149 ifeq ($(SUBTARGET
),bcm2711
)
150 TARGET_DEVICES
+= rpi-4
153 $(eval
$(call BuildImage
))