Skip to content

Instantly share code, notes, and snippets.

@a3f
Created October 16, 2023 16:29
Show Gist options
  • Save a3f/b1bd0a6258b186a20a51fe5f72f40a08 to your computer and use it in GitHub Desktop.
Save a3f/b1bd0a6258b186a20a51fe5f72f40a08 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "USAGE: $0 kernel-recipe [defconfig path]"
exit 1
fi
recipe=$1
dest=$(realpath $2)
bbgetvar () {
# NOTE: You may need to add SANITY_TESTED_DISTROS:append = " debian-12"
# to conf/local.conf if the error messages makes it into the output
bitbake-getvar -r "$1" --value "$2"
}
bitbake -c do_configure $recipe
KCONFIG="$(bbgetvar $recipe B)/.config"
if [ -z "$dest" ]; then
echo "$KCONFIG"
else
cd "$(dirname $dest)"
dest=$(basename $dest)
if [ -n "$(git status --porcelain $dest)" ]; then
echo "uncomitted changes: refusing to overwrite $dest"
exit 2
fi
cp "$KCONFIG" "$dest"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment