blob: e84456c7ad5668a26c8a37ee3cc89cfac2d8dcd9 [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"
11SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=git;branch=master \
12 "
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 Geisslera4353c82021-06-25 14:23:27 -050033WM8960="${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}"
34
Brad Bishop316dfdd2018-06-25 12:45:53 -040035inherit deploy nopackages
Patrick Williams8b8bc412016-08-17 15:02:23 -050036
37do_deploy() {
Andrew Geissler9d7e0aa2020-08-21 15:56:44 -050038 install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}
Andrew Geissler11105212021-02-12 15:30:38 -060039 CONFIG=${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt
Patrick Williams8b8bc412016-08-17 15:02:23 -050040
Andrew Geissler11105212021-02-12 15:30:38 -060041 cp ${S}/config.txt $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050042
43 if [ -n "${KEY_DECODE_MPG2}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060044 sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050045 fi
46 if [ -n "${KEY_DECODE_WVC1}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060047 sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050048 fi
49 if [ -n "${DISABLE_OVERSCAN}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060050 sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050051 fi
Brad Bishop26bdd442019-08-16 17:08:17 -040052 if [ "${DISABLE_SPLASH}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060053 sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040054 fi
55
56 # Set overclocking options
Patrick Williams8b8bc412016-08-17 15:02:23 -050057 if [ -n "${ARM_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060058 sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040059 fi
60 if [ -n "${GPU_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060061 sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050062 fi
63 if [ -n "${CORE_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060064 sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050065 fi
66 if [ -n "${SDRAM_FREQ}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060067 sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050068 fi
69 if [ -n "${OVER_VOLTAGE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060070 sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050071 fi
72
73 # GPU memory
74 if [ -n "${GPU_MEM}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060075 sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050076 fi
77 if [ -n "${GPU_MEM_256}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060078 sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050079 fi
80 if [ -n "${GPU_MEM_512}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060081 sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -050082 fi
83 if [ -n "${GPU_MEM_1024}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060084 sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040085 fi
86
87 # Set boot delay
88 if [ -n "${BOOT_DELAY}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060089 sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040090 fi
91 if [ -n "${BOOT_DELAY_MS}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060092 sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040093 fi
94
95 # Set HDMI and composite video options
96 if [ -n "${HDMI_FORCE_HOTPLUG}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -060097 sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -040098 fi
99 if [ -n "${HDMI_DRIVE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600100 sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400101 fi
102 if [ -n "${HDMI_GROUP}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600103 sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400104 fi
105 if [ -n "${HDMI_MODE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600106 sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400107 fi
108 if [ -n "${CONFIG_HDMI_BOOST}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600109 sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400110 fi
111 if [ -n "${SDTV_MODE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600112 sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400113 fi
114 if [ -n "${SDTV_ASPECT}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600115 sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400116 fi
117 if [ -n "${DISPLAY_ROTATE}" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600118 sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500119 fi
120
121 # Video camera support
Brad Bishop26bdd442019-08-16 17:08:17 -0400122 if [ "${VIDEO_CAMERA}" = "1" ]; then
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700123 # It has been observed that Raspberry Pi 4B 4GB may fail to enable the
124 # camera if "start_x=1" is at the end of the file. Therefore,
125 # "start_x=1" has been set to replace the original occurrence in
126 # config.txt, which is at the middle of the file.
127 # The exact underlying cause is unknown. There are similar issues
128 # reported in the raspberrypi/firware repo and the conclusion reached
129 # was that there could be a file size limitation affecting certain
130 # variables. It was commented that this limitation could be 4k but
131 # not proved.
Andrew Geissler11105212021-02-12 15:30:38 -0600132 sed -i '/#start_x=/ c\start_x=1' $CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500133 fi
134
135 # Offline compositing support
Brad Bishop26bdd442019-08-16 17:08:17 -0400136 if [ "${DISPMANX_OFFLINE}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600137 echo "# Enable offline compositing" >>$CONFIG
138 echo "dispmanx_offline=1" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500139 fi
140
141 # SPI bus support
Brad Bishop26bdd442019-08-16 17:08:17 -0400142 if [ "${ENABLE_SPI_BUS}" = "1" ] || [ "${PITFT}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600143 echo "# Enable SPI bus" >>$CONFIG
144 echo "dtparam=spi=on" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500145 fi
146
Brad Bishop316dfdd2018-06-25 12:45:53 -0400147 # I2C support
Brad Bishop26bdd442019-08-16 17:08:17 -0400148 if [ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600149 echo "# Enable I2C" >>$CONFIG
150 echo "dtparam=i2c1=on" >>$CONFIG
151 echo "dtparam=i2c_arm=on" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500152 fi
153
154 # PiTFT22 display support
155 if [ "${PITFT22}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600156 echo "# Enable PITFT22 display" >>$CONFIG
157 echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500158 fi
Patrick Williams8b8bc412016-08-17 15:02:23 -0500159 if [ "${PITFT28r}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600160 echo "# Enable PITFT28r display" >>$CONFIG
161 echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500162 fi
Brad Bishop1b9ee292020-01-16 09:06:00 -0500163 if [ "${PITFT28c}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600164 echo "# Enable PITFT28c display" >>$CONFIG
165 echo "dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG
166 echo "dtoverlay=pitft28-capacitive,touch-swapxy,touch-invx" >>$CONFIG
Brad Bishop1b9ee292020-01-16 09:06:00 -0500167 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500168 if [ "${PITFT35r}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600169 echo "# Enable PITFT35r display" >>$CONFIG
170 echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>$CONFIG
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500171 fi
172
Patrick Williams8b8bc412016-08-17 15:02:23 -0500173 # UART support
174 if [ "${ENABLE_UART}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600175 echo "# Enable UART" >>$CONFIG
176 echo "enable_uart=1" >>$CONFIG
Patrick Williams8b8bc412016-08-17 15:02:23 -0500177 fi
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600178
Andrew Geissler4fc9e432020-06-27 00:13:56 -0500179 # Infrared support
180 if [ "${ENABLE_IR}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600181 echo "# Enable infrared" >>$CONFIG
182 echo "dtoverlay=gpio-ir,gpio_pin=${GPIO_IR}" >>$CONFIG
183 echo "dtoverlay=gpio-ir-tx,gpio_pin=${GPIO_IR_TX}" >>$CONFIG
Andrew Geissler4fc9e432020-06-27 00:13:56 -0500184 fi
185
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600186 # VC4 Graphics support
187 if [ "${VC4GRAPHICS}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600188 echo "# Enable VC4 Graphics" >> $CONFIG
189 echo "dtoverlay=${VC4DTBO}" >> $CONFIG
Patrick Williamsb2e6a9b2017-02-23 20:31:26 -0600190 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500191
Andrew Geissler26e4bea2020-11-30 19:54:03 -0600192 # Choose Camera Sensor to be used, default imx219 sensor
193 if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700194 echo "# Enable Sony RaspberryPi Camera(imx219)" >> $CONFIG
Andrew Geissler11105212021-02-12 15:30:38 -0600195 echo "dtoverlay=imx219" >> $CONFIG
Andrew Geissler26e4bea2020-11-30 19:54:03 -0600196 fi
197
William A. Kennington IIIa99e9b62021-06-02 12:47:56 -0700198 # Choose Camera Sensor to be used, default imx477 sensor
199 #if [ "${RASPBERRYPI_HD_CAMERA}" = "1" ]; then
200 # echo "# Enable Sony RaspberryPi Camera(imx477)" >> $CONFIG
201 # echo "dtoverlay=imx477" >> $CONFIG
202 #fi
203
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500204 # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm)
205 if [ "${WAVESHARE_1024X600_C_2_1}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600206 echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> $CONFIG
207 echo "max_usb_current=1" >> $CONFIG
208 echo "hdmi_group=2" >> $CONFIG
209 echo "hdmi_mode=87" >> $CONFIG
210 echo "hdmi_cvt 1024 600 60 6 0 0 0" >> $CONFIG
211 echo "hdmi_drive=1" >> $CONFIG
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500212 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -0400213
214 # DWC2 USB peripheral support
215 if [ "${ENABLE_DWC2_PERIPHERAL}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600216 echo "# Enable USB peripheral mode" >> $CONFIG
217 echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG
218 fi
219
220 # DWC2 USB host mode support
221 if [ "${ENABLE_DWC2_HOST}" = "1" ]; then
222 echo "# Enable USB host mode" >> $CONFIG
223 echo "dtoverlay=dwc2,dr_mode=host" >> $CONFIG
Brad Bishop316dfdd2018-06-25 12:45:53 -0400224 fi
Brad Bishopf27bdd52018-05-07 15:42:31 +0200225
226 # AT86RF23X support
227 if [ "${ENABLE_AT86RF}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600228 echo "# Enable AT86RF23X" >>$CONFIG
229 echo "dtoverlay=at86rf233,speed=3000000" >>$CONFIG
Brad Bishopf27bdd52018-05-07 15:42:31 +0200230 fi
231
Andrew Geissler5d59ec72020-07-24 16:09:26 -0500232 # ENABLE DUAL CAN
233 if [ "${ENABLE_DUAL_CAN}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600234 echo "# Enable DUAL CAN" >>$CONFIG
235 echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
236 echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>$CONFIG
Brad Bishop19323692019-04-05 15:28:33 -0400237 # ENABLE CAN
Andrew Geissler5d59ec72020-07-24 16:09:26 -0500238 elif [ "${ENABLE_CAN}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600239 echo "# Enable CAN" >>$CONFIG
240 echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG
Brad Bishop19323692019-04-05 15:28:33 -0400241 fi
242
Brad Bishop316dfdd2018-06-25 12:45:53 -0400243 # Append extra config if the user has provided any
Andrew Geissler11105212021-02-12 15:30:38 -0600244 printf "${RPI_EXTRA_CONFIG}\n" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400245
246 # Handle setup with armstub file
247 if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then
Andrew Geissler11105212021-02-12 15:30:38 -0600248 echo "\n# ARM stub configuration" >> $CONFIG
249 echo "armstub=${ARMSTUB}" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400250 case "${ARMSTUB}" in
251 *-gic.bin)
Andrew Geissler11105212021-02-12 15:30:38 -0600252 echo "enable_gic=1" >> $CONFIG
Brad Bishop26bdd442019-08-16 17:08:17 -0400253 ;;
254 esac
255 fi
Andrew Geisslera4353c82021-06-25 14:23:27 -0500256
257 # WM8960 support
258 if [ "${WM8960}" = "1" ]; then
259 echo "# Enable WM8960" >> $CONFIG
260 echo "dtoverlay=wm8960-soundcard" >> $CONFIG
261 fi
Patrick Williams8b8bc412016-08-17 15:02:23 -0500262}
263
Brad Bishop3a5fbf52017-12-04 02:17:07 -0500264do_deploy_append_raspberrypi3-64() {
Andrew Geissler11105212021-02-12 15:30:38 -0600265 echo "# have a properly sized image" >> $CONFIG
266 echo "disable_overscan=1" >> $CONFIG
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500267
Andrew Geissler11105212021-02-12 15:30:38 -0600268 echo "# Enable audio (loads snd_bcm2835)" >> $CONFIG
269 echo "dtparam=audio=on" >> $CONFIG
Brad Bishop3a5fbf52017-12-04 02:17:07 -0500270}
271
Brad Bishop316dfdd2018-06-25 12:45:53 -0400272addtask deploy before do_build after do_install
Andrew Geissler9d7e0aa2020-08-21 15:56:44 -0500273do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}"
Patrick Williams8b8bc412016-08-17 15:02:23 -0500274
275PACKAGE_ARCH = "${MACHINE_ARCH}"