Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpi config add rpi config strip #1255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions recipes-bsp/bootfiles/rpi-config_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ WM8960="${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}"

GPIO_SHUTDOWN_PIN ??= ""

RPI_CONFIG_STRIP ??= "0"

inherit deploy nopackages

do_deploy() {
Expand Down Expand Up @@ -328,10 +330,25 @@ do_deploy:append:raspberrypi3-64() {
}

do_deploy:append() {
# Clean comments, empty lines and leading spaces
if [ "${RPI_CONFIG_STRIP}" = "1" ]; then
sed -i '/^#/d' $CONFIG
sed -i '/^$/d' $CONFIG
sed -i 's/^\s*//g' $CONFIG
fi

# Warn about too long lines!
if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then
bbwarn "config.txt contains lines longer than 80 characters, this is not supported"
fi

# Warn about too big file!
size=$(stat -c '%s' $CONFIG)
if [ "$size" -gt 16384 ]; then
bbfatal "config.txt larger than 16k is not necessarily supported"
fi
}
do_deploy[vardeps] += "${RPI_CONFIG_STRIP}"

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