mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-15 19:31:42 +00:00
Split ATF compilation into a separate function
This commit is contained in:
parent
f0e47d15a6
commit
634110e787
9 changed files with 102 additions and 13 deletions
|
@ -7,6 +7,13 @@ case $BRANCH in
|
|||
default)
|
||||
# for backwards compatibility
|
||||
LINUXFAMILY=pine64
|
||||
|
||||
ATFSOURCE='https://github.com/longsleep/arm-trusted-firmware'
|
||||
ATFDIR='arm-trusted-firmware-sunxi-bsp'
|
||||
ATFBRANCH='branch:allwinner-a64-bsp'
|
||||
ATF_USE_GCC='> 6.0'
|
||||
ATF_TARGET_MAP='PLAT=sun50iw1p1 DEBUG=1 bl31;;build/sun50iw1p1/debug/bl31.bin'
|
||||
|
||||
BOOTSOURCE='https://github.com/armbian/u-boot-pine64-legacy.git'
|
||||
BOOTDIR='u-boot-pine64'
|
||||
BOOTBRANCH='branch:master'
|
||||
|
|
|
@ -9,6 +9,12 @@ case $BRANCH in
|
|||
;;
|
||||
|
||||
dev)
|
||||
ATFSOURCE='https://github.com/apritzel/arm-trusted-firmware'
|
||||
ATFDIR='arm-trusted-firmware-sunxi-mainline'
|
||||
ATFBRANCH='branch:allwinner-stable'
|
||||
ATF_USE_GCC='> 6.0'
|
||||
ATF_TARGET_MAP='PLAT=sun50iw1p1 DEBUG=1 bl31;;build/sun50iw1p1/debug/bl31.bin'
|
||||
|
||||
BOOTSOURCE='https://github.com/zador-blood-stained/u-boot-sun50i.git'
|
||||
BOOTDIR='u-boot-sun50i'
|
||||
BOOTBRANCH='branch:master'
|
||||
|
|
|
@ -200,7 +200,8 @@ for line in "${buildlist[@]}"; do
|
|||
CPUMIN CPUMAX UBOOT_VER KERNEL_VER GOVERNOR BOOTSIZE BOOTFS_TYPE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN PACKAGE_LIST_EXCLUDE KERNEL_IMAGE_TYPE \
|
||||
write_uboot_platform family_tweaks family_tweaks_bsp setup_write_uboot_platform BOOTSCRIPT UBOOT_TARGET_MAP LOCALVERSION UBOOT_COMPILER KERNEL_COMPILER \
|
||||
MODULES MODULES_NEXT MODULES_DEV INITRD_ARCH HAS_UUID_SUPPORT BOOTENV_FILE BOOTDELAY MODULES_BLACKLIST MODULES_BLACKLIST_NEXT \
|
||||
MODULES_BLACKLIST_DEV MOUNT SDCARD BOOTPATCHDIR KERNELPATCHDIR buildtext RELEASE IMAGE_TYPE OVERLAY_PREFIX ASOUND_STATE
|
||||
MODULES_BLACKLIST_DEV MOUNT SDCARD BOOTPATCHDIR KERNELPATCHDIR buildtext RELEASE IMAGE_TYPE OVERLAY_PREFIX ASOUND_STATE \
|
||||
ATF_COMPILER ATF_USE_GCC ATFSOURCE ATFDIR ATFBRANCH ATFSOURCEDIR
|
||||
|
||||
read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line
|
||||
n=$[$n+1]
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
# https://github.com/armbian/build/
|
||||
|
||||
# Functions:
|
||||
# compile_atf
|
||||
# compile_uboot
|
||||
# compile_kernel
|
||||
# compile_sunxi_tools
|
||||
|
@ -21,6 +22,66 @@
|
|||
# userpatch_create
|
||||
# overlayfs_wrapper
|
||||
|
||||
compile_atf()
|
||||
{
|
||||
if [[ $CLEAN_LEVEL == *make* ]]; then
|
||||
display_alert "Cleaning" "$ATFSOURCEDIR" "info"
|
||||
(cd $SRC/cache/sources/$ATFSOURCEDIR; make clean > /dev/null 2>&1)
|
||||
fi
|
||||
|
||||
if [[ $USE_OVERLAYFS == yes ]]; then
|
||||
local atfdir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$ATFSOURCEDIR" "atf_${LINUXFAMILY}_${BRANCH}")
|
||||
else
|
||||
local atfdir="$SRC/cache/sources/$ATFSOURCEDIR"
|
||||
fi
|
||||
cd "$atfdir"
|
||||
|
||||
display_alert "Compiling ATF" "" "info"
|
||||
|
||||
local toolchain=""
|
||||
if [[ -n $ATF_USE_GCC ]]; then
|
||||
toolchain=$(find_toolchain "$ATF_COMPILER" "$ATF_USE_GCC")
|
||||
[[ -z $toolchain ]] && exit_with_error "Could not find required toolchain" "${ATF_COMPILER}gcc $ATF_USE_GCC"
|
||||
fi
|
||||
|
||||
display_alert "Compiler version" "${ATF_COMPILER}gcc $(eval ${toolchain:+env PATH=$toolchain:$PATH} ${ATF_COMPILER}gcc -dumpversion)" "info"
|
||||
|
||||
local target_make=$(cut -d';' -f1 <<< $ATF_TARGET_MAP)
|
||||
local target_patchdir=$(cut -d';' -f2 <<< $ATF_TARGET_MAP)
|
||||
local target_files=$(cut -d';' -f3 <<< $ATF_TARGET_MAP)
|
||||
|
||||
[[ $FORCE_CHECKOUT == yes ]] && advanced_patch "atf" "atf-${LINUXFAMILY}" "$BOARD" "$target_patchdir" "$BRANCH" "${LINUXFAMILY}-${BOARD}-${BRANCH}"
|
||||
|
||||
# create patch for manual source changes
|
||||
[[ $CREATE_PATCHES == yes ]] && userpatch_create "atf"
|
||||
|
||||
eval CCACHE_BASEDIR="$(pwd)" ${toolchain:+env PATH=$toolchain:$PATH} \
|
||||
'make $target_make $CTHREADS CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>&1 \
|
||||
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
||||
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling ATF..." $TTY_Y $TTY_X'} \
|
||||
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
||||
|
||||
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "ATF compilation failed"
|
||||
|
||||
local atftempdir=$SRC/.tmp/atf-${LINUXFAMILY}-${BOARD}-${BRANCH}
|
||||
mkdir -p $atftempdir
|
||||
|
||||
# copy files to temp directory
|
||||
for f in $target_files; do
|
||||
local f_src=$(cut -d':' -f1 <<< $f)
|
||||
if [[ $f == *:* ]]; then
|
||||
local f_dst=$(cut -d':' -f2 <<< $f)
|
||||
else
|
||||
local f_dst=$(basename $f_src)
|
||||
fi
|
||||
[[ ! -f $f_src ]] && exit_with_error "ATF file not found" "$(basename $f_src)"
|
||||
cp $f_src $atftempdir/$f_dst
|
||||
done
|
||||
|
||||
# copy license file to pack it to u-boot package later
|
||||
[[ -f license.md ]] && cp license.md $atftempdir/
|
||||
}
|
||||
|
||||
compile_uboot()
|
||||
{
|
||||
# not optimal, but extra cleaning before overlayfs_wrapper should keep sources directory clean
|
||||
|
@ -73,6 +134,11 @@ compile_uboot()
|
|||
# create patch for manual source changes
|
||||
[[ $CREATE_PATCHES == yes ]] && userpatch_create "u-boot"
|
||||
|
||||
if [[ -n $ATFSOURCE ]]; then
|
||||
local atftempdir=$SRC/.tmp/atf-${LINUXFAMILY}-${BOARD}-${BRANCH}
|
||||
cp -Rv $atftempdir/*.bin .
|
||||
fi
|
||||
|
||||
eval CCACHE_BASEDIR="$(pwd)" ${toolchain:+env PATH=$toolchain:$PATH} \
|
||||
'make $CTHREADS $BOOTCONFIG CROSS_COMPILE="$CCACHE $UBOOT_COMPILER"' 2>&1 \
|
||||
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
||||
|
@ -150,11 +216,12 @@ compile_uboot()
|
|||
# copy license files from typical locations
|
||||
[[ -f COPYING ]] && cp COPYING $SRC/.tmp/$uboot_name/usr/lib/u-boot/LICENSE
|
||||
[[ -f Licenses/README ]] && cp Licenses/README $SRC/.tmp/$uboot_name/usr/lib/u-boot/LICENSE
|
||||
[[ -f arm-trusted-firmware/license.md ]] && cp arm-trusted-firmware/license.md $SRC/.tmp/$uboot_name/usr/lib/u-boot/LICENSE.atf
|
||||
[[ -n $atftempdir && -f $atftempdir/license.md ]] && cp $atftempdir/license.md $SRC/.tmp/$uboot_name/usr/lib/u-boot/LICENSE.atf
|
||||
|
||||
display_alert "Building deb" "${uboot_name}.deb" "info"
|
||||
(cd $SRC/.tmp/; eval 'dpkg -b $uboot_name 2>&1' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'})
|
||||
rm -rf $SRC/.tmp/$uboot_name
|
||||
[[ -n $$atftempdir ]] && rm -rf $atftempdir
|
||||
|
||||
[[ ! -f $SRC/.tmp/${uboot_name}.deb ]] && exit_with_error "Building u-boot package failed"
|
||||
|
||||
|
@ -304,7 +371,6 @@ compile_kernel()
|
|||
|
||||
compile_sunxi_tools()
|
||||
{
|
||||
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools.git" "sunxi-tools" "branch:master"
|
||||
# Compile and install only if git commit hash changed
|
||||
cd $SRC/cache/sources/sunxi-tools
|
||||
# need to check if /usr/local/bin/sunxi-fexc to detect new Docker containers with old cached sources
|
||||
|
@ -360,7 +426,7 @@ find_toolchain()
|
|||
# advanced_patch <dest> <family> <board> <target> <branch> <description>
|
||||
#
|
||||
# parameters:
|
||||
# <dest>: u-boot, kernel
|
||||
# <dest>: u-boot, kernel, atf
|
||||
# <family>: u-boot: u-boot, u-boot-neo; kernel: sun4i-default, sunxi-next, ...
|
||||
# <board>: cubieboard, cubieboard2, cubietruck, ...
|
||||
# <target>: optional subdirectory
|
||||
|
|
|
@ -81,6 +81,7 @@ case $ARCH in
|
|||
arm64)
|
||||
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER="aarch64-linux-gnu-"
|
||||
[[ -z $UBOOT_COMPILER ]] && UBOOT_COMPILER="aarch64-linux-gnu-"
|
||||
ATF_COMPILER="aarch64-linux-gnu-"
|
||||
[[ -z $INITRD_ARCH ]] && INITRD_ARCH=arm64
|
||||
QEMU_BINARY="qemu-aarch64-static"
|
||||
ARCHITECTURE=arm64
|
||||
|
|
|
@ -252,6 +252,11 @@ if [[ $IGNORE_UPDATES != yes ]]; then
|
|||
BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
|
||||
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
|
||||
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
|
||||
if [[ -n $ATFSOURCE ]]; then
|
||||
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
|
||||
ATFSOURCEDIR=$ATFDIR/${ATFBRANCH##*:}
|
||||
fi
|
||||
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master"
|
||||
fetch_from_repo "https://github.com/armbian/config" "armbian-config" "branch:dev"
|
||||
fi
|
||||
|
||||
|
@ -271,6 +276,9 @@ done
|
|||
|
||||
# Compile u-boot if packed .deb does not exist
|
||||
if [[ ! -f $DEST/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
|
||||
if [[ -n $ATFSOURCE ]]; then
|
||||
compile_atf
|
||||
fi
|
||||
compile_uboot
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff --git a/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c b/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
diff --git a/plat/sun50iw1p1/sunxi_power.c b/plat/sun50iw1p1/sunxi_power.c
|
||||
index 0c2487e..30708f4 100644
|
||||
--- a/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
+++ b/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
--- a/plat/sun50iw1p1/sunxi_power.c
|
||||
+++ b/plat/sun50iw1p1/sunxi_power.c
|
||||
@@ -258,12 +258,10 @@ static int pmic_setup(void)
|
||||
* changes. This should be further confined once we are able to
|
||||
* reliably detect a Pine64 board.
|
|
@ -1,7 +1,7 @@
|
|||
diff --git a/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c b/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
diff --git a/plat/sun50iw1p1/sunxi_power.c b/plat/sun50iw1p1/sunxi_power.c
|
||||
index 0c2487e..30708f4 100644
|
||||
--- a/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
+++ b/arm-trusted-firmware/plat/sun50iw1p1/sunxi_power.c
|
||||
--- a/plat/sun50iw1p1/sunxi_power.c
|
||||
+++ b/plat/sun50iw1p1/sunxi_power.c
|
||||
@@ -258,12 +258,10 @@ static int pmic_setup(void)
|
||||
* changes. This should be further confined once we are able to
|
||||
* reliably detect a Pine64 board.
|
|
@ -1,7 +1,7 @@
|
|||
diff --git a/arm-trusted-firmware/plat/sun50iw1p1/plat_pm.c b/arm-trusted-firmware/plat/sun50iw1p1/plat_pm.c
|
||||
diff --git a/plat/sun50iw1p1/plat_pm.c b/plat/sun50iw1p1/plat_pm.c
|
||||
index ec26248..ed53871 100644
|
||||
--- a/arm-trusted-firmware/plat/sun50iw1p1/plat_pm.c
|
||||
+++ b/arm-trusted-firmware/plat/sun50iw1p1/plat_pm.c
|
||||
--- a/plat/sun50iw1p1/plat_pm.c
|
||||
+++ b/plat/sun50iw1p1/plat_pm.c
|
||||
@@ -254,7 +254,59 @@ static int32_t sunxi_affinst_suspend_finish(uint64_t mpidr,
|
||||
******************************************************************************/
|
||||
static void __dead2 sunxi_system_off(void)
|
Loading…
Add table
Reference in a new issue