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