Skip to content

Commit

Permalink
pack-kernel.sh: merge develop-3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rockchip committed Mar 28, 2013
1 parent 5575fa0 commit bb7a771
Showing 1 changed file with 18 additions and 162 deletions.
180 changes: 18 additions & 162 deletions pack-kernel.sh
Original file line number Diff line number Diff line change
@@ -1,127 +1,16 @@
#!/bin/bash
set -e

# ---------------------------------------------------------------------------
usage() {
echo "usage: $0 [rk2928|rk30|rk3066b|rk3188]"
echo "example: $0 rk3066b"
exit
}

while getopts "h" options; do
case $options in
h ) usage;;
esac
done
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
kerndir=$(cd .; pwd) # get absolute path
[ -d $kerndir ] || usage

arch=${1}
FILES=()
DIRS=()
EXCLUDES=()

if [ "$arch" == "rk30" ]; then

EXCLUDES=(
arch/arm/mach-rk30/*rk3066b*
arch/arm/mach-rk30/include/mach/*rk3066b*

arch/arm/mach-rk3188/*.c
arch/arm/mach-rk3188/*.h
arch/arm/mach-rk3188/Makefile*
arch/arm/mach-rk3188/include
arch/arm/configs/rk3188_*

arch/arm/mach-rk29*/*.c
arch/arm/mach-rk29*/*.h
arch/arm/mach-rk29*/*.S
arch/arm/mach-rk29*/Makefile*
arch/arm/mach-rk29*/include
arch/arm/configs/rk29*

arch/arm/mach-rk30/board-rk30-phone-*
arch/arm/configs/rk30_phone_*

arch/arm/configs/rk30_phonepad_c8003*
)

defconfig=rk3066_sdk_defconfig

elif [ "$arch" == "rk2928" ]; then

EXCLUDES=(
arch/arm/mach-rk30/*.c
arch/arm/mach-rk30/*.h
arch/arm/mach-rk30/*.S
arch/arm/mach-rk30/*.inc
arch/arm/mach-rk30/Makefile*
arch/arm/mach-rk30/include
arch/arm/configs/rk30*

arch/arm/mach-rk3188/*.c
arch/arm/mach-rk3188/*.h
arch/arm/mach-rk3188/Makefile*
arch/arm/mach-rk3188/include
arch/arm/configs/rk3188_*

drivers/video/rockchip/lcdc/rk30*
drivers/video/rockchip/hdmi/chips/rk30/rk30*
drivers/video/rockchip/hdmi/chips/rk30/hdcp/rk30*

arch/arm/mach-rk2928/board-rk2928-a720*
arch/arm/configs/rk2928_a720_defconfig

arch/arm/mach-rk2928/board-rk2928.c
arch/arm/configs/rk2928_defconfig

arch/arm/mach-rk2928/board-rk2928-phonepad*
arch/arm/configs/rk2928_phonepad_defconfig
)

defconfig=rk2928_sdk_defconfig

elif [ "$arch" == "rk3066b" -o "$arch" == "rk3188" ]; then

EXCLUDES=(
arch/arm/mach-rk30/clock_data.c
arch/arm/mach-rk30/board-rk30-ds*
arch/arm/mach-rk30/board-rk30-phone*
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/board-rk30-sdk-tps65910.c
arch/arm/mach-rk30/board-rk30-sdk-twl80032.c
arch/arm/mach-rk30/board-rk30-sdk-rfkill.c
arch/arm/mach-rk30/board-rk30-sdk-wm8326.c

arch/arm/configs/rk30_*
arch/arm/configs/rk3066_*

arch/arm/mach-rk29*/*.c
arch/arm/mach-rk29*/*.h
arch/arm/mach-rk29*/*.S
arch/arm/mach-rk29*/Makefile*
arch/arm/mach-rk29*/include
arch/arm/configs/rk29*
)

if [ "$arch" == "rk3066b" ]; then
defconfig=rk3168_tb_defconfig
else
defconfig=rk3188_tb_defconfig
fi

else
echo "unknown arch" && usage
fi

[ -f $kerndir/arch/arm/configs/$defconfig ] || usage
[ -d $kerndir ] || exit

COMMON_EXCLUDES=(
pack-kernel*
defconfig
kernel.img
arch/arm/plat-rk/vpu*.c
arch/arm/plat-rk/rk_pm_tests/*.c
arch/arm/plat-rk/rk_pm_tests/*.h
drivers/staging/rk29/vivante
drivers/staging/rk29/ipp/rk29-ipp.c
drivers/*rk28*.c
Expand All @@ -136,49 +25,23 @@ arch/arm/mach-rk*/*-fpga*
arch/arm/configs/rk29_*
arch/arm/configs/rk3168m_*
arch/arm/configs/*_fpga_*
)
# ---------------------------------------------------------------------------

# make .uu
pushd $kerndir >/dev/null

declare -a files

for file in ${FILES[@]}; do
[ -e ${file} ] && files=( ${files[@]} ${file} ) || echo No such file: ${file}
[ -f ${file/.[cS]/.uu} ] && rm -f ${file/.[cS]/.uu}
done

for dir in ${DIRS[@]}; do
[ -d $dir ] && find $dir -type f -name '*.uu' -print0 | xargs -0 rm -f
done

echo build kernel on $kerndir with $defconfig, arch is $arch
make clean >/dev/null 2>&1
make $defconfig >/dev/null 2>&1

[ -z "${files}${DIRS}" ] ||
make -j`grep 'processor' /proc/cpuinfo | wc -l` ${files[@]/.[cS]/.o} ${DIRS[@]}
arch/arm/configs/rk30_phone_*
arch/arm/configs/*_openwrt_*

for file in ${FILES[@]}; do
filename=${file##*/}
base=${filename%%.*}
dir=${file%/*}
[ -f $dir/$base.o ] && echo UU $dir/$base.uu && uuencode $dir/$base.o $base.o > $dir/$base.uu
done
arch/arm/mach-rk30/board-rk30-phone-*
arch/arm/mach-rk30/board-rk30-phonepad.c
arch/arm/mach-rk30/board-rk30-phonepad-key.c
arch/arm/configs/rk30_phonepad*

for d in ${DIRS[@]}; do
for file in `find $d -type f -name '*.o'`; do
filename=${file##*/}
base=${filename%%.*}
dir=${file%/*}
echo UU $dir/$base.uu && uuencode $dir/$base.o $base.o > $dir/$base.uu
done
done
arch/arm/mach-rk2928/board-rk2928-a720*
arch/arm/configs/rk2928_a720_defconfig

make distclean >/dev/null 2>&1
arch/arm/mach-rk30/*rk3028*
arch/arm/configs/rk3028_*
)

popd >/dev/null
# ---------------------------------------------------------------------------
make -j`grep 'processor' /proc/cpuinfo | wc -l` distclean >/dev/null 2>&1

# fix local version
echo "+" > $kerndir/.scmversion
Expand All @@ -188,18 +51,11 @@ pushd $kerndir/../ >/dev/null
package=$(basename $kerndir).tar
ex=$package.ex
> $ex
for file in ${FILES[@]}; do
echo "$file" >> $ex
done
for file in ${EXCLUDES[@]}; do
echo "$file" >> $ex
done
for file in ${COMMON_EXCLUDES[@]}; do
echo "$file" >> $ex
done
echo TAR $(pwd)/$package
tar cf $package --numeric-owner --exclude-from $ex --exclude=.git $(basename $kerndir)
#tar rf $package --numeric-owner --exclude=.git prebuilt/linux-x86/toolchain/arm-eabi-4.4.0
echo GZIP $(pwd)/$package.gz
gzip -9 -c $package > $package.gz
rm $ex
Expand Down

0 comments on commit bb7a771

Please sign in to comment.