⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buildtoolchain-step05-kernelsourceheaders.txt

📁 这是《嵌入式linux-硬件、软件与接口》一书对应的所有linux方面实例的源代码
💻 TXT
字号:
#!/bin/bash
# buildtoolchain-step05-kernelsourceheaders v1.22 10/15/02 
# www.embeddedlinuxinterfacing.com
#
# The original location of this script is
# http://www.embeddedlinuxinterfacing.com/chapters/03/buildtoolchain
#
# Copyright (C) 2001 by Craig Hollabaugh
# See buildtoolchain script for General Public License statement

if [ ! $BUILDTOOLCHAINENV ]
then
. ./buildtoolchain-environment $1
fi

#
# Step 5 - Setup Kernel Source and Headers
#
date "+%x %X -   Started: $0"
date "+%x %X -   Started: $0" >> $SRCFILELOC/output-build-status

echo Setting up $KERNELVERSION source and headers for $TARGET
cd $SRCFILELOC

echo Removing $SRCFILELOC/linux
rm -rf linux $KERNELVERSION

echo Extracting $KERNELVERSION.tar.gz
tar zxf $KERNELVERSION.tar.gz

# old kernel tar files etracted into linux, new ones extract 
# into linux-2.4.4, for example
mv linux $KERNELVERSION 

cd $KERNELVERSION 
if [ $KERNELPATCH1 ]
then
	echo Patching with $KERNELPATCH1
	gzip -cd ../$KERNELPATCH1 | patch -p1
fi
if [ $KERNELPATCH2 ]
then
	echo Patching with $KERNELPATCH2
	gzip -cd ../$KERNELPATCH2 | patch -p1
fi
if [ $KERNELPATCH3 ]
then
	echo Patching with $KERNELPATCH3
	gzip -cd ../$KERNELPATCH3 | patch -p1
fi

# save the existing kernel configuration if it exists
cd $SRCFILELOC
if [ -f $PREFIX/src/$TARGET/.config ]
then
	echo Saving $PREFIX/src/$TARGET/.config
	mv $PREFIX/src/$TARGET/.config /tmp/config.original
fi

# remove all the exist kernel source code for this target
echo Removing $PREFIX/src/$TARGET
rm -rf $PREFIX/src/$TARGET

echo Creating $PREFIX/src/$TARGET
mv $KERNELVERSION $PREFIX/src/$TARGET

cd $PREFIX/src/$TARGET

if [ -f /tmp/config.original ]
then
	echo Saving $PREFIX/src/$TARGET/.config as $PREFIX/src/$TARGET/config.original
	mv /tmp/config.original $PREFIX/src/$TARGET/config.original
fi


make mrproper	

sed "s/ARCH :=.*$/ARCH := $ARCH/1" Makefile > /tmp/Makefile
cp /tmp/Makefile Makefile
sed "s/CROSS_COMPILE.*=.*$/CROSS_COMPILE   = $TARGET-/1" Makefile > /tmp/Makefile
cp /tmp/Makefile Makefile

make mrproper

# use the target board defconfig if defined, otherwise have the user go through make menuconfig
if [ $TARGETBOARD ]
then
	make $TARGETBOARD"_config"
	yes n | make oldconfig
else
	make menuconfig
fi

make dep

if [ ! -e $PREFIX/$TARGET ]
then
	mkdir $PREFIX/$TARGET
fi

rm -rf $PREFIX/$TARGET/include
mkdir $PREFIX/$TARGET/include
cp -dR $PREFIX/src/$TARGET/include/asm-$ARCH $PREFIX/$TARGET/include/asm
cp -dR $PREFIX/src/$TARGET/include/linux $PREFIX/$TARGET/include/linux
 
date "+%x %X - Completed: $0"
date "+%x %X - Completed: $0" >> $SRCFILELOC/output-build-status



#beep
echo -e "\07"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -