From 4705b4c21ae98cc4267110cf9ded8ffb289cf6dd Mon Sep 17 00:00:00 2001 From: Ulf Samuelsson Date: Fri, 2 Jan 2009 15:44:18 +0000 Subject: [PATCH] Apply some care, when copying the linux configuration file --- scripts/get_linux_config.sh | 58 ++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/scripts/get_linux_config.sh b/scripts/get_linux_config.sh index 1ea8b25503..0b986ae130 100755 --- a/scripts/get_linux_config.sh +++ b/scripts/get_linux_config.sh @@ -1,15 +1,57 @@ #!/bin/bash +####################################################################### +# +# Copy successively all configs from the BSP directory (par #1) +# to the Linux directory (par #2) +# Do not copy config files for later linux versions than the current +# A well-behaved filename is +# "-linux-2.6...config" or +# "-linux-2.6..config" +# +####################################################################### + +TOPDIR=`pwd` # parameter #1 BOARD_PATH # parameter #2 LINUX26_DIR -TOPDIR=`pwd` -BOARD_PATH=$1 -LINUX26_DIR=$2 +CONFIGS=`ls -X $1/*linux*.*.config | sed s/[.]config// - | sort` +LINUX26_DIR=`basename $2` +LINUX26_CONFIG=${2}/.config +LINUX_MAJOR_VERSION=${LINUX26_DIR:10:2} +LINUX_MINOR_VERSION=${LINUX26_DIR:13} -cd ${TOPDIR}/${BOARD_PATH} -mkdir -p ${LINUX26_DIR} -for i in `ls *linux*.config` ; do - echo Copying $i ... - cp $i ${LINUX26_DIR}/.config +function linux_version() +{ + local KCONFIG + KCONFIG=`basename $1` + KERNEL=`echo ${KCONFIG} | sed s/.*-linux-/linux-/g -` + THIS_MAJOR=${KERNEL:10:2} + THIS_MINOR=${KERNEL:13} + +} + +# Try to be careful... + +for i in ${CONFIGS} ; do + linux_version $i + if [ ${THIS_MAJOR} -le ${LINUX_MAJOR_VERSION} ] ; then + echo Copying `basename $i`.config ... + cp $i.config ${LINUX26_CONFIG} + elif [ ${THIS_MAJOR} -eq ${LINUX_MAJOR_VERSION} ] ; then + if [ ${THIS_MINOR} -le ${LINUX_MINOR_VERSION} ] ; then + echo Copying `basename $i`.config ... + cp $i.config ${LINUX26_CONFIG} + fi + fi done + +# Did not work... - be promisceous + +if [ ! -f "${LINUX26_CONFIG}" ] ; then \ + for i in `ls $1/*linux*.config` ; do + echo Copying `basename $i` ... + cp $i ${LINUX26_CONFIG} + done +fi +