xref: /openbmc/openbmc/meta-raspberrypi/conf/machine/include/rpi-base.inc (revision 8460358c3d24c71d9d38fd126c745854a6301564)
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    "
84
85RPI_KERNEL_DEVICETREE ?= " \
86    broadcom/bcm2708-rpi-zero.dtb \
87    broadcom/bcm2708-rpi-zero-w.dtb \
88    broadcom/bcm2708-rpi-b.dtb \
89    broadcom/bcm2708-rpi-b-rev1.dtb \
90    broadcom/bcm2708-rpi-b-plus.dtb \
91    broadcom/bcm2709-rpi-2-b.dtb \
92    broadcom/bcm2710-rpi-2-b.dtb \
93    broadcom/bcm2710-rpi-3-b.dtb \
94    broadcom/bcm2710-rpi-3-b-plus.dtb \
95    broadcom/bcm2710-rpi-zero-2.dtb \
96    broadcom/bcm2711-rpi-4-b.dtb \
97    broadcom/bcm2711-rpi-400.dtb \
98    broadcom/bcm2708-rpi-cm.dtb \
99    broadcom/bcm2710-rpi-cm3.dtb \
100    broadcom/bcm2711-rpi-cm4.dtb \
101    broadcom/bcm2711-rpi-cm4s.dtb \
102    "
103
104KERNEL_DEVICETREE ??= " \
105    ${RPI_KERNEL_DEVICETREE} \
106    ${RPI_KERNEL_DEVICETREE_OVERLAYS} \
107    "
108
109# By default:
110#
111# * When u-boot is disabled use the "Image" format which can be directly loaded
112#   by the rpi firmware.
113#
114# * When u-boot is enabled use the "uImage" format and the "bootm" command
115#   within u-boot to load the kernel.
116KERNEL_BOOTCMD ??= "bootm"
117KERNEL_IMAGETYPE_UBOOT ??= "uImage"
118KERNEL_IMAGETYPE_DIRECT ??= "zImage"
119KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
120        '${KERNEL_IMAGETYPE_UBOOT}', '${KERNEL_IMAGETYPE_DIRECT}', d)}"
121
122MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio ${@bb.utils.contains('DISABLE_VC4GRAPHICS', '1', '', 'vc4graphics', d)}"
123
124# Raspberry Pi has no hardware clock
125MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc"
126
127MACHINE_EXTRA_RRECOMMENDS += "kernel-modules udev-rules-rpi"
128MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_I2C', '1', 'kernel-module-i2c-dev kernel-module-i2c-bcm2708', '', d)}"
129MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_IR', '1', 'kernel-module-gpio-ir kernel-module-gpio-ir-tx', '', d)}"
130MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "${@oe.utils.conditional('ENABLE_GPIO_SHUTDOWN', '1', 'gpio-shutdown kernel-module-gpio-keys', '', d)}"
131
132SERIAL_CONSOLES_CHECK ??= "${SERIAL_CONSOLES}"
133
134# The name of the deploy directory for raspberry pi boot files.
135# This variable is referred to by recipes fetching / generating the files.
136BOOTFILES_DIR_NAME ?= "bootfiles"
137
138def make_dtb_boot_files(d):
139    # Generate IMAGE_BOOT_FILES entries for device tree files listed in
140    # KERNEL_DEVICETREE.
141    alldtbs = d.getVar('KERNEL_DEVICETREE')
142
143    # DTBs may be built out of kernel with devicetree.bbclass
144    if not alldtbs:
145        return ''
146
147    def transform(dtb):
148        base = os.path.basename(dtb)
149        if dtb.endswith('dtbo') or base == 'overlay_map.dtb':
150            # overlay dtb:
151            # eg: overlays/hifiberry-amp.dtbo has:
152            #     DEPLOYDIR file: hifiberry-amp.dtbo
153            #     destination: overlays/hifiberry-amp.dtbo
154            return '{};{}'.format(base, dtb)
155        elif dtb.endswith('dtb'):
156            # eg: whatever/bcm2708-rpi-b.dtb has:
157            #     DEPLOYDIR file: bcm2708-rpi-b.dtb
158            #     destination: bcm2708-rpi-b.dtb
159            return base
160
161    return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])
162
163RPI_EXTRA_IMAGE_BOOT_FILES ?= " \
164	${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
165		'${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
166		'${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
167	"
168
169IMAGE_BOOT_FILES ?= "${BOOTFILES_DIR_NAME}/* \
170                 ${@make_dtb_boot_files(d)} \
171                 ${RPI_EXTRA_IMAGE_BOOT_FILES} \
172                 "
173
174EXTRA_IMAGEDEPENDS += "rpi-bootfiles"
175
176do_image_wic[depends] += " \
177    virtual/kernel:do_deploy \
178    rpi-bootfiles:do_deploy \
179    ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
180    "
181
182do_image_wic[recrdeps] = "do_build"
183
184# The kernel image is installed into the FAT32 boot partition and does not need
185# to also be installed into the rootfs.
186RDEPENDS:${KERNEL_PACKAGE_NAME}-base = ""
187