Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 1 | DESCRIPTION = "Commented config.txt file for the Raspberry Pi. \ |
| 2 | The Raspberry Pi config.txt file is read by the GPU before \ |
| 3 | the ARM core is initialised. It can be used to set various \ |
| 4 | system configuration parameters." |
| 5 | LICENSE = "MIT" |
Brad Bishop | f27bdd5 | 2018-05-07 15:42:31 +0200 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 7 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 8 | COMPATIBLE_MACHINE = "^rpi$" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 9 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 10 | SRCREV = "6ac2d832c6c3b208e2669f50ec1abf2c20cb7ff4" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 11 | SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=https;branch=master \ |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 12 | file://0001-config.txt-reintroduce-start_x.patch \ |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 13 | " |
| 14 | |
| 15 | S = "${WORKDIR}/git" |
| 16 | |
Patrick Williams | b2e6a9b | 2017-02-23 20:31:26 -0600 | [diff] [blame] | 17 | PR = "r5" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 18 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 19 | INHIBIT_DEFAULT_DEPS = "1" |
| 20 | |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 21 | PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" |
| 22 | PITFT22="${@bb.utils.contains("MACHINE_FEATURES", "pitft22", "1", "0", d)}" |
| 23 | PITFT28r="${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "1", "0", d)}" |
Brad Bishop | 1b9ee29 | 2020-01-16 09:06:00 -0500 | [diff] [blame] | 24 | PITFT28c="${@bb.utils.contains("MACHINE_FEATURES", "pitft28c", "1", "0", d)}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | PITFT35r="${@bb.utils.contains("MACHINE_FEATURES", "pitft35r", "1", "0", d)}" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 26 | |
Patrick Williams | b2e6a9b | 2017-02-23 20:31:26 -0600 | [diff] [blame] | 27 | VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | VC4DTBO ?= "vc4-kms-v3d" |
Andrew Geissler | 4fc9e43 | 2020-06-27 00:13:56 -0500 | [diff] [blame] | 29 | GPIO_IR ?= "18" |
| 30 | GPIO_IR_TX ?= "17" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 31 | |
Andrew Geissler | 9d7e0aa | 2020-08-21 15:56:44 -0500 | [diff] [blame] | 32 | CAN_OSCILLATOR ?= "16000000" |
Patrick Williams | f52e3dd | 2024-01-26 13:04:43 -0600 | [diff] [blame] | 33 | CAN0_INTERRUPT_PIN ?= "25" |
| 34 | CAN1_INTERRUPT_PIN ?= "24" |
Andrew Geissler | 9d7e0aa | 2020-08-21 15:56:44 -0500 | [diff] [blame] | 35 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 36 | ENABLE_UART ??= "" |
| 37 | |
Andrew Geissler | a4353c8 | 2021-06-25 14:23:27 -0500 | [diff] [blame] | 38 | WM8960="${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}" |
| 39 | |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 40 | GPIO_SHUTDOWN_PIN ??= "" |
| 41 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 42 | inherit deploy nopackages |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 43 | |
| 44 | do_deploy() { |
Andrew Geissler | 9d7e0aa | 2020-08-21 15:56:44 -0500 | [diff] [blame] | 45 | install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 46 | CONFIG=${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 47 | |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 48 | cp ${S}/config.txt $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 49 | |
| 50 | if [ -n "${KEY_DECODE_MPG2}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 51 | sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 52 | fi |
| 53 | if [ -n "${KEY_DECODE_WVC1}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 54 | sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 55 | fi |
| 56 | if [ -n "${DISABLE_OVERSCAN}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 57 | sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 58 | fi |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 59 | if [ "${DISABLE_SPLASH}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 60 | sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 61 | fi |
| 62 | |
| 63 | # Set overclocking options |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 64 | if [ -n "${ARM_FREQ}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 65 | sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 66 | fi |
| 67 | if [ -n "${GPU_FREQ}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 68 | sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 69 | fi |
| 70 | if [ -n "${CORE_FREQ}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 71 | sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 72 | fi |
| 73 | if [ -n "${SDRAM_FREQ}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 74 | sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 75 | fi |
| 76 | if [ -n "${OVER_VOLTAGE}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 77 | sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 78 | fi |
| 79 | |
| 80 | # GPU memory |
| 81 | if [ -n "${GPU_MEM}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 82 | sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 83 | fi |
| 84 | if [ -n "${GPU_MEM_256}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 85 | sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 86 | fi |
| 87 | if [ -n "${GPU_MEM_512}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 88 | sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 89 | fi |
| 90 | if [ -n "${GPU_MEM_1024}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 91 | sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 92 | fi |
| 93 | |
| 94 | # Set boot delay |
| 95 | if [ -n "${BOOT_DELAY}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 96 | sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 97 | fi |
| 98 | if [ -n "${BOOT_DELAY_MS}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 99 | sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 100 | fi |
| 101 | |
| 102 | # Set HDMI and composite video options |
| 103 | if [ -n "${HDMI_FORCE_HOTPLUG}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 104 | sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 105 | fi |
| 106 | if [ -n "${HDMI_DRIVE}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 107 | sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 108 | fi |
| 109 | if [ -n "${HDMI_GROUP}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 110 | sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 111 | fi |
| 112 | if [ -n "${HDMI_MODE}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 113 | sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 114 | fi |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 115 | if [ -n "${HDMI_CVT}" ]; then |
| 116 | echo 'hdmi_cvt=${HDMI_CVT}' >> $CONFIG |
| 117 | fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 118 | if [ -n "${CONFIG_HDMI_BOOST}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 119 | sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 120 | fi |
| 121 | if [ -n "${SDTV_MODE}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 122 | sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 123 | fi |
| 124 | if [ -n "${SDTV_ASPECT}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 125 | sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 126 | fi |
| 127 | if [ -n "${DISPLAY_ROTATE}" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 128 | sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 129 | fi |
| 130 | |
| 131 | # Video camera support |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 132 | if [ "${VIDEO_CAMERA}" = "1" ]; then |
William A. Kennington III | a99e9b6 | 2021-06-02 12:47:56 -0700 | [diff] [blame] | 133 | # It has been observed that Raspberry Pi 4B 4GB may fail to enable the |
| 134 | # camera if "start_x=1" is at the end of the file. Therefore, |
| 135 | # "start_x=1" has been set to replace the original occurrence in |
| 136 | # config.txt, which is at the middle of the file. |
| 137 | # The exact underlying cause is unknown. There are similar issues |
| 138 | # reported in the raspberrypi/firware repo and the conclusion reached |
| 139 | # was that there could be a file size limitation affecting certain |
| 140 | # variables. It was commented that this limitation could be 4k but |
| 141 | # not proved. |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 142 | sed -i '/#start_x=/ c\start_x=1' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 143 | fi |
| 144 | |
| 145 | # Offline compositing support |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 146 | if [ "${DISPMANX_OFFLINE}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 147 | echo "# Enable offline compositing" >>$CONFIG |
| 148 | echo "dispmanx_offline=1" >>$CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 149 | fi |
| 150 | |
| 151 | # SPI bus support |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 152 | if [ "${ENABLE_SPI_BUS}" = "1" ] || [ "${PITFT}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 153 | echo "# Enable SPI bus" >>$CONFIG |
| 154 | echo "dtparam=spi=on" >>$CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 155 | fi |
| 156 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 157 | # I2C support |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 158 | if [ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 159 | echo "# Enable I2C" >>$CONFIG |
| 160 | echo "dtparam=i2c1=on" >>$CONFIG |
| 161 | echo "dtparam=i2c_arm=on" >>$CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 162 | fi |
| 163 | |
| 164 | # PiTFT22 display support |
| 165 | if [ "${PITFT22}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 166 | echo "# Enable PITFT22 display" >>$CONFIG |
| 167 | echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>$CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 168 | fi |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 169 | if [ "${PITFT28r}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 170 | echo "# Enable PITFT28r display" >>$CONFIG |
| 171 | echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 172 | fi |
Brad Bishop | 1b9ee29 | 2020-01-16 09:06:00 -0500 | [diff] [blame] | 173 | if [ "${PITFT28c}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 174 | echo "# Enable PITFT28c display" >>$CONFIG |
| 175 | echo "dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG |
| 176 | echo "dtoverlay=pitft28-capacitive,touch-swapxy,touch-invx" >>$CONFIG |
Brad Bishop | 1b9ee29 | 2020-01-16 09:06:00 -0500 | [diff] [blame] | 177 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 178 | if [ "${PITFT35r}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 179 | echo "# Enable PITFT35r display" >>$CONFIG |
| 180 | echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>$CONFIG |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 181 | fi |
| 182 | |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 183 | # UART support |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 184 | if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 185 | echo "# Enable UART" >>$CONFIG |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 186 | echo "enable_uart=${ENABLE_UART}" >>$CONFIG |
| 187 | elif [ -n "${ENABLE_UART}" ]; then |
| 188 | bbfatal "Invalid value for ENABLE_UART [${ENABLE_UART}]. The value for ENABLE_UART can be 0 or 1." |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 189 | fi |
Patrick Williams | b2e6a9b | 2017-02-23 20:31:26 -0600 | [diff] [blame] | 190 | |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 191 | # U-Boot requires "enable_uart=1" for various boards to operate correctly |
| 192 | # cf https://source.denx.de/u-boot/u-boot/-/blob/v2023.04/arch/arm/mach-bcm283x/Kconfig?ref_type=tags#L65 |
| 193 | if [ "${RPI_USE_U_BOOT}" = "1" ] && [ "${ENABLE_UART}" != "1" ]; then |
| 194 | case "${UBOOT_MACHINE}" in |
| 195 | rpi_0_w_defconfig|rpi_3_32b_config|rpi_4_32b_config|rpi_arm64_config) |
| 196 | if [ "${ENABLE_UART}" = "0" ]; then |
| 197 | bbfatal "Invalid configuration: RPI_USE_U_BOOT requires to enable the UART in config.txt for ${MACHINE}" |
| 198 | fi |
| 199 | echo "# U-Boot requires UART" >>$CONFIG |
| 200 | echo "enable_uart=1" >>$CONFIG |
| 201 | ;; |
| 202 | esac |
| 203 | fi |
| 204 | |
Andrew Geissler | 4fc9e43 | 2020-06-27 00:13:56 -0500 | [diff] [blame] | 205 | # Infrared support |
| 206 | if [ "${ENABLE_IR}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 207 | echo "# Enable infrared" >>$CONFIG |
| 208 | echo "dtoverlay=gpio-ir,gpio_pin=${GPIO_IR}" >>$CONFIG |
| 209 | echo "dtoverlay=gpio-ir-tx,gpio_pin=${GPIO_IR_TX}" >>$CONFIG |
Andrew Geissler | 4fc9e43 | 2020-06-27 00:13:56 -0500 | [diff] [blame] | 210 | fi |
| 211 | |
Patrick Williams | b2e6a9b | 2017-02-23 20:31:26 -0600 | [diff] [blame] | 212 | # VC4 Graphics support |
| 213 | if [ "${VC4GRAPHICS}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 214 | echo "# Enable VC4 Graphics" >> $CONFIG |
| 215 | echo "dtoverlay=${VC4DTBO}" >> $CONFIG |
Patrick Williams | b2e6a9b | 2017-02-23 20:31:26 -0600 | [diff] [blame] | 216 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 217 | |
Andrew Geissler | 26e4bea | 2020-11-30 19:54:03 -0600 | [diff] [blame] | 218 | # Choose Camera Sensor to be used, default imx219 sensor |
| 219 | if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then |
William A. Kennington III | a99e9b6 | 2021-06-02 12:47:56 -0700 | [diff] [blame] | 220 | echo "# Enable Sony RaspberryPi Camera(imx219)" >> $CONFIG |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 221 | echo "dtoverlay=imx219" >> $CONFIG |
Andrew Geissler | 26e4bea | 2020-11-30 19:54:03 -0600 | [diff] [blame] | 222 | fi |
| 223 | |
William A. Kennington III | a99e9b6 | 2021-06-02 12:47:56 -0700 | [diff] [blame] | 224 | # Choose Camera Sensor to be used, default imx477 sensor |
| 225 | #if [ "${RASPBERRYPI_HD_CAMERA}" = "1" ]; then |
| 226 | # echo "# Enable Sony RaspberryPi Camera(imx477)" >> $CONFIG |
| 227 | # echo "dtoverlay=imx477" >> $CONFIG |
| 228 | #fi |
| 229 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 230 | # Choose Camera Sensor to be used, default imx708 sensor |
| 231 | if [ "${RASPBERRYPI_CAMERA_V3}" = "1" ]; then |
| 232 | echo "# Enable Sony RaspberryPi Camera(imx708)" >> $CONFIG |
| 233 | echo "dtoverlay=imx708" >> $CONFIG |
| 234 | fi |
| 235 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 236 | # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm) |
| 237 | if [ "${WAVESHARE_1024X600_C_2_1}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 238 | echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> $CONFIG |
| 239 | echo "max_usb_current=1" >> $CONFIG |
| 240 | echo "hdmi_group=2" >> $CONFIG |
| 241 | echo "hdmi_mode=87" >> $CONFIG |
| 242 | echo "hdmi_cvt 1024 600 60 6 0 0 0" >> $CONFIG |
| 243 | echo "hdmi_drive=1" >> $CONFIG |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 244 | fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 245 | |
| 246 | # DWC2 USB peripheral support |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 247 | if ([ "${ENABLE_DWC2_PERIPHERAL}" = "1" ] && [ "${ENABLE_DWC2_OTG}" != "1" ]); then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 248 | echo "# Enable USB peripheral mode" >> $CONFIG |
| 249 | echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG |
| 250 | fi |
| 251 | |
| 252 | # DWC2 USB host mode support |
| 253 | if [ "${ENABLE_DWC2_HOST}" = "1" ]; then |
| 254 | echo "# Enable USB host mode" >> $CONFIG |
| 255 | echo "dtoverlay=dwc2,dr_mode=host" >> $CONFIG |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 256 | fi |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 257 | |
| 258 | # DWC2 USB OTG support |
| 259 | if ([ "${ENABLE_DWC2_OTG}" = "1" ] && [ "${ENABLE_DWC2_PERIPHERAL}" != "1" ]); then |
| 260 | echo "# Enable USB OTG mode" >> $CONFIG |
| 261 | echo "dtoverlay=dwc2,dr_mode=otg" >> $CONFIG |
| 262 | fi |
Brad Bishop | f27bdd5 | 2018-05-07 15:42:31 +0200 | [diff] [blame] | 263 | |
| 264 | # AT86RF23X support |
| 265 | if [ "${ENABLE_AT86RF}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 266 | echo "# Enable AT86RF23X" >>$CONFIG |
| 267 | echo "dtoverlay=at86rf233,speed=3000000" >>$CONFIG |
Brad Bishop | f27bdd5 | 2018-05-07 15:42:31 +0200 | [diff] [blame] | 268 | fi |
| 269 | |
Andrew Geissler | 5d59ec7 | 2020-07-24 16:09:26 -0500 | [diff] [blame] | 270 | # ENABLE DUAL CAN |
| 271 | if [ "${ENABLE_DUAL_CAN}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 272 | echo "# Enable DUAL CAN" >>$CONFIG |
Patrick Williams | f52e3dd | 2024-01-26 13:04:43 -0600 | [diff] [blame] | 273 | echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG |
| 274 | echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=${CAN1_INTERRUPT_PIN}" >>$CONFIG |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 275 | # ENABLE CAN |
Andrew Geissler | 5d59ec7 | 2020-07-24 16:09:26 -0500 | [diff] [blame] | 276 | elif [ "${ENABLE_CAN}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 277 | echo "# Enable CAN" >>$CONFIG |
Patrick Williams | f52e3dd | 2024-01-26 13:04:43 -0600 | [diff] [blame] | 278 | echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 279 | fi |
| 280 | |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 281 | |
| 282 | if [ "${ENABLE_GPIO_SHUTDOWN}" = "1" ]; then |
| 283 | if ([ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]) && [ -z "${GPIO_SHUTDOWN_PIN}" ]; then |
| 284 | # By default GPIO shutdown uses the same pin as the (master) I2C SCL. |
| 285 | # If I2C is configured and an alternative pin is not configured for |
| 286 | # gpio-shutdown, there is a configuration conflict. |
| 287 | bbfatal "I2C and gpio-shutdown are both enabled and using the same pins!" |
| 288 | fi |
| 289 | echo "# Enable gpio-shutdown" >> $CONFIG |
| 290 | if [ -z "${GPIO_SHUTDOWN_PIN}" ]; then |
| 291 | echo "dtoverlay=gpio-shutdown" >> $CONFIG |
| 292 | else |
| 293 | echo "dtoverlay=gpio-shutdown,gpio_pin=${GPIO_SHUTDOWN_PIN}" >> $CONFIG |
| 294 | fi |
| 295 | fi |
| 296 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 297 | # Append extra config if the user has provided any |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 298 | printf "${RPI_EXTRA_CONFIG}\n" >> $CONFIG |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 299 | |
| 300 | # Handle setup with armstub file |
| 301 | if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 302 | echo "\n# ARM stub configuration" >> $CONFIG |
| 303 | echo "armstub=${ARMSTUB}" >> $CONFIG |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 304 | case "${ARMSTUB}" in |
| 305 | *-gic.bin) |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 306 | echo "enable_gic=1" >> $CONFIG |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 307 | ;; |
| 308 | esac |
| 309 | fi |
Andrew Geissler | a4353c8 | 2021-06-25 14:23:27 -0500 | [diff] [blame] | 310 | |
| 311 | # WM8960 support |
| 312 | if [ "${WM8960}" = "1" ]; then |
| 313 | echo "# Enable WM8960" >> $CONFIG |
| 314 | echo "dtoverlay=wm8960-soundcard" >> $CONFIG |
| 315 | fi |
Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 316 | |
| 317 | # W1-GPIO - One-Wire Interface |
| 318 | if [ "${ENABLE_W1}" = "1" ]; then |
| 319 | echo "# Enable One-Wire Interface" >> $CONFIG |
| 320 | echo "dtoverlay=w1-gpio" >> $CONFIG |
| 321 | fi |
Patrick Williams | f52e3dd | 2024-01-26 13:04:43 -0600 | [diff] [blame] | 322 | |
| 323 | # Reduce config.txt file size to avoid corruption and |
| 324 | # to boot successfully Raspberry Pi 5. The issue has |
| 325 | # been reported to related projects: |
| 326 | # https://github.com/raspberrypi/firmware/issues/1848 |
| 327 | # https://github.com/Evilpaul/RPi-config/issues/9 |
| 328 | sed -i '/^##/d' $CONFIG |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 329 | } |
| 330 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 331 | do_deploy:append:raspberrypi3-64() { |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 332 | echo "# have a properly sized image" >> $CONFIG |
| 333 | echo "disable_overscan=1" >> $CONFIG |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 334 | |
Andrew Geissler | 1110521 | 2021-02-12 15:30:38 -0600 | [diff] [blame] | 335 | echo "# Enable audio (loads snd_bcm2835)" >> $CONFIG |
| 336 | echo "dtparam=audio=on" >> $CONFIG |
Brad Bishop | 3a5fbf5 | 2017-12-04 02:17:07 -0500 | [diff] [blame] | 337 | } |
| 338 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 339 | do_deploy:append() { |
| 340 | if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then |
| 341 | bbwarn "config.txt contains lines longer than 80 characters, this is not supported" |
| 342 | fi |
| 343 | } |
| 344 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 345 | addtask deploy before do_build after do_install |
Andrew Geissler | 9d7e0aa | 2020-08-21 15:56:44 -0500 | [diff] [blame] | 346 | do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 347 | |
| 348 | PACKAGE_ARCH = "${MACHINE_ARCH}" |