blob: 8b7fbb85aeff62537d72ac5c45d7e61887dfbaff [file] [log] [blame]
Patrick Williams8b8bc412016-08-17 15:02:23 -05001DESCRIPTION = "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."
5LICENSE = "MIT"
Brad Bishopf27bdd52018-05-07 15:42:31 +02006LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
Patrick Williams8b8bc412016-08-17 15:02:23 -05007
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008COMPATIBLE_MACHINE = "^rpi$"
Patrick Williams8b8bc412016-08-17 15:02:23 -05009
10SRCREV = "648ffc470824c43eb0d16c485f4c24816b32cd6f"
Andrew Geissler595f6302022-01-24 19:11:47 +000011SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=https;branch=master \
Patrick Williams8b8bc412016-08-17 15:02:23 -050012 "
13
14S = "${WORKDIR}/git"
15
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -060016PR = "r5"
Patrick Williams8b8bc412016-08-17 15:02:23 -050017
Brad Bishop316dfdd2018-06-25 12:45:53 -040018INHIBIT_DEFAULT_DEPS = "1"
19
Patrick Williams8b8bc412016-08-17 15:02:23 -050020PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
21PITFT22="${@bb.utils.contains("MACHINE_FEATURES", "pitft22", "1", "0", d)}"
22PITFT28r="${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "1", "0", d)}"
Brad Bishop1b9ee292020-01-16 09:06:00 -050023PITFT28c="${@bb.utils.contains("MACHINE_FEATURES", "pitft28c", "1", "0", d)}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050024PITFT35r="${@bb.utils.contains("MACHINE_FEATURES", "pitft35r", "1", "0", d)}"
Patrick Williams8b8bc412016-08-17 15:02:23 -050025
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -060026VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027VC4DTBO ?= "vc4-kms-v3d"
Andrew Geissler4fc9e432020-06-27 00:13:56 -050028GPIO_IR ?= "18"
29GPIO_IR_TX ?= "17"
Brad Bishop316dfdd2018-06-25 12:45:53 -040030
Andrew Geissler9d7e0aa2020-08-21 15:56:44 -050031CAN_OSCILLATOR ?= "16000000"
32
Andrew Geissler595f6302022-01-24 19:11:47 +000033ENABLE_UART ??= ""
34
Andrew Geisslera4353c82021-06-25 14:23:27 -050035WM8960="${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}"
36
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000037GPIO_SHUTDOWN_PIN ??= ""
38
Brad Bishop316dfdd2018-06-25 12:45:53 -040039inherit deploy nopackages
Patrick Williams8b8bc412016-08-17 15:02:23 -050040
41do_deploy() {
Andrew Geissler9d7e0aa2020-08-21 15:56:44 -050042 install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}
Andrew Geissler11105212021-02-12 15:30:38 -060043 CONFIG=${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt
Patrick Williams8b8bc412016-08-17 15:02:23 -050044
Andrew Geissler11105212021-02-12 15:30:38 -060045 cp ${S}/config.txt $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050046
47 if [ -n "${KEY_DECODE_MPG2}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060048 sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050049 fi
50 if [ -n "${KEY_DECODE_WVC1}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060051 sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050052 fi
53 if [ -n "${DISABLE_OVERSCAN}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060054 sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050055 fi
Brad Bishop26bdd442019-08-16 17:08:17 -040056 if [ "${DISABLE_SPLASH}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060057 sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040058 fi
59
60 # Set overclocking options
Patrick Williams8b8bc412016-08-17 15:02:23 -050061 if [ -n "${ARM_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060062 sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040063 fi
64 if [ -n "${GPU_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060065 sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050066 fi
67 if [ -n "${CORE_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060068 sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050069 fi
70 if [ -n "${SDRAM_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060071 sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050072 fi
73 if [ -n "${OVER_VOLTAGE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060074 sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050075 fi
76
77 # GPU memory
78 if [ -n "${GPU_MEM}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060079 sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050080 fi
81 if [ -n "${GPU_MEM_256}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060082 sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050083 fi
84 if [ -n "${GPU_MEM_512}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060085 sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050086 fi
87 if [ -n "${GPU_MEM_1024}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060088 sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040089 fi
90
91 # Set boot delay
92 if [ -n "${BOOT_DELAY}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060093 sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040094 fi
95 if [ -n "${BOOT_DELAY_MS}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060096 sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040097 fi
98
99 # Set HDMI and composite video options
100 if [ -n "${HDMI_FORCE_HOTPLUG}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600101 sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400102 fi
103 if [ -n "${HDMI_DRIVE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600104 sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400105 fi
106 if [ -n "${HDMI_GROUP}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600107 sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400108 fi
109 if [ -n "${HDMI_MODE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600110 sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400111 fi
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500112 if [ -n "${HDMI_CVT}" ]; then
113 echo 'hdmi_cvt=${HDMI_CVT}' >> $CONFIG
114 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -0400115 if [ -n "${CONFIG_HDMI_BOOST}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600116 sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400117 fi
118 if [ -n "${SDTV_MODE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600119 sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400120 fi
121 if [ -n "${SDTV_ASPECT}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600122 sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400123 fi
124 if [ -n "${DISPLAY_ROTATE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600125 sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500126 fi
127
128 # Video camera support
Brad Bishop26bdd442019-08-16 17:08:17 -0400129 if [ "${VIDEO_CAMERA}" = "1" ]; then
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700130 # It has been observed that Raspberry Pi 4B 4GB may fail to enable the
131 # camera if "start_x=1" is at the end of the file. Therefore,
132 # "start_x=1" has been set to replace the original occurrence in
133 # config.txt, which is at the middle of the file.
134 # The exact underlying cause is unknown. There are similar issues
135 # reported in the raspberrypi/firware repo and the conclusion reached
136 # was that there could be a file size limitation affecting certain
137 # variables. It was commented that this limitation could be 4k but
138 # not proved.
Andrew Geissler11105212021-02-12 15:30:38 -0600139 sed -i '/#start_x=/ c\start_x=1' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500140 fi
141
142 # Offline compositing support
Brad Bishop26bdd442019-08-16 17:08:17 -0400143 if [ "${DISPMANX_OFFLINE}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600144 echo "# Enable offline compositing" >>$CONFIG
145 echo "dispmanx_offline=1" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500146 fi
147
148 # SPI bus support
Brad Bishop26bdd442019-08-16 17:08:17 -0400149 if [ "${ENABLE_SPI_BUS}" = "1" ] || [ "${PITFT}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600150 echo "# Enable SPI bus" >>$CONFIG
151 echo "dtparam=spi=on" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500152 fi
153
Brad Bishop316dfdd2018-06-25 12:45:53 -0400154 # I2C support
Brad Bishop26bdd442019-08-16 17:08:17 -0400155 if [ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600156 echo "# Enable I2C" >>$CONFIG
157 echo "dtparam=i2c1=on" >>$CONFIG
158 echo "dtparam=i2c_arm=on" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500159 fi
160
161 # PiTFT22 display support
162 if [ "${PITFT22}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600163 echo "# Enable PITFT22 display" >>$CONFIG
164 echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500165 fi
Patrick Williams8b8bc412016-08-17 15:02:23 -0500166 if [ "${PITFT28r}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600167 echo "# Enable PITFT28r display" >>$CONFIG
168 echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500169 fi
Brad Bishop1b9ee292020-01-16 09:06:00 -0500170 if [ "${PITFT28c}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600171 echo "# Enable PITFT28c display" >>$CONFIG
172 echo "dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG
173 echo "dtoverlay=pitft28-capacitive,touch-swapxy,touch-invx" >>$CONFIG
Brad Bishop1b9ee292020-01-16 09:06:00 -0500174 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500175 if [ "${PITFT35r}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600176 echo "# Enable PITFT35r display" >>$CONFIG
177 echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>$CONFIG
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500178 fi
179
Patrick Williams8b8bc412016-08-17 15:02:23 -0500180 # UART support
Patrick Williamsb542dec2023-06-09 01:26:37 -0500181 if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600182 echo "# Enable UART" >>$CONFIG
Andrew Geissler595f6302022-01-24 19:11:47 +0000183 echo "enable_uart=${ENABLE_UART}" >>$CONFIG
184 elif [ -n "${ENABLE_UART}" ]; then
185 bbfatal "Invalid value for ENABLE_UART [${ENABLE_UART}]. The value for ENABLE_UART can be 0 or 1."
Patrick Williams8b8bc412016-08-17 15:02:23 -0500186 fi
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600187
Patrick Williamsb542dec2023-06-09 01:26:37 -0500188 # U-Boot requires "enable_uart=1" for various boards to operate correctly
189 # cf https://source.denx.de/u-boot/u-boot/-/blob/v2023.04/arch/arm/mach-bcm283x/Kconfig?ref_type=tags#L65
190 if [ "${RPI_USE_U_BOOT}" = "1" ] && [ "${ENABLE_UART}" != "1" ]; then
191 case "${UBOOT_MACHINE}" in
192 rpi_0_w_defconfig|rpi_3_32b_config|rpi_4_32b_config|rpi_arm64_config)
193 if [ "${ENABLE_UART}" = "0" ]; then
194 bbfatal "Invalid configuration: RPI_USE_U_BOOT requires to enable the UART in config.txt for ${MACHINE}"
195 fi
196 echo "# U-Boot requires UART" >>$CONFIG
197 echo "enable_uart=1" >>$CONFIG
198 ;;
199 esac
200 fi
201
Andrew Geissler4fc9e432020-06-27 00:13:56 -0500202 # Infrared support
203 if [ "${ENABLE_IR}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600204 echo "# Enable infrared" >>$CONFIG
205 echo "dtoverlay=gpio-ir,gpio_pin=${GPIO_IR}" >>$CONFIG
206 echo "dtoverlay=gpio-ir-tx,gpio_pin=${GPIO_IR_TX}" >>$CONFIG
Andrew Geissler4fc9e432020-06-27 00:13:56 -0500207 fi
208
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600209 # VC4 Graphics support
210 if [ "${VC4GRAPHICS}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600211 echo "# Enable VC4 Graphics" >> $CONFIG
212 echo "dtoverlay=${VC4DTBO}" >> $CONFIG
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600213 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500214
Andrew Geissler26e4bea2020-11-30 19:54:03 -0600215 # Choose Camera Sensor to be used, default imx219 sensor
216 if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700217 echo "# Enable Sony RaspberryPi Camera(imx219)" >> $CONFIG
Andrew Geissler11105212021-02-12 15:30:38 -0600218 echo "dtoverlay=imx219" >> $CONFIG
Andrew Geissler26e4bea2020-11-30 19:54:03 -0600219 fi
220
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700221 # Choose Camera Sensor to be used, default imx477 sensor
222 #if [ "${RASPBERRYPI_HD_CAMERA}" = "1" ]; then
223 # echo "# Enable Sony RaspberryPi Camera(imx477)" >> $CONFIG
224 # echo "dtoverlay=imx477" >> $CONFIG
225 #fi
226
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500227 # Choose Camera Sensor to be used, default imx708 sensor
228 if [ "${RASPBERRYPI_CAMERA_V3}" = "1" ]; then
229 echo "# Enable Sony RaspberryPi Camera(imx708)" >> $CONFIG
230 echo "dtoverlay=imx708" >> $CONFIG
231 fi
232
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500233 # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm)
234 if [ "${WAVESHARE_1024X600_C_2_1}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600235 echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> $CONFIG
236 echo "max_usb_current=1" >> $CONFIG
237 echo "hdmi_group=2" >> $CONFIG
238 echo "hdmi_mode=87" >> $CONFIG
239 echo "hdmi_cvt 1024 600 60 6 0 0 0" >> $CONFIG
240 echo "hdmi_drive=1" >> $CONFIG
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500241 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -0400242
243 # DWC2 USB peripheral support
Andrew Geissler5199d832021-09-24 16:47:35 -0500244 if ([ "${ENABLE_DWC2_PERIPHERAL}" = "1" ] && [ "${ENABLE_DWC2_OTG}" != "1" ]); then
Andrew Geissler11105212021-02-12 15:30:38 -0600245 echo "# Enable USB peripheral mode" >> $CONFIG
246 echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG
247 fi
248
249 # DWC2 USB host mode support
250 if [ "${ENABLE_DWC2_HOST}" = "1" ]; then
251 echo "# Enable USB host mode" >> $CONFIG
252 echo "dtoverlay=dwc2,dr_mode=host" >> $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400253 fi
Andrew Geissler5199d832021-09-24 16:47:35 -0500254
255 # DWC2 USB OTG support
256 if ([ "${ENABLE_DWC2_OTG}" = "1" ] && [ "${ENABLE_DWC2_PERIPHERAL}" != "1" ]); then
257 echo "# Enable USB OTG mode" >> $CONFIG
258 echo "dtoverlay=dwc2,dr_mode=otg" >> $CONFIG
259 fi
Brad Bishopf27bdd52018-05-07 15:42:31 +0200260
261 # AT86RF23X support
262 if [ "${ENABLE_AT86RF}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600263 echo "# Enable AT86RF23X" >>$CONFIG
264 echo "dtoverlay=at86rf233,speed=3000000" >>$CONFIG
Brad Bishopf27bdd52018-05-07 15:42:31 +0200265 fi
266
Andrew Geissler5d59ec72020-07-24 16:09:26 -0500267 # ENABLE DUAL CAN
268 if [ "${ENABLE_DUAL_CAN}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600269 echo "# Enable DUAL CAN" >>$CONFIG
270 echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
271 echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>$CONFIG
Brad Bishop19323692019-04-05 15:28:33 -0400272 # ENABLE CAN
Andrew Geissler5d59ec72020-07-24 16:09:26 -0500273 elif [ "${ENABLE_CAN}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600274 echo "# Enable CAN" >>$CONFIG
275 echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
Brad Bishop19323692019-04-05 15:28:33 -0400276 fi
277
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000278
279 if [ "${ENABLE_GPIO_SHUTDOWN}" = "1" ]; then
280 if ([ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]) && [ -z "${GPIO_SHUTDOWN_PIN}" ]; then
281 # By default GPIO shutdown uses the same pin as the (master) I2C SCL.
282 # If I2C is configured and an alternative pin is not configured for
283 # gpio-shutdown, there is a configuration conflict.
284 bbfatal "I2C and gpio-shutdown are both enabled and using the same pins!"
285 fi
286 echo "# Enable gpio-shutdown" >> $CONFIG
287 if [ -z "${GPIO_SHUTDOWN_PIN}" ]; then
288 echo "dtoverlay=gpio-shutdown" >> $CONFIG
289 else
290 echo "dtoverlay=gpio-shutdown,gpio_pin=${GPIO_SHUTDOWN_PIN}" >> $CONFIG
291 fi
292 fi
293
Brad Bishop316dfdd2018-06-25 12:45:53 -0400294 # Append extra config if the user has provided any
Andrew Geissler11105212021-02-12 15:30:38 -0600295 printf "${RPI_EXTRA_CONFIG}\n" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400296
297 # Handle setup with armstub file
298 if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600299 echo "\n# ARM stub configuration" >> $CONFIG
300 echo "armstub=${ARMSTUB}" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400301 case "${ARMSTUB}" in
302 *-gic.bin)
Andrew Geissler11105212021-02-12 15:30:38 -0600303 echo "enable_gic=1" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400304 ;;
305 esac
306 fi
Andrew Geisslera4353c82021-06-25 14:23:27 -0500307
308 # WM8960 support
309 if [ "${WM8960}" = "1" ]; then
310 echo "# Enable WM8960" >> $CONFIG
311 echo "dtoverlay=wm8960-soundcard" >> $CONFIG
312 fi
Andrew Geisslerd5838332022-05-27 11:33:10 -0500313
314 # W1-GPIO - One-Wire Interface
315 if [ "${ENABLE_W1}" = "1" ]; then
316 echo "# Enable One-Wire Interface" >> $CONFIG
317 echo "dtoverlay=w1-gpio" >> $CONFIG
318 fi
Patrick Williams8b8bc412016-08-17 15:02:23 -0500319}
320
Patrick Williams213cb262021-08-07 19:21:33 -0500321do_deploy:append:raspberrypi3-64() {
Andrew Geissler11105212021-02-12 15:30:38 -0600322 echo "# have a properly sized image" >> $CONFIG
323 echo "disable_overscan=1" >> $CONFIG
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500324
Andrew Geissler11105212021-02-12 15:30:38 -0600325 echo "# Enable audio (loads snd_bcm2835)" >> $CONFIG
326 echo "dtparam=audio=on" >> $CONFIG
Brad Bishop3a5fbf52017-12-04 02:17:07 -0500327}
328
Andrew Geisslereff27472021-10-29 15:35:00 -0500329do_deploy:append() {
330 if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then
331 bbwarn "config.txt contains lines longer than 80 characters, this is not supported"
332 fi
333}
334
Brad Bishop316dfdd2018-06-25 12:45:53 -0400335addtask deploy before do_build after do_install
Andrew Geissler9d7e0aa2020-08-21 15:56:44 -0500336do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}"
Patrick Williams8b8bc412016-08-17 15:02:23 -0500337
338PACKAGE_ARCH = "${MACHINE_ARCH}"