tools/refresh.sh: ad --nocopy option to skip copy defconfig (#563)

So we can normalize and copy the current .config to defconfig
This commit is contained in:
Xiang Xiao 2020-03-13 10:44:23 -05:00 committed by Gregory Nutt
parent ea81924fce
commit d06cacb2f7

View file

@ -41,6 +41,7 @@ unset CONFIGS
silent=n
defaults=n
prompt=y
nocopy=n
while [ ! -z "$1" ]; do
case $1 in
@ -58,6 +59,9 @@ while [ ! -z "$1" ]; do
--defaults )
defaults=y
;;
--nocopy )
nocopy=y
;;
--help )
echo "$0 is a tool for refreshing board configurations"
echo ""
@ -74,6 +78,8 @@ while [ ! -z "$1" ]; do
echo " prompt unless --silent"
echo " --defaults"
echo " Do not prompt for new default selections; accept all recommended default values"
echo " --nocopy"
echo " Do not copy defconfig from nuttx/boards/<board>/configs to nuttx/.config"
echo " --help"
echo " Show this help message and exit"
echo " <board>"
@ -207,29 +213,32 @@ for CONFIG in ${CONFIGS}; do
# Copy the .config and Make.defs to the toplevel directory
rm -f SAVEconfig
if [ -e .config ]; then
mv .config SAVEconfig || \
{ echo "ERROR: Failed to move .config to SAVEconfig"; exit 1; }
fi
cp -a $DEFCONFIG .config || \
{ echo "ERROR: Failed to copy $DEFCONFIG to .config"; exit 1; }
rm -f SAVEMake.defs
if [ -e Make.defs ]; then
mv Make.defs SAVEMake.defs || \
{ echo "ERROR: Failed to move Make.defs to SAVEMake.defs"; exit 1; }
fi
cp -a $MAKEDEFS Make.defs || \
{ echo "ERROR: Failed to copy $MAKEDEFS to Make.defs"; exit 1; }
if [ "X${nocopy}" != "Xy" ]; then
if [ -e .config ]; then
mv .config SAVEconfig || \
{ echo "ERROR: Failed to move .config to SAVEconfig"; exit 1; }
fi
# Then run oldconfig or oldefconfig
cp -a $DEFCONFIG .config || \
{ echo "ERROR: Failed to copy $DEFCONFIG to .config"; exit 1; }
if [ "X${defaults}" == "Xy" ]; then
make olddefconfig
else
make oldconfig
if [ -e Make.defs ]; then
mv Make.defs SAVEMake.defs || \
{ echo "ERROR: Failed to move Make.defs to SAVEMake.defs"; exit 1; }
fi
cp -a $MAKEDEFS Make.defs || \
{ echo "ERROR: Failed to copy $MAKEDEFS to Make.defs"; exit 1; }
# Then run oldconfig or oldefconfig
if [ "X${defaults}" == "Xy" ]; then
make olddefconfig
else
make oldconfig
fi
fi
# Run savedefconfig to create the new defconfig file