1include conf/machine/include/rpi-default-settings.inc
2include conf/machine/include/rpi-default-versions.inc
3include conf/machine/include/rpi-default-providers.inc
4
5SOC_FAMILY = "rpi"
6include conf/machine/include/soc-family.inc
7
8IMAGE_FSTYPES ?= "tar.bz2 ext3 wic.bz2 wic.bmap"
9WKS_FILE ?= "sdimage-raspberrypi.wks"
10
11XSERVER = " \
12    xserver-xorg \
13    ${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "xserver-xorg-extension-glx", "", d)} \
14    ${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "xf86-video-modesetting", "xf86-video-fbdev", d)} \
15    "
16
17RPI_KERNEL_DEVICETREE_OVERLAYS ?= " \
18    overlays/overlay_map.dtb \
19    overlays/at86rf233.dtbo \
20    overlays/disable-bt.dtbo \
21    overlays/disable-wifi.dtbo \
22    overlays/dwc2.dtbo \
23    overlays/gpio-ir.dtbo \
24    overlays/gpio-ir-tx.dtbo \
25    overlays/gpio-key.dtbo \
26    overlays/gpio-poweroff.dtbo \
27    overlays/gpio-shutdown.dtbo \
28    overlays/hifiberry-amp.dtbo \
29    overlays/hifiberry-amp100.dtbo \
30    overlays/hifiberry-amp3.dtbo \
31    overlays/hifiberry-amp4pro.dtbo \
32    overlays/hifiberry-dac.dtbo \
33    overlays/hifiberry-dacplus.dtbo \
34    overlays/hifiberry-dacplusadc.dtbo \
35    overlays/hifiberry-dacplusadcpro.dtbo \
36    overlays/hifiberry-dacplusdsp.dtbo \
37    overlays/hifiberry-dacplushd.dtbo \
38    overlays/hifiberry-digi-pro.dtbo \
39    overlays/hifiberry-digi.dtbo \
40    overlays/justboom-both.dtbo \
41    overlays/justboom-dac.dtbo \
42    overlays/justboom-digi.dtbo \
43    overlays/i2c-gpio.dtbo \
44    overlays/i2c-rtc.dtbo \
45    overlays/imx219.dtbo \
46    overlays/imx477.dtbo \
47    overlays/imx708.dtbo \
48    overlays/iqaudio-dac.dtbo \
49    overlays/iqaudio-dacplus.dtbo \
50    overlays/mcp2515-can0.dtbo \
51    overlays/mcp2515-can1.dtbo \
52    overlays/mcp3008.dtbo \
53    overlays/miniuart-bt.dtbo \
54    overlays/pitft22.dtbo \
55    overlays/pitft28-capacitive.dtbo \
56    overlays/pitft28-resistive.dtbo \
57    overlays/pitft35-resistive.dtbo \
58    overlays/pps-gpio.dtbo \
59    overlays/rpi-ft5406.dtbo \
60    overlays/rpi-poe.dtbo \
61    overlays/vc4-fkms-v3d.dtbo \
62    overlays/vc4-fkms-v3d-pi4.dtbo \
63    overlays/vc4-kms-v3d.dtbo \
64    overlays/vc4-kms-v3d-pi4.dtbo \
65    overlays/vc4-kms-v3d-pi5.dtbo \
66    overlays/vc4-kms-dsi-7inch.dtbo \
67    overlays/w1-gpio.dtbo \
68    overlays/w1-gpio-pullup.dtbo \
69    overlays/wm8960-soundcard.dtbo \
70    "
71
72RPI_KERNEL_DEVICETREE ?= " \
73    broadcom/bcm2708-rpi-zero.dtb \
74    broadcom/bcm2708-rpi-zero-w.dtb \
75    broadcom/bcm2708-rpi-b.dtb \
76    broadcom/bcm2708-rpi-b-rev1.dtb \
77    broadcom/bcm2708-rpi-b-plus.dtb \
78    broadcom/bcm2709-rpi-2-b.dtb \
79    broadcom/bcm2710-rpi-2-b.dtb \
80    broadcom/bcm2710-rpi-3-b.dtb \
81    broadcom/bcm2710-rpi-3-b-plus.dtb \
82    broadcom/bcm2710-rpi-zero-2.dtb \
83    broadcom/bcm2711-rpi-4-b.dtb \
84    broadcom/bcm2711-rpi-400.dtb \
85    broadcom/bcm2708-rpi-cm.dtb \
86    broadcom/bcm2710-rpi-cm3.dtb \
87    broadcom/bcm2711-rpi-cm4.dtb \
88    broadcom/bcm2711-rpi-cm4s.dtb \
89    broadcom/bcm2712-rpi-5-b.dtb \
90    "
91
92KERNEL_DEVICETREE ??= " \
93    ${RPI_KERNEL_DEVICETREE} \
94    ${RPI_KERNEL_DEVICETREE_OVERLAYS} \
95    "
96
97# By default:
98#
99# * When u-boot is disabled use the "Image" format which can be directly loaded
100#   by the rpi firmware.
101#
102# * When u-boot is enabled use the "uImage" format and the "bootm" command
103#   within u-boot to load the kernel.
104KERNEL_BOOTCMD ??= "bootm"
105KERNEL_IMAGETYPE_UBOOT ??= "uImage"
106KERNEL_IMAGETYPE_DIRECT ??= "zImage"
107KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
108        '${KERNEL_IMAGETYPE_UBOOT}', '${KERNEL_IMAGETYPE_DIRECT}', d)}"
109
110MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio ${@bb.utils.contains('DISABLE_VC4GRAPHICS', '1', '', 'vc4graphics', d)}"
111
112# Raspberry Pi has no hardware clock
113MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc"
114
115MACHINE_EXTRA_RRECOMMENDS += "kernel-modules udev-rules-rpi"
116MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_I2C', '1', 'kernel-module-i2c-dev kernel-module-i2c-bcm2708', '', d)}"
117MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_IR', '1', 'kernel-module-gpio-ir kernel-module-gpio-ir-tx', '', d)}"
118MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_GPIO_SHUTDOWN', '1', 'gpio-shutdown kernel-module-gpio-keys', '', d)}"
119
120SERIAL_CONSOLES_CHECK ??= "${SERIAL_CONSOLES}"
121
122# The name of the deploy directory for raspberry pi boot files.
123# This variable is referred to by recipes fetching / generating the files.
124BOOTFILES_DIR_NAME ?= "bootfiles"
125
126def make_dtb_boot_files(d):
127    # Generate IMAGE_BOOT_FILES entries for device tree files listed in
128    # KERNEL_DEVICETREE.
129    alldtbs = d.getVar('KERNEL_DEVICETREE')
130
131    # DTBs may be built out of kernel with devicetree.bbclass
132    if not alldtbs:
133        return ''
134
135    def transform(dtb):
136        base = os.path.basename(dtb)
137        if dtb.endswith('dtbo') or base == 'overlay_map.dtb':
138            # overlay dtb:
139            # eg: overlays/hifiberry-amp.dtbo has:
140            #     DEPLOYDIR file: hifiberry-amp.dtbo
141            #     destination: overlays/hifiberry-amp.dtbo
142            return '{};{}'.format(base, dtb)
143        elif dtb.endswith('dtb'):
144            # eg: whatever/bcm2708-rpi-b.dtb has:
145            #     DEPLOYDIR file: bcm2708-rpi-b.dtb
146            #     destination: bcm2708-rpi-b.dtb
147            return base
148
149    return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])
150
151RPI_EXTRA_IMAGE_BOOT_FILES ?= " \
152	${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
153		'${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
154		'${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
155	"
156
157IMAGE_BOOT_FILES ?= "${BOOTFILES_DIR_NAME}/* \
158                 ${@make_dtb_boot_files(d)} \
159                 ${RPI_EXTRA_IMAGE_BOOT_FILES} \
160                 "
161
162EXTRA_IMAGEDEPENDS += "rpi-bootfiles"
163
164do_image_wic[depends] += " \
165    virtual/kernel:do_deploy \
166    rpi-bootfiles:do_deploy \
167    ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
168    "
169
170do_image_wic[recrdeps] = "do_build"
171
172# The kernel image is installed into the FAT32 boot partition and does not need
173# to also be installed into the rootfs.
174RDEPENDS:${KERNEL_PACKAGE_NAME}-base = ""
175