Merge remote-tracking branch 'upstream/master'

This commit is contained in:
zador-blood-stained 2015-12-08 21:37:20 +03:00
commit 3e83dd5d01
5 changed files with 103 additions and 153 deletions

View File

@ -15,11 +15,10 @@ compile_uboot (){
# Compile uboot from sources
#--------------------------------------------------------------------------------------------------------------------------------
if [ -d "$SOURCES/$BOOTSOURCE" ]; then
grab_u-boot_version
display_alert "Compiling uboot. Please wait." "$UBOOTVER" "info"
echo `date +"%d.%m.%Y %H:%M:%S"` $SOURCES/$BOOTSOURCE/$BOOTCONFIG >> $DEST/debug/install.log
cd $SOURCES/$BOOTSOURCE
if [ -d "$SOURCES/$BOOTSOURCEDIR" ]; then
display_alert "Compiling uboot. Please wait." "$VER" "info"
echo `date +"%d.%m.%Y %H:%M:%S"` $SOURCES/$BOOTSOURCEDIR/$BOOTCONFIG >> $DEST/debug/install.log
cd $SOURCES/$BOOTSOURCEDIR
make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean >/dev/null 2>&1
# there are two methods of compilation
if [[ $BOOTCONFIG == *config* ]]; then
@ -29,9 +28,9 @@ if [ -d "$SOURCES/$BOOTSOURCE" ]; then
touch .scmversion
if [[ $BRANCH != "next" && $LINUXCONFIG == *sun* ]] ; then
## patch mainline uboot configuration to boot with old kernels
if [ "$(cat $SOURCES/$BOOTSOURCE/.config | grep CONFIG_ARMV7_BOOT_SEC_DEFAULT=y)" == "" ]; then
echo "CONFIG_ARMV7_BOOT_SEC_DEFAULT=y" >> $SOURCES/$BOOTSOURCE/.config
echo "CONFIG_OLD_SUNXI_KERNEL_COMPAT=y" >> $SOURCES/$BOOTSOURCE/.config
if [ "$(cat $SOURCES/$BOOTSOURCEDIR/.config | grep CONFIG_ARMV7_BOOT_SEC_DEFAULT=y)" == "" ]; then
echo "CONFIG_ARMV7_BOOT_SEC_DEFAULT=y" >> $SOURCES/$BOOTSOURCEDIR/.config
echo "CONFIG_OLD_SUNXI_KERNEL_COMPAT=y" >> $SOURCES/$BOOTSOURCEDIR/.config
fi
fi
eval 'make $CTHREADS CROSS_COMPILE="$CCACHE arm-linux-gnueabihf-" 2>&1' \
@ -85,7 +84,7 @@ Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Section: kernel
Priority: optional
Description: Uboot loader $UBOOTVER
Description: Uboot loader $VER
END
#
@ -140,15 +139,16 @@ compile_kernel (){
display_alert "Compiling kernel" "@host" "info"
sleep 2
if [ -d "$SOURCES/$LINUXSOURCE" ]; then
if [ -d "$SOURCES/$LINUXSOURCEDIR" ]; then
cd $SOURCES/$LINUXSOURCE
cd $SOURCES/$LINUXSOURCEDIR/
# delete previous creations
# adding custom firmware to kernel source
if [[ -n "$FIRMWARE" ]]; then unzip -o $SRC/lib/$FIRMWARE -d $SOURCES/$LINUXSOURCE/firmware; fi
if [[ -n "$FIRMWARE" ]]; then unzip -o $SRC/lib/$FIRMWARE -d $SOURCES/$LINUXSOURCEDIR/firmware; fi
# use proven config
if [ "$KERNEL_KEEP_CONFIG" != "yes" ] || [ ! -f $SOURCES/$LINUXSOURCE/.config ]; then cp $SRC/lib/config/$LINUXCONFIG.config $SOURCES/$LINUXSOURCE/.config; fi
if [ "$KERNEL_KEEP_CONFIG" != "yes" ] || [ ! -f $SOURCES/$LINUXSOURCEDIR/.config ]; then cp $SRC/lib/config/$LINUXCONFIG.config $SOURCES/$LINUXSOURCEDIR/.config; fi
# hacks for banana
if [[ $BOARD == banana* || $BOARD == orangepi* || $BOARD == lamobo* ]] ; then
@ -233,7 +233,7 @@ rm usb-redirector-linux-arm-eabi.tar.gz
cd $SOURCES/usb-redirector-linux-arm-eabi/files/modules/src/tusbd
# patch to work with newer kernels
sed -e "s/f_dentry/f_path.dentry/g" -i usbdcdev.c
make -j1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNELDIR=$SOURCES/$LINUXSOURCE/ >> $DEST/debug/install.log
make -j1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNELDIR=$SOURCES/$LINUXSOURCEDIR/ >> $DEST/debug/install.log
# configure USB redirector
sed -e 's/%INSTALLDIR_TAG%/\/usr\/local/g' $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd > $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd1
sed -e 's/%PIDFILE_TAG%/\/var\/run\/usbsrvd.pid/g' $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd1 > $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd
@ -255,18 +255,18 @@ if [[ -n "$MISC3_DIR" ]]; then
cd $SOURCES/$MISC3_DIR
#git checkout 0ea77e747df7d7e47e02638a2ee82ad3d1563199
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean >/dev/null 2>&1
(make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KSRC=$SOURCES/$LINUXSOURCE/ >/dev/null 2>&1)
(make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KSRC=$SOURCES/$LINUXSOURCEDIR/ >/dev/null 2>&1)
cp *.ko $DEST/cache/sdcard/usr/local/bin
#cp blacklist*.conf $DEST/cache/sdcard/etc/modprobe.d/
fi
# MISC4 = NOTRO DRIVERS / special handling
# MISC5 = sunxu display control
if [[ -n "$MISC5_DIR" && $BRANCH != "next" && $LINUXSOURCE == *sunxi* ]]; then
if [[ -n "$MISC5_DIR" && $BRANCH != "next" && $LINUXSOURCEDIR == *sunxi* ]]; then
cd $SOURCES/$MISC5_DIR
cp $SOURCES/$LINUXSOURCE/include/video/sunxi_disp_ioctl.h .
cp $SOURCES/$LINUXSOURCEDIR/include/video/sunxi_disp_ioctl.h .
make clean >/dev/null 2>&1
(make ARCH=arm CC=arm-linux-gnueabihf-gcc KSRC=$SOURCES/$LINUXSOURCE/ >/dev/null 2>&1)
(make ARCH=arm CC=arm-linux-gnueabihf-gcc KSRC=$SOURCES/$LINUXSOURCEDIR/ >/dev/null 2>&1)
install -m 755 a10disp $DEST/cache/sdcard/usr/local/bin
fi
}

View File

@ -345,7 +345,7 @@
[[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-$LINUXFAMILY-$BRANCH"
[[ -z $LINUXKERNEL ]] && eval LINUXKERNEL=\$KERNEL_${BRANCH^^}
[[ -z $LINUXSOURCE ]] && eval LINUXSOURCE=\$KERNEL_${BRANCH^^}"_SOURCE"
[[ -z $KERNELTAG ]] && eval KERNELTAG=\$KERNEL_${BRANCH^^}"_BRANCH"
[[ -z $KERNELBRANCH ]] && eval KERNELBRANCH=\$KERNEL_${BRANCH^^}"_BRANCH"
[[ -z $BOOTLOADER ]] && eval BOOTLOADER=\$UBOOT
[[ -z $BOOTSOURCE ]] && eval BOOTSOURCE=\$UBOOT_SOURCE
[[ -z $BOOTBRANCH ]] && eval BOOTBRANCH=\$UBOOT_BRANCH

View File

@ -10,15 +10,24 @@
#
# cleaning <#>
# 0 = make clean + del debs
# 1 = only make clean
# 2 = nothing
# 3 = choosing kernel if present
# 4 = del all output and sources
cleaning()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's clean stuff
#--------------------------------------------------------------------------------------------------------------------------------
{
case $1 in
1) # Clean u-boot and kernel sources
[ -d "$SOURCES/$BOOTSOURCE" ] && display_alert "Cleaning" "$SOURCES/$BOOTSOURCE" "info" && cd $SOURCES/$BOOTSOURCE && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -d "$SOURCES/$LINUXSOURCE" ] && display_alert "Cleaning" "$SOURCES/$LINUXSOURCE" "info" && cd $SOURCES/$LINUXSOURCE && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
1) # Clean u-boot and kernel sources
if [ -d "$SOURCES/$BOOTSOURCEDIR" ]; then
display_alert "Cleaning" "$SOURCES/$BOOTSOURCEDIR" "info"
cd $SOURCES/$BOOTSOURCEDIR
make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
fi
[ -d "$SOURCES/$LINUXSOURCEDIR" ] && display_alert "Cleaning" "$SOURCES/$LINUXSOURCEDIR" "info" && cd $SOURCES/$LINUXSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -f $DEST/cache/building/$HEADERS_CACHE.tgz ] && display_alert "Cleaning" "$HEADERS_CACHE.tgz" "info" && rm -f $DEST/cache/building/$HEADERS_CACHE.tgz
;;
@ -39,14 +48,16 @@ case $1 in
rm -rf $DEST/cache
display_alert "Removing SD card images" "$DEST/images" "info"
rm -rf $DEST/images
display_alert "Removing sources" "$DEST/images" "info"
rm -rf $SOURCES
;;
*) # Clean u-boot and kernel sources and remove debs
[ -d "$SOURCES/$BOOTSOURCE" ] &&
display_alert "Cleaning" "$SOURCES/$BOOTSOURCE" "info" && cd $SOURCES/$BOOTSOURCE && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -d "$SOURCES/$BOOTSOURCEDIR" ] &&
display_alert "Cleaning" "$SOURCES/$BOOTSOURCEDIR" "info" && cd $SOURCES/$BOOTSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -f "$DEST/debs/$CHOOSEN_UBOOT" ] &&
display_alert "Removing" "$DEST/debs/$CHOOSEN_UBOOT" "info" && rm $DEST/debs/$CHOOSEN_UBOOT
[ -d "$SOURCES/$LINUXSOURCE" ] &&
display_alert "Cleaning" "$SOURCES/$LINUXSOURCE" "info" && cd $SOURCES/$LINUXSOURCE && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -d "$SOURCES/$LINUXSOURCEDIR" ] &&
display_alert "Cleaning" "$SOURCES/$LINUXSOURCEDIR" "info" && cd $SOURCES/$LINUXSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
[ -f "$DEST/debs/$CHOOSEN_KERNEL" ] &&
display_alert "Removing" "$DEST/debs/$CHOOSEN_KERNEL" "info" && rm $DEST/debs/$CHOOSEN_KERNEL
[ -f $DEST/cache/building/$HEADERS_CACHE.tgz ] && display_alert "Cleaning" "$HEADERS_CACHE.tgz" "info" && rm -f $DEST/cache/building/$HEADERS_CACHE.tgz
@ -55,76 +66,39 @@ esac
}
# fetch_from_github <URL> <directory> <tag> <tagsintosubdir>
#
# parameters:
# <URL>: Git repository
# <directory>: where to place under SOURCES
# <device>: cubieboard, cubieboard2, cubietruck, ...
# <description>: additional description text
# <tagintosubdir>: boolean
fetch_from_github (){
#---------------------------------------------------------------------------------------------------------------------------------
# Download or updates sources from Github $1 = URL $2 = DIR $3 = TAG
#---------------------------------------------------------------------------------------------------------------------------------
local tag=$3
[[ ($BRANCH == "next" || $BRANCH == "dev") && -z "$tag" ]] && local tag=$(git ls-remote $1 | tail -2 | head -1 | awk '{print $NF}')
tag="${tag//refs\/tags\//}"
if [ -d "$SOURCES/$2" ]; then
cd $SOURCES/$2
# no tags
if [[ -z "$tag" ]]; then
local command=$(git pull | grep "Already up-to")
if [ -z "$command" ]; then
display_alert "... updating" "$tag" "info"
else
display_alert "... updated" "$tag" "info"
fi
# tag already exists
elif [[ -n "$(git tag | grep -w "$tag")" ]]; then
# switch to this tag
#git checkout $FORCE -q $tag
git reset --hard $tag
git checkout $FORCE $tag
# git pull commmand exec
local command=$(git pull | grep "Already up-to")
if [ -z "$command" ]; then
display_alert "... updating" "$tag" "info"
else
display_alert "... updated" "$tag" "info"
fi
# download existing new remote tag
elif [[ -n "$(git ls-remote -q | grep "$tag")" ]]; then
display_alert "... fetch new tag" "$tag" "info"
#git branch "armbian-"$tag
git fetch $1 refs/tags/$tag:refs/tags/$tag --depth 1
# create a shallow clone to local branch and switch to this tag
#git checkout $tag $FORCE
git checkout $FORCE -b "armbian-"$tag $tag
else
local command=$(git pull | grep "Already up-to")
if [ -z "$command" ]; then
display_alert "... updating" "repository" "info"
else
display_alert "... updated" "repository" "info"
fi
fi
else
if [[ -n $tag && -n "$(git ls-remote $1 | grep "$tag")" ]]; then
display_alert "... creating a shallow clone" "$2 $tag" "info"
git clone -n $1 $SOURCES/$2 -b $tag --depth 1
GITHUBSUBDIR=$3
[[ -z "$3" ]] && GITHUBSUBDIR="branchless"
[[ -z "$4" ]] && GITHUBSUBDIR="" # only kernel and u-boot have subdirs for tags
if [ -d "$SOURCES/$2/$GITHUBSUBDIR" ]; then
cd $SOURCES/$2/$GITHUBSUBDIR
git checkout -q $FORCE $3
display_alert "... updating" "$2" "info"
PULL=$(git pull -q)
else
if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then
display_alert "... creating a shallow clone" "$2 $3" "info"
git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1
cd $SOURCES/$2/$GITHUBSUBDIR
git checkout -q $3
else
display_alert "... creating a full clone" "$2 $tag" "wrn"
git clone -n $1 $SOURCES/$2
fi
cd $SOURCES/$2
#git checkout -q $tag
#git branch -q "armbian-"$tag
git checkout -b "armbian-"$tag $tag
git status
display_alert "... creating a shallow clone" "$2" "info"
git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1
cd $SOURCES/$2/$GITHUBSUBDIR
git checkout -q
fi
fi
cd $SRC
if [ $? -ne 0 ]; then display_alert "Github download failed" "$1" "err"; exit 1; fi
@ -186,28 +160,21 @@ procent=${procent%.*}
done
}
grab_kernel_version (){
#--------------------------------------------------------------------------------------------------------------------------------
# extract linux kernel version from Makefile
#--------------------------------------------------------------------------------------------------------------------------------
VER=$(cat $SOURCES/$LINUXSOURCE/Makefile | grep VERSION | head -1 | awk '{print $(NF)}')
VER=$VER.$(cat $SOURCES/$LINUXSOURCE/Makefile | grep PATCHLEVEL | head -1 | awk '{print $(NF)}')
VER=$VER.$(cat $SOURCES/$LINUXSOURCE/Makefile | grep SUBLEVEL | head -1 | awk '{print $(NF)}')
EXTRAVERSION=$(cat $SOURCES/$LINUXSOURCE/Makefile | grep EXTRAVERSION | head -1 | awk '{print $(NF)}' | cut -d '-' -f 2)
if [ "$EXTRAVERSION" != "=" ]; then VER=$VER$EXTRAVERSION; fi
}
grab_u-boot_version (){
#--------------------------------------------------------------------------------------------------------------------------------
# extract uboot version from Makefile
#--------------------------------------------------------------------------------------------------------------------------------
UBOOTVER=$(cat $SOURCES/$BOOTSOURCE/Makefile | grep VERSION | head -1 | awk '{print $(NF)}')
UBOOTVER=$UBOOTVER.$(cat $SOURCES/$BOOTSOURCE/Makefile | grep PATCHLEVEL | head -1 | awk '{print $(NF)}')
UBOOTSUB=$(cat $SOURCES/$BOOTSOURCE/Makefile | grep SUBLEVEL | head -1 | awk '{print $(NF)}' | cut -d '=' -f 2)
[ "$UBOOTSUB" != "" ] && UBOOTVER=$UBOOTVER.$UBOOTSUB
EXTRAVERSION=$(cat $SOURCES/$BOOTSOURCE/Makefile | grep EXTRAVERSION | head -1 | awk '{print $(NF)}' | cut -d '-' -f 2)
if [ "$EXTRAVERSION" != "=" ]; then UBOOTVER=$UBOOTVER$EXTRAVERSION; fi
#---------------------------------------------------------------------------------------------------------------------------------
# grab_version <PATH>
#
# <PATH>: Extract kernel or uboot version from Makefile
#---------------------------------------------------------------------------------------------------------------------------------
grab_version ()
{
local var=("VERSION" "PATCHLEVEL" "SUBLEVEL" "EXTRAVERSION")
unset VER
for dir in "${var[@]}"; do
tmp=$(cat $1/Makefile | grep $dir | head -1 | awk '{print $(NF)}' | cut -d '=' -f 2)"#"
[[ $tmp != "#" ]] && VER=$VER"$tmp"
done
VER=${VER//#/.}; VER=${VER%.}; VER="v"${VER//.-/-}
}
@ -273,7 +240,6 @@ echo "--------------------------------------------------------------------------
umount_image (){
FBTFTMOUNT=$(mount | grep fbtft | awk '{ print $3 }')
umount $FBTFTMOUNT >/dev/null 2>&1
umount $SOURCES/$LINUXSOURCE/drivers/video/fbtft >/dev/null 2>&1
umount -l $DEST/cache/sdcard/dev/pts >/dev/null 2>&1
umount -l $DEST/cache/sdcard/dev >/dev/null 2>&1
umount -l $DEST/cache/sdcard/proc >/dev/null 2>&1

15
main.sh
View File

@ -253,18 +253,21 @@
# Some old branches are tagged
#if [ "$BRANCH" == "default" ]; then KERNELTAG="$LINUXBRANCH"; fi
[ $CLEAN_LEVEL == 4 ] && cleaning "$CLEAN_LEVEL"
display_alert "source downloading" "@host" "info"
fetch_from_github "$BOOTLOADER" "$BOOTSOURCE" "$UBOOTTAG" "yes"
fetch_from_github "$LINUXKERNEL" "$LINUXSOURCE" "$KERNELTAG" "yes"
fetch_from_github "$BOOTLOADER" "$BOOTSOURCE" "$BOOTBRANCH" "yes"
BOOTSOURCEDIR=$BOOTSOURCE/$GITHUBSUBDIR
fetch_from_github "$LINUXKERNEL" "$LINUXSOURCE" "$KERNELBRANCH" "yes"
LINUXSOURCEDIR=$LINUXSOURCE/$GITHUBSUBDIR
if [[ -n "$MISC1" ]]; then fetch_from_github "$MISC1" "$MISC1_DIR" "v1.3"; fi
if [[ -n "$MISC1" ]]; then fetch_from_github "$MISC1" "$MISC1_DIR"; fi
if [[ -n "$MISC2" ]]; then fetch_from_github "$MISC2" "$MISC2_DIR"; fi
if [[ -n "$MISC3" ]]; then fetch_from_github "$MISC3" "$MISC3_DIR"; fi
if [[ -n "$MISC4" ]]; then fetch_from_github "$MISC4" "$MISC4_DIR"; fi
if [[ -n "$MISC5" ]]; then fetch_from_github "$MISC5" "$MISC5_DIR"; fi
# compile sunxi tools
if [[ $LINUXFAMILY == *sun* ]]; then
compile_sunxi_tools
@ -278,7 +281,7 @@
HEADERS_CACHE="${CHOOSEN_KERNEL/image/cache}"
# cleaning level 0,1,2,3
cleaning "$CLEAN_LEVEL"
[ $CLEAN_LEVEL != 4 ] && cleaning "$CLEAN_LEVEL"
# patching sources
patching_sources

View File

@ -34,7 +34,7 @@ advanced_patch () {
local device=$3
local description=$4
display_alert "Started patching process for" "$dest" "info"
display_alert "Started patching process for" "$dest $description" "info"
local names=()
local dirs=("$SRC/userpatches/$dest/$family/$device" "$SRC/userpatches/$dest/$family" "$SRC/lib/patch/$dest/$family/$device" "$SRC/lib/patch/$dest/$family")
@ -99,21 +99,10 @@ patching_sources(){
# Patching kernel
#--------------------------------------------------------------------------------------------------------------------------------
cd $SOURCES/$LINUXSOURCE
# fix kernel tag
if [[ $KERNELTAG == "" ]] ; then
KERNELTAG="$LINUXDEFAULT";
fi
if [[ $BRANCH == "next" ]] ; then
git checkout $FORCE -q $KERNELTAG;
else
git checkout $FORCE -q $LINUXDEFAULT;
fi
cd $SOURCES/$LINUXSOURCEDIR
# what are we building
grab_kernel_version
#grab_kernel_version
# this is a patch that Ubuntu Trusty compiler works
if [ "$(patch --dry-run -t -p1 < $SRC/lib/patch/kernel/compiler.patch | grep Reversed)" != "" ]; then
@ -127,25 +116,17 @@ patching_sources(){
# this exception is needed since AW boards share single mainline kernel
[[ $LINUXFAMILY == sun*i && $BRANCH != "default" ]] && LINUXFAMILY="sunxi"
advanced_patch "kernel" "$LINUXFAMILY-$BRANCH" "$BOARD" "$LINUXFAMILY-$BRANCH $VER"
# it can be changed in this process
grab_kernel_version
grab_version "$SOURCES/$LINUXSOURCEDIR"
advanced_patch "kernel" "$LINUXFAMILY-$BRANCH" "$BOARD" "$LINUXFAMILY-$BRANCH $VER"
#---------------------------------------------------------------------------------------------------------------------------------
# Patching u-boot
#---------------------------------------------------------------------------------------------------------------------------------
cd $SOURCES/$BOOTSOURCE
# fix u-boot tag
if [ -z $UBOOTTAG ] ; then
git checkout $FORCE -q $BOOTDEFAULT;
else
git checkout $FORCE -q $UBOOTTAG;
fi
advanced_patch "u-boot" "$BOOTSOURCE" "$BOARD" "$UBOOTTAG"
cd $SOURCES/$BOOTSOURCEDIR
grab_version "$SOURCES/$BOOTSOURCEDIR"
advanced_patch "u-boot" "$BOOTSOURCE" "$BOARD" "$UBOOTTAG $VER"
}