* tools: Check for already migrated symbols in a given file
@ 2021-09-08 13:50 Tom Rini
0 siblings, 0 replies; only message in thread
From: Tom Rini @ 2021-09-08 13:50 UTC (permalink / raw)
To: u-boot
[-- Attachment #1: Type: text/plain, Size: 1973 bytes --]
Hey all,
As I look over patchwork I see (as one would expect) platforms showing
up that will come in either to -next, or once v2021.10 is out. Given
the number of newly migrated symbols now in -next, along with my hope to
get more done soon as well has having discovered lots of already
migrated symbols showing up again in board config.h files, I want to
pass along this bit of shell script. It's heavily borrowed from
scripts/build-whitelist.sh and basically has comm providing a different
column. It's also not fool-proof as I skipped handling
CONFIG_SYS_EXTRA_OPTIONS as I just want to remove that symbol entirely.
What you do with this is:
$ check-migrated-symbols.sh include/configs/am335x_evm.h
CONFIG_SYS_I2C_EEPROM_ADDR
CONFIG_SYS_I2C_EEPROM_ADDR_LEN
CONFIG_SYS_NAND_BLOCK_SIZE
CONFIG_SYS_NAND_OOBSIZE
CONFIG_SYS_NAND_PAGE_SIZE
CONFIG_SYS_NAND_U_BOOT_OFFS
And see that oh, those symbols need to be moved to the defconfig. I'm
not posting this to complain about existing board files (but I'll be
cleaning up stuff) but rather to note that when adding new boards, it's
REALLY important to catch and fix those problems. And without a script
of some sort, it's also a pain. So here's the script:
#!/bin/bash
if [ ! -f Kconfig ]; then
echo "ERROR: Must be run from root of U-Boot directory"
exit 1
fi
# Cleanup when done.
trap "{ rm -rf ${KSYMLST} ${KUSEDLST}; }" EXIT
KSYMLST=`mktemp`
KUSEDLST=`mktemp`
# List of existing symbols
cat `find . -name "Kconfig*"` | sed -n \
-e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
| sort -u > $KSYMLST
# Check each argument
while test $# -ne 0; do
# Not a file
[ ! -f "$1" ] && shift 1
grep '#define[[:blank:]]CONFIG_' $1 | sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' | sort -u > ${KUSEDLST}
comm -12 ${KSYMLST} ${KUSEDLST}
shift 1
done
rm -f ${KSYMLST} ${KUSEDLST}
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-08 13:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-08 13:50 tools: Check for already migrated symbols in a given file Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox