Skip to content

Commit d4ec644

Browse files
gdoffegportay
authored andcommitted
rpi-config: Add RPI_CONFIG_STRIP to strip down config.txt
The size of the file config.txt is over 52k, and it may grows over the versions of the firmware. Even the deprecated options are maintained. This adds the variable RPI_CONFIG_STRIP to allow the strip down of the file config.txt to the very bare minimal: it removes the leading white spaces, the empty lines and the comments. Signed-off-by: Gilles Doffe <[email protected]> Signed-off-by: Gaël PORTAY <[email protected]>
1 parent bf06560 commit d4ec644

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

recipes-bsp/bootfiles/rpi-config_git.bb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ WM8960 = "${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}"
3737

3838
GPIO_SHUTDOWN_PIN ??= ""
3939

40+
RPI_CONFIG_STRIP ??= "0"
41+
4042
inherit deploy nopackages
4143

4244
do_deploy() {
@@ -338,10 +340,19 @@ do_deploy:append:raspberrypi3-64() {
338340
}
339341

340342
do_deploy:append() {
343+
# Clean comments, empty lines and leading spaces
344+
if [ "${RPI_CONFIG_STRIP}" = "1" ]; then
345+
sed -i '/^#/d' $CONFIG
346+
sed -i '/^$/d' $CONFIG
347+
sed -i 's/^\s*//g' $CONFIG
348+
fi
349+
350+
# Warn about too long lines!
341351
if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then
342352
bbwarn "config.txt contains lines longer than 80 characters, this is not supported"
343353
fi
344354
}
355+
do_deploy[vardeps] += "${RPI_CONFIG_STRIP}"
345356

346357
addtask deploy before do_build after do_install
347358
do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}"

0 commit comments

Comments
 (0)