rpi4-base.inc: KERNEL_DEVICETREE for rpi4 and sota
[AGL/meta-agl.git] / meta-agl-bsp / conf / machine / include / rpi4-base.inc
1 include conf/machine/include/rpi-default-settings.inc
2 include conf/machine/include/rpi-default-versions.inc
3 include conf/machine/include/rpi-default-providers.inc
4
5 SOC_FAMILY = "rpi"
6 include conf/machine/include/soc-family.inc
7
8 IMAGE_FSTYPES ?= "tar.bz2 ext3 rpi-sdimg"
9 WKS_FILE ?= "sdimage-raspberrypi.wks"
10
11 XSERVER = " \
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
17 RPI_KERNEL_DEVICETREE_OVERLAYS ?= " \
18     overlays/at86rf233.dtbo \
19     overlays/dwc2.dtbo \
20     overlays/gpio-key.dtbo \
21     overlays/hifiberry-amp.dtbo \
22     overlays/hifiberry-dac.dtbo \
23     overlays/hifiberry-dacplus.dtbo \
24     overlays/hifiberry-digi.dtbo \
25     overlays/i2c-rtc.dtbo \
26     overlays/iqaudio-dac.dtbo \
27     overlays/iqaudio-dacplus.dtbo \
28     overlays/mcp2515-can0.dtbo \
29     overlays/pi3-disable-bt.dtbo \
30     overlays/pi3-miniuart-bt.dtbo \
31     overlays/pitft22.dtbo \
32     overlays/pitft28-resistive.dtbo \
33     overlays/pitft35-resistive.dtbo \
34     overlays/pps-gpio.dtbo \
35     overlays/rpi-ft5406.dtbo \
36     overlays/rpi-poe.dtbo \
37     overlays/vc4-kms-v3d.dtbo \
38     overlays/vc4-fkms-v3d.dtbo \
39     overlays/w1-gpio-pullup.dtbo \
40     overlays/w1-gpio.dtbo \
41     "
42
43 RPI_KERNEL_DEVICETREE ?= " \
44     bcm2708-rpi-zero-w.dtb \
45     bcm2708-rpi-b.dtb \
46     bcm2708-rpi-b-plus.dtb \
47     bcm2709-rpi-2-b.dtb \
48     bcm2710-rpi-3-b.dtb \
49     bcm2710-rpi-3-b-plus.dtb \
50     bcm2711-rpi-4-b.dtb \
51     bcm2708-rpi-cm.dtb \
52     bcm2710-rpi-cm3.dtb \
53     "
54
55 KERNEL_DEVICETREE ?= " \
56     ${RPI_KERNEL_DEVICETREE} \
57     ${RPI_KERNEL_DEVICETREE_OVERLAYS} \
58     "
59
60 # Different dtb and dtbo files are needed for Raspberry Pi 4
61 # (64-bit) if feature agl-sota is enabled.
62 KERNEL_DEVICETREE_raspberrypi4_sota = " broadcom/bcm2711-rpi-4-b.dtb overlays/vc4-fkms-v3d.dtbo overlays/uart0-rpi4.dtbo"
63
64 # By default:
65 #
66 # * When u-boot is disabled use the "Image" format which can be directly loaded
67 #   by the rpi firmware.
68 #
69 # * When u-boot is enabled use the "uImage" format and the "bootm" command
70 #   within u-boot to load the kernel.
71 KERNEL_BOOTCMD ??= "bootm"
72 KERNEL_IMAGETYPE_UBOOT ??= "uImage"
73 KERNEL_IMAGETYPE_DIRECT ??= "zImage"
74 KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
75         '${KERNEL_IMAGETYPE_UBOOT}', '${KERNEL_IMAGETYPE_DIRECT}', d)}"
76
77 MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio ${@bb.utils.contains('DISABLE_VC4GRAPHICS', '1', '', 'vc4graphics', d)}"
78
79 # Raspberry Pi has no hardware clock
80 MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc"
81
82 MACHINE_EXTRA_RRECOMMENDS += " kernel-modules udev-rules-rpi"
83
84 # Set Raspberrypi splash image
85 SPLASH = "psplash-raspberrypi"
86
87 def make_dtb_boot_files(d):
88     # Generate IMAGE_BOOT_FILES entries for device tree files listed in
89     # KERNEL_DEVICETREE.
90     alldtbs = d.getVar('KERNEL_DEVICETREE')
91     imgtyp = d.getVar('KERNEL_IMAGETYPE')
92
93     def transform(dtb):
94         base = os.path.basename(dtb)
95         if dtb.endswith('dtb'):
96             # eg: whatever/bcm2708-rpi-b.dtb has:
97             #     DEPLOYDIR file: bcm2708-rpi-b.dtb
98             #     destination: bcm2708-rpi-b.dtb
99             return base
100         elif dtb.endswith('dtbo'):
101             # overlay dtb:
102             # eg: overlays/hifiberry-amp.dtbo has:
103             #     DEPLOYDIR file: hifiberry-amp.dtbo
104             #     destination: overlays/hifiberry-amp.dtbo
105             return '{};{}'.format(base, dtb)
106
107     return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])
108
109
110 IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
111                  ${@make_dtb_boot_files(d)} \
112                  ${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
113                     '${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
114                     '${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
115                  "
116 do_image_wic[depends] += " \
117     bcm2835-bootfiles:do_deploy \
118     ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
119     "
120
121 do_image_wic[recrdeps] = "do_build"
122
123 # The kernel image is installed into the FAT32 boot partition and does not need
124 # to also be installed into the rootfs.
125 RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""