Skip to content

Commit

Permalink
tools/refresh.sh: ad --nocopy option to skip copy defconfig (#563)
Browse files Browse the repository at this point in the history
So we can normalize and copy the current .config to defconfig
  • Loading branch information
xiaoxiang781216 authored and gregory-nutt committed Mar 13, 2020
1 parent ea81924 commit d06cacb
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions tools/refresh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ unset CONFIGS
silent=n
defaults=n
prompt=y
nocopy=n

while [ ! -z "$1" ]; do
case $1 in
Expand All @@ -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 ""
Expand All @@ -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>"
Expand Down Expand Up @@ -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
rm -f SAVEMake.defs

cp -a $DEFCONFIG .config || \
{ echo "ERROR: Failed to copy $DEFCONFIG to .config"; 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

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 $DEFCONFIG .config || \
{ echo "ERROR: Failed to copy $DEFCONFIG to .config"; exit 1; }

cp -a $MAKEDEFS Make.defs || \
{ echo "ERROR: Failed to copy $MAKEDEFS to Make.defs"; exit 1; }
if [ -e Make.defs ]; then
mv Make.defs SAVEMake.defs || \
{ echo "ERROR: Failed to move Make.defs to SAVEMake.defs"; exit 1; }
fi

# Then run oldconfig or oldefconfig
cp -a $MAKEDEFS Make.defs || \
{ echo "ERROR: Failed to copy $MAKEDEFS to Make.defs"; exit 1; }

if [ "X${defaults}" == "Xy" ]; then
make olddefconfig
else
make oldconfig
# 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
Expand Down

0 comments on commit d06cacb

Please sign in to comment.