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