Use fetch_from_repo for kernel and u-boot sources

This commit is contained in:
zador-blood-stained 2016-08-13 21:15:26 +03:00
parent 95fa82256f
commit 186a8dcff5
21 changed files with 99 additions and 86 deletions

View file

@ -1,7 +1,6 @@
# S805 C1 quad core
BOARD_NAME="Odroid C1"
KERNEL_TARGET="default"
KERNEL_IMAGE_TYPE=uImage
LINUXFAMILY=odroidc1
BOOTCONFIG=odroidc_config
MODULES="bonding"

View file

@ -1,6 +1,5 @@
# S905 C2 quad core
BOARD_NAME="Odroid C2"
KERNEL_IMAGE_TYPE=Image
LINUXFAMILY=odroidc2
BOOTCONFIG=odroidc2_config
MODULES="bonding"

View file

@ -1,6 +1,6 @@
BOOTSOURCE='https://github.com/SolidRun/u-boot-imx6'
BOOTBRANCH='imx6'
BOOTBRANCH='branch:imx6'
BOOTDIR='u-boot-cubox'
UBOOT_NEEDS_GCC='< 5.0'
@ -9,7 +9,7 @@ KERNEL_NEEDS_GCC='< 5.0'
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux4kix/linux-linaro-stable-mx6'
KERNELBRANCH='linux-linaro-lsk-v3.14-mx6'
KERNELBRANCH='branch:linux-linaro-lsk-v3.14-mx6'
KERNELDIR='linux-cubox'
;;
@ -21,7 +21,7 @@ case $BRANCH in
dev)
KERNELSOURCE='https://github.com/SolidRun/linux-fslc'
KERNELBRANCH='3.14-1.0.x-mx6-sr'
KERNELBRANCH='branch:3.14-1.0.x-mx6-sr'
KERNELDIR='linux-cubox'
;;
esac

View file

@ -1,5 +1,5 @@
BOOTSOURCE='https://github.com/SolidRun/u-boot-armada38x'
BOOTBRANCH='u-boot-2013.01-15t1-clearfog'
BOOTBRANCH='branch:u-boot-2013.01-15t1-clearfog'
BOOTDIR='u-boot-armada'
UBOOT_NEEDS_GCC='< 5.0'
@ -9,7 +9,7 @@ UBOOT_TARGET="u-boot.mmc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/SolidRun/linux-armada38x'
KERNELBRANCH='linux-3.10.70-15t1-clearfog'
KERNELBRANCH='branch:linux-3.10.70-15t1-clearfog'
KERNELDIR='linux-armada'
;;
@ -21,7 +21,7 @@ case $BRANCH in
dev)
KERNELSOURCE='https://github.com/SolidRun/linux-stable'
KERNELBRANCH='linux-4.4.y-clearfog'
KERNELBRANCH='branch:linux-4.4.y-clearfog'
KERNELDIR='linux-armada-modern'
;;
esac

View file

@ -1,13 +1,13 @@
BOOTSOURCE="https://github.com/UDOOboard/uboot-imx"
BOOTBRANCH="2015.04.imx-neo"
BOOTDIR="u-boot-neo"
BOOTSOURCE='https://github.com/UDOOboard/uboot-imx'
BOOTBRANCH='branch:2015.04.imx-neo'
BOOTDIR='u-boot-neo'
KERNELSOURCE='https://github.com/UDOOboard/linux_kernel'
#KERNELBRANCH="imx_3.14.28_1.0.0_ga_neo"
KERNELBRANCH="3.14-1.0.x-udoo"
#KERNELDIR="linux-udoo-neo"
KERNELDIR="linux-udoo"
#KERNELBRANCH='branch:imx_3.14.28_1.0.0_ga_neo'
KERNELBRANCH='branch:3.14-1.0.x-udoo'
#KERNELDIR='linux-udoo-neo'
KERNELDIR='linux-udoo'
CPUMIN=392000
CPUMAX=996000

View file

@ -1,22 +1,23 @@
BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
BOOTBRANCH='odroidc-v2011.03'
BOOTBRANCH='branch:odroidc-v2011.03'
BOOTDIR='u-boot-odroidc1'
UBOOT_NEEDS_GCC='< 4.9'
BOOTSIZE=32
KERNEL_NEEDS_GCC='< 4.9'
KERNEL_IMAGE_TYPE=uImage
case $BRANCH in
default)
KERNELSOURCE='https://github.com/hardkernel/linux'
KERNELBRANCH='odroidc-3.10.y'
KERNELBRANCH='branch:odroidc-3.10.y'
KERNELDIR='linux-odroidc1'
;;
next)
KERNELSOURCE='https://github.com/tobetter/linux'
KERNELBRANCH='odroidxu4-v4.2'
KERNELBRANCH='branch:odroidxu4-v4.2'
KERNELDIR='linux-odroidxu-next'
;;
esac

View file

@ -1,15 +1,16 @@
BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
BOOTBRANCH='odroidc2-v2015.01'
BOOTBRANCH='branch:odroidc2-v2015.01'
BOOTDIR='u-boot-odroidc2'
BOOTSIZE=64
UBOOT_NEEDS_GCC='< 5.0'
UBOOT_TARGET="ARCH=arm"
KERNELSOURCE='https://github.com/hardkernel/linux'
KERNELBRANCH='odroidc2-3.14.y'
KERNELBRANCH='branch:odroidc2-3.14.y'
KERNELDIR='linux-odroidc2'
ARCH=arm64
KERNEL_IMAGE_TYPE=Image
CPUMIN=500000
CPUMAX=2016000

View file

@ -1,6 +1,6 @@
BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
BOOTBRANCH='odroidxu3-v2012.07'
BOOTBRANCH='branch:odroidxu3-v2012.07'
BOOTDIR='u-boot-odroidxu'
BOOTSIZE=64
OFFSET=2
@ -9,7 +9,7 @@ UBOOT_NEEDS_GCC='< 4.9'
case $BRANCH in
default)
KERNELSOURCE='https://github.com/hardkernel/linux'
KERNELBRANCH='odroidxu3-3.10.y'
KERNELBRANCH='branch:odroidxu3-3.10.y'
KERNELDIR='linux-odroidxu4'
;;

View file

@ -1,23 +1,23 @@
BOOTSOURCE='https://github.com/zador-blood-stained/u-boot-pine64-armbian.git'
BOOTBRANCH=''
BOOTDIR='u-boot-pine64-armbian'
UBOOT_NEEDS_GCC='<4.9'
OFFSET=20
BOOTSIZE=64
case $BRANCH in
default)
BOOTBRANCH='branch:master'
KERNELSOURCE='https://github.com/longsleep/linux-pine64.git'
KERNELBRANCH='pine64-hacks-1.2'
KERNELBRANCH='branch:pine64-hacks-1.2'
KERNELDIR='linux-pine64'
GOVERNOR=interactive
OFFSET=20
BOOTSIZE=64
UBOOT_NEEDS_GCC='< 4.9'
;;
dev)
BOOTBRANCH='branch:next'
KERNELSOURCE='https://github.com/apritzel/linux.git'
KERNELBRANCH='a64-wip'
KERNELBRANCH='branch:a64-v5'
KERNELDIR='linux-pine64-dev'
GOVERNOR=ondemand
;;

View file

@ -1,33 +1,30 @@
BOOTSOURCE='https://github.com/LeMaker/u-boot-actions'
BOOTBRANCH='s500-master'
BOOTDIR='u-boot-s500'
UBOOT_TARGET="u-boot-dtb.img"
BOOTSIZE=32
OFFSET=16
KERNELSOURCE='https://github.com/LeMaker/linux-actions'
KERNELBRANCH='linux-3.10.y'
KERNELBRANCH='branch:linux-3.10.y'
KERNELDIR='linux-s500'
CPUMIN=408000
CPUMAX=1104000
GOVERNOR=interactive
case $BOARD in
guitar)
BOOTSOURCE='https://github.com/LeMaker/u-boot-actions'
BOOTBRANCH='branch:s500-master'
BOOTDIR='u-boot-s500'
UBOOT_FILES="$SRC/lib/bin/s500-bootloader-guitar.bin u-boot-dtb.img"
;;
roseapple)
UBOOT_FILES="$SRC/lib/bin/s500-bootloader-roseapple.bin u-boot-dtb.img"
BOOTSOURCE='https://github.com/xapp-le/u-boot'
BOOTBRANCH='merge-20160113'
BOOTDIR='u-boot-roseapple'
UBOOT_FILES="$SRC/lib/bin/s500-bootloader-roseapple.bin u-boot-dtb.img"
;;
esac

View file

@ -4,7 +4,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux-sunxi/linux-sunxi'
KERNELBRANCH='sunxi-3.4'
KERNELBRANCH='branch:sunxi-3.4'
KERNELDIR='linux-sunxi'
;;
@ -16,7 +16,7 @@ case $BRANCH in
dev)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELBRANCH=''
KERNELBRANCH='branch:master'
KERNELDIR=$MAINLINE_KERNEL_DIR
;;
esac

View file

@ -4,7 +4,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux-sunxi/linux-sunxi'
KERNELBRANCH='sunxi-3.4'
KERNELBRANCH='branch:sunxi-3.4'
KERNELDIR='linux-sunxi'
KERNEL_NEEDS_GCC='< 5.0'
;;
@ -17,7 +17,7 @@ case $BRANCH in
dev)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELBRANCH=''
KERNELBRANCH='branch:master'
KERNELDIR=$MAINLINE_KERNEL_DIR
;;
esac

View file

@ -4,7 +4,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux-sunxi/linux-sunxi'
KERNELBRANCH='sunxi-3.4'
KERNELBRANCH='branch:sunxi-3.4'
KERNELDIR='linux-sunxi'
;;
@ -16,7 +16,7 @@ case $BRANCH in
dev)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELBRANCH=''
KERNELBRANCH='branch:master'
KERNELDIR=$MAINLINE_KERNEL_DIR
;;
esac

View file

@ -4,7 +4,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux-sunxi/linux-sunxi'
KERNELBRANCH='sunxi-3.4'
KERNELBRANCH='branch:sunxi-3.4'
KERNELDIR='linux-sunxi'
CPUMAX=1010000
@ -20,7 +20,7 @@ case $BRANCH in
dev)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELBRANCH=''
KERNELBRANCH='branch:master'
KERNELDIR=$MAINLINE_KERNEL_DIR
CPUMAX=960000

View file

@ -4,13 +4,13 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/igorpecovnik/linux'
KERNELBRANCH='sun8i'
KERNELBRANCH='branch:sun8i'
KERNELDIR='linux-sun8i'
;;
dev)
KERNELSOURCE='https://github.com/megous/linux'
KERNELBRANCH='orange-pi-4.6'
KERNELBRANCH='branch:orange-pi-4.6'
KERNELDIR='linux-sun8i-mainline'
;;
esac

View file

@ -4,7 +4,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc"
case $BRANCH in
default)
KERNELSOURCE='https://github.com/linux-sunxi/linux-sunxi'
KERNELBRANCH='sunxi-3.4'
KERNELBRANCH='branch:sunxi-3.4'
KERNELDIR='linux-sunxi'
;;
@ -16,7 +16,7 @@ case $BRANCH in
dev)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELBRANCH=''
KERNELBRANCH='branch:master'
KERNELDIR=$MAINLINE_KERNEL_DIR
;;
esac

View file

@ -1,10 +1,10 @@
BOOTSOURCE='git://git.toradex.com/u-boot-toradex.git'
BOOTBRANCH='2015.04-toradex'
BOOTBRANCH='branch:2015.04-toradex'
BOOTDIR='u-boot-toradex'
KERNELSOURCE='git://git.toradex.com/linux-toradex.git'
KERNELBRANCH='toradex_imx_3.14.28_1.0.0_ga'
KERNELBRANCH='branch:toradex_imx_3.14.28_1.0.0_ga'
KERNELDIR='linux-toradex'
# CPUMIN=

View file

@ -1,18 +1,18 @@
BOOTSOURCE='https://github.com/UDOOboard/uboot-imx'
BOOTBRANCH='2015.10.fslc-qdl'
BOOTBRANCH='branch:2015.10.fslc-qdl'
BOOTDIR='u-boot-udoo'
case $BRANCH in
default)
KERNELSOURCE='https://github.com/UDOOboard/linux_kernel'
KERNELBRANCH='3.14-1.0.x-udoo'
KERNELBRANCH='branch:3.14-1.0.x-udoo'
KERNELDIR='linux-udoo'
;;
next)
KERNELSOURCE='https://github.com/patrykk/linux-udoo'
KERNELBRANCH='v4.4.0-6-vivante-5.0.11.p7.3'
KERNELBRANCH='branch:v4.4.0-6-vivante-5.0.11.p7.3'
KERNELDIR='linux-udoo-next'
;;
esac

View file

@ -34,13 +34,13 @@ else
fi
# allow upgrades for same major.minor versions
ARMBIAN_MAINLINE_KERNEL_VERSION="4.6"
MAINLINE_KERNEL_BRANCH=v$(wget -qO- https://www.kernel.org/finger_banner | awk '{print $NF}' | grep -oE "^${ARMBIAN_MAINLINE_KERNEL_VERSION//./\\.}\.?[[:digit:]]*")
MAINLINE_KERNEL_BRANCH=tag:v$(wget -qO- https://www.kernel.org/finger_banner | awk '{print $NF}' | grep -oE "^${ARMBIAN_MAINLINE_KERNEL_VERSION//./\\.}\.?[[:digit:]]*")
#MAINLINE_KERNEL_BRANCH="v$(wget -qO- https://www.kernel.org/finger_banner | grep "The latest st" | awk '{print $NF}' | head -1)"
MAINLINE_KERNEL_DIR="linux-vanilla"
MAINLINE_UBOOT_SOURCE='git://git.denx.de/u-boot.git'
#MAINLINE_UBOOT_BRANCH="v$(git ls-remote git://git.denx.de/u-boot.git | grep -v rc | grep -v '\^' | tail -1 | cut -d'v' -f 2)"
MAINLINE_UBOOT_BRANCH="v2016.07"
MAINLINE_UBOOT_BRANCH='tag:v2016.07'
MAINLINE_UBOOT_DIR='u-boot'
if [[ -f $SRC/lib/config/sources/$LINUXFAMILY.conf ]]; then

View file

@ -184,10 +184,11 @@ fi
# <ref>:
# branch:name
# tag:name
# HEAD*
# commit:hash@depth*
# head(*)
# commit:hash@depth(**)
#
# *: Work in progress
# *: Implies ref_subdir=no
# **: Not implemented yet
# <ref_subdir>: "yes" to create subdirectory for tag or branch name
#
fetch_from_repo()
@ -197,51 +198,55 @@ fetch_from_repo()
local ref=$3
local ref_subdir=$4
[[ -z $ref || ( $ref != tag:* && $ref != branch:* ) ]] && exit_with_error "Error in configuration"
[[ -z $ref || ( $ref != tag:* && $ref != branch:* && $ref != head ) ]] && exit_with_error "Error in configuration"
local ref_type=${ref%%:*}
local ref_name=${ref##*:}
if [[ $ref_type == head ]]; then
local ref_name=HEAD
else
local ref_name=${ref##*:}
fi
display_alert "Checking git sources" "$dir $ref_name" "info"
# get default remote branch name without cloning
# doesn't work with git:// remote URLs
# local ref_name=$(git ls-remote --symref $url HEAD | grep -o 'refs/heads/\S*' | sed 's%refs/heads/%%')
# for git:// protocol comparing hashes of "git ls-remote -h $url" and "git ls-remote --symref $url HEAD" is needed
if [[ $ref_subdir == yes ]]; then
mkdir -p $SOURCES/$dir/$ref_name
cd $SOURCES/$dir/$ref_name
local workdir=$dir/$ref_name
else
mkdir -p $SOURCES/$dir/
cd $SOURCES/$dir/
local workdir=$dir
fi
mkdir -p $SOURCES/$workdir
cd $SOURCES/$workdir
# this may not work if $SRC is a part of git repository
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) != true ]]; then
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) != true || \
$(git rev-parse --show-toplevel) != $(pwd) ]]; then
display_alert "Creating local copy"
git init -q .
git remote add origin $url
fi
local local_hash=$(git rev-parse @ 2>/dev/null)
local changed=false
local local_hash=$(git rev-parse @ 2>/dev/null)
case $ref_type in
branch)
local remote_hash=$(git ls-remote -h origin "$ref_name" | cut -f1)
[[ $local_hash != $remote_hash ]] && changed=true
local remote_hash=$(git ls-remote -h $url "$ref_name" | cut -f1)
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
;;
tag)
local remote_hash=$(git ls-remote -t origin "$ref_name" | cut -f1)
if [[ $local_hash != $remote_hash ]]; then
remote_hash=$(git ls-remote -t origin "$ref_name^{}" | cut -f1)
local remote_hash=$(git ls-remote -t $url "$ref_name" | cut -f1)
if [[ -z $local_hash || $local_hash != $remote_hash ]]; then
remote_hash=$(git ls-remote -t $url "$ref_name^{}" | cut -f1)
[[ -z $remote_hash || $local_hash != $remote_hash ]] && changed=true
fi
;;
head)
local remote_hash=$(git ls-remote origin HEAD | cut -f1)
[[ $local_hash != $remote_hash ]] && changed=true
local remote_hash=$(git ls-remote $url HEAD | cut -f1)
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
;;
esac
@ -255,7 +260,7 @@ fetch_from_repo()
esac
display_alert "Checking out"
git checkout -f -q FETCH_HEAD
elif [[ -n $(git status -uno --porcelain) ]]; then
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then
# working directory is not clean
if [[ $FORCE_CHECKOUT == yes ]]; then
display_alert "Checking out"
@ -268,8 +273,19 @@ fetch_from_repo()
display_alert "Up to date"
fi
if [[ -f .gitmodules ]]; then
display_alert "Updating submodules"
git submodule update --init --depth 1
display_alert "Updating submodules" "" "ext"
# FML: http://stackoverflow.com/a/17692710
for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
cd $SOURCES/$workdir
local surl=$(git config -f .gitmodules --get "submodule.$i.url")
local sref=$(git config -f .gitmodules --get "submodule.$i.branch")
if [[ -n $sref ]]; then
sref="branch:$sref"
else
sref="head"
fi
fetch_from_repo "$surl" "$workdir/$i" "$sref"
done
fi
} #############################################################################

12
main.sh
View file

@ -173,15 +173,15 @@ if [[ $SYNC_CLOCK != no ]]; then
fi
start=`date +%s`
# fetch_from_github [repository, sub directory]
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
[[ $CLEAN_LEVEL == *sources* ]] && cleaning "sources"
display_alert "source downloading" "@host" "info"
fetch_from_github "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
BOOTSOURCEDIR=$BOOTDIR/$GITHUBSUBDIR
fetch_from_github "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
LINUXSOURCEDIR=$KERNELDIR/$GITHUBSUBDIR
display_alert "Downloading sources" "" "info"
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
if [[ -n $MISC1 ]]; then fetch_from_github "$MISC1" "$MISC1_DIR"; fi
if [[ -n $MISC5 ]]; then fetch_from_github "$MISC5" "$MISC5_DIR"; fi