Skip to content

Commit 836d83d

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 <gilles.doffe@rtone.fr> Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
1 parent 4c033eb commit 836d83d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

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() {
@@ -328,10 +330,19 @@ do_deploy:append:raspberrypi3-64() {
328330
}
329331

330332
do_deploy:append() {
333+
# Clean comments, empty lines and leading spaces
334+
if [ "${RPI_CONFIG_STRIP}" = "1" ]; then
335+
sed -i '/^#/d' $CONFIG
336+
sed -i '/^$/d' $CONFIG
337+
sed -i 's/^\s*//g' $CONFIG
338+
fi
339+
340+
# Warn about too long lines!
331341
if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then
332342
bbwarn "config.txt contains lines longer than 80 characters, this is not supported"
333343
fi
334344
}
345+
do_deploy[vardeps] += "${RPI_CONFIG_STRIP}"
335346

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

0 commit comments

Comments
 (0)