Compare commits

..
2 Commits
Author SHA1 Message Date
Tobias Waldekranz 77fec32429 generate-config.sh: Support running from contexts where O is set
When invoked from a context like this...

   my-infix-spin$ make O=x-my-build x86_64_defconfig

...where the spin's Makefile would trigger the generation of the
defconfig based on some fragments, the value of O passed via the
environment would be ignored since the spin's Makefile typically
overrides it.

Therefore, pass it as a make variable instead, which takes precedence.
2026-06-03 08:23:20 +00:00
Tobias Waldekranz 27f4a130c6 board/common: swatch: Incrementally watch statistics loggers
E.g., ethtool -S
2026-06-02 21:19:44 +00:00
2 changed files with 50 additions and 1 deletions
+49
View File
@@ -0,0 +1,49 @@
#!/bin/sh
case $1 in
base|baseline) mode="baseline" ;;
incr|incremental) mode="incremental" ;;
ival|interval) mode="interval" ;;
single) mode="single" ;;
*) exit 1 ;;
esac
shift
slug=$(echo $* | tr ' ' '_' | tr -cd '[a-zA-Z0-9]-_')
baseline=/tmp/swatch-"$slug"
now=/tmp/swatch-"$slug".now
output()
{
diff -u -U0 "$baseline" "$now" | awk '
/^\-[^-]/ {
sub(/^-/, "");
last[$1] = $2;
}
/^\+[^+]/ {
sub(/^\+/, "");
diff = $2 - last[$1];
if (diff)
printf("%-60s %10d\n", $1, diff);
}
'
}
if [ $mode = baseline ] || ! [ -f "$baseline" ]; then
$@ >"$baseline"
[ $mode = baseline ] && exit
fi
if [ $mode = single ]; then
$@ >"$now"
output
exit
fi
while sleep 1; do
$@ >"$now"
printf '\e[2J\e[H'
output
[ $mode = interval ] && mv "$now" "$baseline"
done
+1 -1
View File
@@ -81,6 +81,6 @@ done
TMPDIR=`mktemp -d`
$MERGE_CONFIG -O "$TMPDIR" "$base" "$changes"
O="$TMPDIR" make savedefconfig
make O="$TMPDIR" savedefconfig
mv "$TMPDIR"/defconfig "$output"
rm -r "$TMPDIR"