2016-04-25 19:00:37 +02:00
|
|
|
|
#!/bin/bash
|
2014-10-07 20:49:46 +02:00
|
|
|
|
#
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
|
#
|
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
|
#
|
|
|
|
|
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
2014-10-07 20:49:46 +02:00
|
|
|
|
#
|
|
|
|
|
|
2015-12-18 12:22:42 +03:00
|
|
|
|
# Functions:
|
|
|
|
|
# compile_uboot
|
|
|
|
|
# compile_sunxi_tools
|
|
|
|
|
# compile_kernel
|
2016-04-20 15:38:09 +03:00
|
|
|
|
# check_toolchain
|
|
|
|
|
# find_toolchain
|
2016-04-18 18:21:43 +03:00
|
|
|
|
# advanced_patch
|
|
|
|
|
# process_patch_file
|
2015-12-18 12:22:42 +03:00
|
|
|
|
# install_external_applications
|
2015-12-25 20:04:33 +03:00
|
|
|
|
# write_uboot
|
2016-03-19 17:26:15 +03:00
|
|
|
|
# customize_image
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
|
compile_uboot (){
|
2015-12-09 09:14:39 +01:00
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# Compile uboot from sources
|
2015-12-09 09:14:39 +01:00
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ ! -d $SOURCES/$BOOTSOURCEDIR ]]; then
|
2016-03-05 21:26:01 +03:00
|
|
|
|
exit_with_error "Error building u-boot: source directory does not exist" "$BOOTSOURCEDIR"
|
|
|
|
|
fi
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2015-12-08 19:25:30 +01:00
|
|
|
|
display_alert "Compiling uboot. Please wait." "$VER" "info"
|
2016-04-08 13:39:08 +03:00
|
|
|
|
eval ${UBOOT_TOOLCHAIN:+env PATH=$UBOOT_TOOLCHAIN:$PATH} ${CROSS_COMPILE}gcc --version | head -1 | tee -a $DEST/debug/install.log
|
2016-04-08 00:38:59 +03:00
|
|
|
|
echo
|
2015-12-08 19:25:30 +01:00
|
|
|
|
cd $SOURCES/$BOOTSOURCEDIR
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2016-04-08 00:38:59 +03:00
|
|
|
|
local cthreads=$CTHREADS
|
2016-04-20 15:38:09 +03:00
|
|
|
|
[[ $LINUXFAMILY == marvell ]] && local MAKEPARA="u-boot.mmc"
|
|
|
|
|
[[ $BOARD == odroidc2 ]] && local MAKEPARA="ARCH=arm" && local cthreads=""
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2016-04-08 00:38:59 +03:00
|
|
|
|
eval ${UBOOT_TOOLCHAIN:+env PATH=$UBOOT_TOOLCHAIN:$PATH} 'make $CTHREADS $BOOTCONFIG CROSS_COMPILE="$CROSS_COMPILE"' 2>&1 \
|
|
|
|
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
|
|
|
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
|
|
|
|
|
2016-04-23 19:06:39 +03:00
|
|
|
|
[[ -f .config ]] && sed -i 's/CONFIG_LOCALVERSION=""/CONFIG_LOCALVERSION="-armbian"/g' .config
|
|
|
|
|
[[ -f .config ]] && sed -i 's/CONFIG_LOCALVERSION_AUTO=.*/# CONFIG_LOCALVERSION_AUTO is not set/g' .config
|
|
|
|
|
[[ -f $SOURCES/$BOOTSOURCEDIR/tools/logos/udoo.bmp ]] && cp $SRC/lib/bin/armbian-u-boot.bmp $SOURCES/$BOOTSOURCEDIR/tools/logos/udoo.bmp
|
2016-04-08 00:38:59 +03:00
|
|
|
|
touch .scmversion
|
2016-03-27 16:50:05 +02:00
|
|
|
|
|
2016-04-08 00:38:59 +03:00
|
|
|
|
# patch mainline uboot configuration to boot with old kernels
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ $BRANCH == default && $LINUXFAMILY == sun*i ]] ; then
|
|
|
|
|
if ! grep -q "CONFIG_ARMV7_BOOT_SEC_DEFAULT=y" .config ; then
|
|
|
|
|
echo -e "CONFIG_ARMV7_BOOT_SEC_DEFAULT=y\nCONFIG_OLD_SUNXI_KERNEL_COMPAT=y" >> .config
|
2016-03-17 20:16:26 +01:00
|
|
|
|
fi
|
2016-04-08 00:38:59 +03:00
|
|
|
|
fi
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2016-04-08 00:38:59 +03:00
|
|
|
|
eval ${UBOOT_TOOLCHAIN:+env PATH=$UBOOT_TOOLCHAIN:$PATH} 'make $MAKEPARA $cthreads CROSS_COMPILE="$CROSS_COMPILE"' 2>&1 \
|
2015-12-09 18:02:04 +03:00
|
|
|
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
2016-03-07 18:29:48 +01:00
|
|
|
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling u-boot..." $TTY_Y $TTY_X'} \
|
2015-12-09 18:02:04 +03:00
|
|
|
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2015-12-09 09:54:58 +01:00
|
|
|
|
# create .deb package
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2016-03-23 20:58:58 +01:00
|
|
|
|
local uboot_name=${CHOSEN_UBOOT}_${REVISION}_${ARCH}
|
2016-03-14 21:54:03 +03:00
|
|
|
|
|
|
|
|
|
mkdir -p $DEST/debs/$uboot_name/usr/lib/$uboot_name $DEST/debs/$uboot_name/DEBIAN
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# set up post install script
|
2016-03-14 21:54:03 +03:00
|
|
|
|
cat <<END > $DEST/debs/$uboot_name/DEBIAN/postinst
|
2015-12-02 20:33:32 +01:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
set -e
|
2016-03-27 22:24:51 +02:00
|
|
|
|
if [[ \$DEVICE == "/dev/null" ]]; then exit 0; fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
if [[ \$DEVICE == "" ]]; then DEVICE="/dev/mmcblk0"; fi
|
2016-03-17 20:16:26 +01:00
|
|
|
|
if [[ \$DPKG_MAINTSCRIPT_PACKAGE == *cubox* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/SPL of=\$DEVICE bs=512 seek=2 status=noxfer ) > /dev/null 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=42 status=noxfer ) > /dev/null 2>&1
|
2016-04-22 21:19:31 +02:00
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *guitar* || \$DPKG_MAINTSCRIPT_PACKAGE == roseapple* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/bootloader.bin of=\$DEVICE bs=512 seek=4097 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot-dtb.bin of=\$DEVICE bs=512 seek=6144 conv=fsync ) > /dev/null 2>&1
|
2016-03-22 10:42:47 +01:00
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *odroidxu4* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE seek=1 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl2.bin.hardkernel of=\$DEVICE seek=31 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.bin of=\$DEVICE bs=512 seek=63 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/tzsw.bin.hardkernel of=\$DEVICE seek=719 conv=fsync ) > /dev/null 2>&1
|
2015-12-10 11:41:14 +01:00
|
|
|
|
( dd if=/dev/zero of=\$DEVICE seek=1231 count=32 bs=512 conv=fsync ) > /dev/null 2>&1
|
2016-03-22 10:42:47 +01:00
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *odroidc1* ]] ; then
|
2016-03-28 20:04:01 +02:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE bs=1 count=442 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE bs=512 skip=1 seek=1 conv=fsync ) > /dev/null 2>&1
|
2016-03-22 10:42:47 +01:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.bin of=\$DEVICE bs=512 seek=64 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/dev/zero of=\$DEVICE seek=1024 count=32 bs=512 conv=fsync ) > /dev/null 2>&1
|
2016-03-23 06:41:01 +01:00
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *odroidc2* ]] ; then
|
2016-03-24 11:01:18 +01:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE bs=1 count=442 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE bs=512 skip=1 seek=1 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.bin of=\$DEVICE bs=512 seek=97 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/dev/zero of=\$DEVICE seek=1249 count=799 bs=512 conv=fsync ) > /dev/null 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *udoo* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/SPL of=\$DEVICE bs=1k seek=1 status=noxfer ) > /dev/null 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=69 status=noxfer ) > /dev/null 2>&1
|
|
|
|
|
elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *armada* ]] ; then
|
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot.mmc of=\$DEVICE bs=512 seek=1 status=noxfer ) > /dev/null 2>&1
|
|
|
|
|
else
|
2016-03-22 20:55:39 +01:00
|
|
|
|
( dd if=/dev/zero of=\$DEVICE bs=1k count=1023 seek=1 status=noxfer ) > /dev/null 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
( dd if=/usr/lib/$uboot_name/u-boot-sunxi-with-spl.bin of=\$DEVICE bs=1024 seek=8 status=noxfer ) > /dev/null 2>&1
|
2015-12-02 20:33:32 +01:00
|
|
|
|
fi
|
|
|
|
|
exit 0
|
|
|
|
|
END
|
2015-12-09 09:54:58 +01:00
|
|
|
|
#
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2016-03-14 21:54:03 +03:00
|
|
|
|
chmod 755 $DEST/debs/$uboot_name/DEBIAN/postinst
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# set up control file
|
2016-03-14 21:54:03 +03:00
|
|
|
|
cat <<END > $DEST/debs/$uboot_name/DEBIAN/control
|
|
|
|
|
Package: linux-u-boot-${BOARD}-${BRANCH}
|
2015-12-02 20:33:32 +01:00
|
|
|
|
Version: $REVISION
|
2016-03-23 21:19:21 +01:00
|
|
|
|
Architecture: $ARCH
|
2015-12-02 20:33:32 +01:00
|
|
|
|
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
|
|
|
|
|
Installed-Size: 1
|
|
|
|
|
Section: kernel
|
|
|
|
|
Priority: optional
|
2015-12-08 19:25:30 +01:00
|
|
|
|
Description: Uboot loader $VER
|
2015-12-02 20:33:32 +01:00
|
|
|
|
END
|
|
|
|
|
#
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2015-12-09 09:54:58 +01:00
|
|
|
|
# copy proper uboot files to place
|
|
|
|
|
if [[ $BOARD == cubox-i* ]] ; then
|
2016-03-17 20:16:26 +01:00
|
|
|
|
[ ! -f "SPL" ] || cp SPL u-boot.img $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-04-22 21:19:31 +02:00
|
|
|
|
elif [[ $BOARD == guitar* || $BOARD == roseapple* ]] ; then
|
2016-03-17 20:16:26 +01:00
|
|
|
|
[ ! -f "u-boot-dtb.bin" ] || cp u-boot-dtb.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-03-14 21:54:03 +03:00
|
|
|
|
[ ! -f "$SRC/lib/bin/s500-bootloader.bin" ] || cp $SRC/lib/bin/s500-bootloader.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name/bootloader.bin
|
2016-03-22 10:42:47 +01:00
|
|
|
|
elif [[ $BOARD == odroidxu4 ]] ; then
|
2016-03-17 20:16:26 +01:00
|
|
|
|
[ ! -f "sd_fuse/hardkernel/bl1.bin.hardkernel" ] || cp sd_fuse/hardkernel/bl1.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-03-14 21:54:03 +03:00
|
|
|
|
[ ! -f "sd_fuse/hardkernel/bl2.bin.hardkernel" ] || cp sd_fuse/hardkernel/bl2.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
|
|
|
|
[ ! -f "sd_fuse/hardkernel/tzsw.bin.hardkernel" ] || cp sd_fuse/hardkernel/tzsw.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
|
|
|
|
[ ! -f "u-boot.bin" ] || cp u-boot.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name/
|
2016-03-22 10:42:47 +01:00
|
|
|
|
elif [[ $BOARD == odroidc1 ]] ; then
|
2016-04-23 19:06:39 +03:00
|
|
|
|
[ ! -f "sd_fuse/bl1.bin.hardkernel" ] || cp sd_fuse/bl1.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-03-23 06:41:01 +01:00
|
|
|
|
[ ! -f "sd_fuse/u-boot.bin" ] || cp sd_fuse/u-boot.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
|
|
|
|
elif [[ $BOARD == odroidc2 ]] ; then
|
2016-04-23 19:06:39 +03:00
|
|
|
|
[ ! -f "sd_fuse/bl1.bin.hardkernel" ] || cp sd_fuse/bl1.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-03-31 07:20:31 +02:00
|
|
|
|
[ ! -f "sd_fuse/u-boot.bin" ] || cp sd_fuse/u-boot.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2015-12-09 09:54:58 +01:00
|
|
|
|
elif [[ $BOARD == udoo* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
[ ! -f "u-boot.img" ] || cp SPL u-boot.img $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2016-01-08 19:50:53 +01:00
|
|
|
|
elif [[ $BOARD == armada* ]] ; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
[ ! -f "u-boot.mmc" ] || cp u-boot.mmc $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2015-12-09 09:54:58 +01:00
|
|
|
|
else
|
2016-03-17 20:16:26 +01:00
|
|
|
|
[ ! -f "u-boot-sunxi-with-spl.bin" ] || cp u-boot-sunxi-with-spl.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name
|
2015-12-09 09:54:58 +01:00
|
|
|
|
fi
|
2014-10-13 19:17:37 +02:00
|
|
|
|
|
2015-12-09 09:54:58 +01:00
|
|
|
|
cd $DEST/debs
|
|
|
|
|
display_alert "Target directory" "$DEST/debs/" "info"
|
2016-03-14 21:54:03 +03:00
|
|
|
|
display_alert "Building deb" "$uboot_name.deb" "info"
|
|
|
|
|
dpkg -b $uboot_name > /dev/null
|
|
|
|
|
rm -rf $uboot_name
|
2014-10-24 18:56:18 +02:00
|
|
|
|
|
2016-03-14 21:54:03 +03:00
|
|
|
|
FILESIZE=$(wc -c $DEST/debs/$uboot_name.deb | cut -f 1 -d ' ')
|
2015-12-09 09:54:58 +01:00
|
|
|
|
|
2016-02-15 13:53:35 +03:00
|
|
|
|
if [[ $FILESIZE -lt 50000 ]]; then
|
2016-03-14 21:54:03 +03:00
|
|
|
|
rm $DEST/debs/$uboot_name.deb
|
2016-03-06 13:01:05 +03:00
|
|
|
|
exit_with_error "Building u-boot failed, check configuration"
|
2015-12-09 09:54:58 +01:00
|
|
|
|
fi
|
2014-10-07 20:49:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
|
compile_sunxi_tools (){
|
2015-12-09 08:51:19 +01:00
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
# https://github.com/linux-sunxi/sunxi-tools Tools to help hacking Allwinner devices
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
display_alert "Compiling sunxi tools" "@host & target" "info"
|
|
|
|
|
cd $SOURCES/$MISC1_DIR
|
|
|
|
|
make -s clean >/dev/null 2>&1
|
2016-02-26 13:08:22 +01:00
|
|
|
|
rm -f sunxi-fexc sunxi-nand-part
|
2015-12-09 08:51:19 +01:00
|
|
|
|
make -s >/dev/null 2>&1
|
|
|
|
|
cp fex2bin bin2fex /usr/local/bin/
|
2016-02-26 14:19:32 +01:00
|
|
|
|
# make -s clean >/dev/null 2>&1
|
|
|
|
|
# rm -f sunxi-fexc sunxi-nand-part meminfo sunxi-fel sunxi-pio 2>/dev/null
|
2016-04-08 00:38:59 +03:00
|
|
|
|
# NOTE: Fix CC=$CROSS_COMPILE"gcc" before reenabling
|
2016-03-23 19:00:45 +01:00
|
|
|
|
# make $CTHREADS 'sunxi-nand-part' CC=$CROSS_COMPILE"gcc" >> $DEST/debug/install.log 2>&1
|
|
|
|
|
# make $CTHREADS 'sunxi-fexc' CC=$CROSS_COMPILE"gcc" >> $DEST/debug/install.log 2>&1
|
|
|
|
|
# make $CTHREADS 'meminfo' CC=$CROSS_COMPILE"gcc" >> $DEST/debug/install.log 2>&1
|
2015-12-09 08:51:19 +01:00
|
|
|
|
|
2014-10-07 20:49:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
|
compile_kernel (){
|
2015-12-09 14:39:27 +01:00
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# Compile kernel
|
2015-12-09 14:39:27 +01:00
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ ! -d $SOURCES/$LINUXSOURCEDIR ]]; then
|
2016-03-05 21:26:01 +03:00
|
|
|
|
exit_with_error "Error building kernel: source directory does not exist" "$LINUXSOURCEDIR"
|
|
|
|
|
fi
|
2016-03-17 20:16:26 +01:00
|
|
|
|
|
2015-12-09 14:39:27 +01:00
|
|
|
|
# read kernel version to variable $VER
|
2016-04-18 18:21:43 +03:00
|
|
|
|
grab_version "$SOURCES/$LINUXSOURCEDIR" "VER"
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2015-12-10 11:41:14 +01:00
|
|
|
|
display_alert "Compiling $BRANCH kernel" "@host" "info"
|
2016-04-08 13:39:08 +03:00
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} ${CROSS_COMPILE}gcc --version | head -1 | tee -a $DEST/debug/install.log
|
2016-04-08 00:38:59 +03:00
|
|
|
|
echo
|
2015-12-09 14:39:27 +01:00
|
|
|
|
cd $SOURCES/$LINUXSOURCEDIR/
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2015-12-09 14:39:27 +01:00
|
|
|
|
# adding custom firmware to kernel source
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ -n $FIRMWARE ]]; then unzip -o $SRC/lib/$FIRMWARE -d $SOURCES/$LINUXSOURCEDIR/firmware; fi
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2015-12-09 14:39:27 +01:00
|
|
|
|
# use proven config
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ $KERNEL_KEEP_CONFIG != yes || ! -f $SOURCES/$LINUXSOURCEDIR/.config ]]; then
|
|
|
|
|
if [[ -f $SRC/userpatches/$LINUXCONFIG.config ]]; then
|
2015-12-27 17:02:03 +03:00
|
|
|
|
display_alert "Using kernel config provided by user" "userpatches/$LINUXCONFIG.config" "info"
|
|
|
|
|
cp $SRC/userpatches/$LINUXCONFIG.config $SOURCES/$LINUXSOURCEDIR/.config
|
|
|
|
|
else
|
2016-04-25 19:00:37 +02:00
|
|
|
|
display_alert "Using kernel config file" "lib/config/kernel/$LINUXCONFIG.config" "info"
|
|
|
|
|
cp $SRC/lib/config/kernel/$LINUXCONFIG.config $SOURCES/$LINUXSOURCEDIR/.config
|
2015-12-27 17:02:03 +03:00
|
|
|
|
fi
|
2015-12-09 14:39:27 +01:00
|
|
|
|
fi
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2015-12-09 14:39:27 +01:00
|
|
|
|
# hack for deb builder. To pack what's missing in headers pack.
|
|
|
|
|
cp $SRC/lib/patch/misc/headers-debian-byteshift.patch /tmp
|
2014-12-17 20:10:02 +01:00
|
|
|
|
|
2016-04-19 13:04:53 +03:00
|
|
|
|
export LOCALVERSION="-$LINUXFAMILY"
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2016-03-17 20:16:26 +01:00
|
|
|
|
# We can use multi threading here but not later since it's not working. This way of compilation is much faster.
|
2016-04-20 15:38:09 +03:00
|
|
|
|
if [[ $KERNEL_CONFIGURE != yes ]]; then
|
|
|
|
|
if [[ $BRANCH == default ]]; then
|
2016-04-08 00:38:59 +03:00
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CROSS_COMPILE" silentoldconfig'
|
2015-12-09 14:39:27 +01:00
|
|
|
|
else
|
2016-04-08 00:38:59 +03:00
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CROSS_COMPILE" olddefconfig'
|
2015-12-09 14:39:27 +01:00
|
|
|
|
fi
|
2015-12-08 17:09:13 +03:00
|
|
|
|
else
|
2016-04-08 00:38:59 +03:00
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CROSS_COMPILE" oldconfig'
|
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CROSS_COMPILE" menuconfig'
|
2015-12-08 17:09:13 +03:00
|
|
|
|
fi
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2016-04-24 17:51:19 +03:00
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CROSS_COMPILE" $KERNEL_IMAGE_TYPE modules dtbs 2>&1' \
|
2016-03-05 21:26:01 +03:00
|
|
|
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
2016-03-07 18:29:48 +01:00
|
|
|
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling kernel..." $TTY_Y $TTY_X'} \
|
2016-03-05 21:26:01 +03:00
|
|
|
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
2014-12-11 19:41:07 +01:00
|
|
|
|
|
2016-04-24 17:51:19 +03:00
|
|
|
|
if [[ ${PIPESTATUS[0]} -ne 0 || ! -f arch/$ARCHITECTURE/boot/$KERNEL_IMAGE_TYPE ]]; then
|
2016-04-23 19:06:39 +03:00
|
|
|
|
exit_with_error "Kernel was not built" "@host"
|
2016-03-05 21:26:01 +03:00
|
|
|
|
fi
|
2014-11-17 16:20:02 +01:00
|
|
|
|
|
2016-03-05 21:26:01 +03:00
|
|
|
|
# different packaging for 4.3+ // probably temporaly soution
|
|
|
|
|
KERNEL_PACKING="deb-pkg"
|
|
|
|
|
IFS='.' read -a array <<< "$VER"
|
|
|
|
|
if (( "${array[0]}" == "4" )) && (( "${array[1]}" >= "3" )); then
|
|
|
|
|
KERNEL_PACKING="bindeb-pkg"
|
|
|
|
|
fi
|
|
|
|
|
|
2016-04-08 00:38:59 +03:00
|
|
|
|
# produce deb packages: image, headers, firmware, dtb
|
|
|
|
|
eval ${KERNEL_TOOLCHAIN:+env PATH=$KERNEL_TOOLCHAIN:$PATH} 'make -j1 $KERNEL_PACKING KDEB_PKGVERSION=$REVISION LOCALVERSION="-"$LINUXFAMILY \
|
|
|
|
|
KBUILD_DEBARCH=$ARCH ARCH=$ARCHITECTURE DEBFULLNAME="$MAINTAINER" DEBEMAIL="$MAINTAINERMAIL" CROSS_COMPILE="$CROSS_COMPILE" 2>&1 ' \
|
2016-03-05 21:26:01 +03:00
|
|
|
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \
|
2016-03-07 18:29:48 +01:00
|
|
|
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Creating kernel packages..." $TTY_Y $TTY_X'} \
|
2016-03-05 21:26:01 +03:00
|
|
|
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
|
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
mv *.deb $DEST/debs/ || exit_with_error "Failed moving kernel DEBs"
|
2014-10-07 20:49:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 15:38:09 +03:00
|
|
|
|
# check_toolchain <expression> <path>
|
|
|
|
|
#
|
|
|
|
|
# checks if system default toolchain version satisfies <expression>
|
|
|
|
|
# <expression>: "< x.y"; "> x.y"; "== x.y"
|
|
|
|
|
check_toolchain()
|
|
|
|
|
{
|
|
|
|
|
local expression=$1
|
|
|
|
|
local path=$2
|
|
|
|
|
# get major.minor gcc version
|
|
|
|
|
local gcc_ver=$(${COMPILER}gcc -dumpversion | grep -oE "^[[:digit:]].[[:digit:]]")
|
|
|
|
|
awk "BEGIN{exit ! ($gcc_ver $expression)}" && return 0
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# find_toolchain <expression> <var_name>
|
|
|
|
|
#
|
|
|
|
|
# writes path to toolchain that satisfies <expression> to <var_name>
|
|
|
|
|
#
|
|
|
|
|
find_toolchain()
|
|
|
|
|
{
|
|
|
|
|
local expression=$1
|
|
|
|
|
local var_name=$2
|
|
|
|
|
local dist=10
|
|
|
|
|
local toolchain=""
|
|
|
|
|
for dir in $SRC/toolchains/*/; do
|
|
|
|
|
# check if is a toolchain for current $ARCH
|
|
|
|
|
[[ ! -f ${dir}bin/${COMPILER}gcc ]] && continue
|
|
|
|
|
# get toolchain major.minor version
|
|
|
|
|
local gcc_ver=$(${dir}bin/${COMPILER}gcc -dumpversion | grep -oE "^[[:digit:]].[[:digit:]]")
|
|
|
|
|
# check if toolchain version satisfies requirement
|
|
|
|
|
awk "BEGIN{exit ! ($gcc_ver $expression)}" || continue
|
|
|
|
|
# extract target major.minor version from expression
|
|
|
|
|
local target_ver=$(grep -oE "[[:digit:]].[[:digit:]]" <<< "$expression")
|
|
|
|
|
# check if found version is the closest to target
|
|
|
|
|
local d=$(awk '{x = $1 - $2}{printf "%.1f\n", (x > 0) ? x : -x}' <<< "$target_ver $gcc_ver")
|
|
|
|
|
if awk "BEGIN{exit ! ($d < $dist)}" ; then
|
|
|
|
|
dist=$d
|
|
|
|
|
toolchain=${dir}bin
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
eval $"$var_name"="$toolchain"
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
|
# advanced_patch <dest> <family> <device> <description>
|
|
|
|
|
#
|
|
|
|
|
# parameters:
|
|
|
|
|
# <dest>: u-boot, kernel
|
|
|
|
|
# <family>: u-boot: u-boot, u-boot-neo; kernel: sun4i-default, sunxi-next, ...
|
|
|
|
|
# <device>: cubieboard, cubieboard2, cubietruck, ...
|
|
|
|
|
# <description>: additional description text
|
|
|
|
|
#
|
|
|
|
|
# priority:
|
|
|
|
|
# $SRC/userpatches/<dest>/<family>/<device>
|
|
|
|
|
# $SRC/userpatches/<dest>/<family>
|
|
|
|
|
# $SRC/lib/patch/<dest>/<family>/<device>
|
|
|
|
|
# $SRC/lib/patch/<dest>/<family>
|
|
|
|
|
#
|
|
|
|
|
advanced_patch () {
|
|
|
|
|
|
|
|
|
|
local dest=$1
|
|
|
|
|
local family=$2
|
|
|
|
|
local device=$3
|
|
|
|
|
local description=$4
|
|
|
|
|
|
|
|
|
|
display_alert "Started patching process for" "$dest $description" "info"
|
|
|
|
|
display_alert "Looking for user patches in" "userpatches/$dest/$family" "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")
|
|
|
|
|
|
|
|
|
|
# required for "for" command
|
|
|
|
|
shopt -s nullglob dotglob
|
|
|
|
|
# get patch file names
|
|
|
|
|
for dir in "${dirs[@]}"; do
|
|
|
|
|
for patch in $dir/*.patch; do
|
|
|
|
|
names+=($(basename $patch))
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
# remove duplicates
|
|
|
|
|
local names_s=($(echo "${names[@]}" | tr ' ' '\n' | LC_ALL=C sort -u | tr '\n' ' '))
|
|
|
|
|
# apply patches
|
|
|
|
|
for name in "${names_s[@]}"; do
|
|
|
|
|
for dir in "${dirs[@]}"; do
|
|
|
|
|
if [[ -f $dir/$name || -L $dir/$name ]]; then
|
|
|
|
|
if [[ -s $dir/$name ]]; then
|
|
|
|
|
process_patch_file "$dir/$name" "$description"
|
|
|
|
|
else
|
|
|
|
|
display_alert "... $name" "skipped" "info"
|
|
|
|
|
fi
|
|
|
|
|
break # next name
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# process_patch_file <file> <description>
|
|
|
|
|
#
|
|
|
|
|
# parameters:
|
|
|
|
|
# <file>: path to patch file
|
|
|
|
|
# <description>: additional description text
|
|
|
|
|
#
|
|
|
|
|
process_patch_file() {
|
|
|
|
|
|
|
|
|
|
local patch=$1
|
|
|
|
|
local description=$2
|
|
|
|
|
|
|
|
|
|
# detect and remove files which patch will create
|
|
|
|
|
LANGUAGE=english patch --batch --dry-run -p1 -N < $patch | grep create \
|
|
|
|
|
| awk '{print $NF}' | sed -n 's/,//p' | xargs -I % sh -c 'rm %'
|
|
|
|
|
|
|
|
|
|
# main patch command
|
|
|
|
|
echo "$patch $description" >> $DEST/debug/install.log
|
|
|
|
|
patch --batch --silent -p1 -N < $patch >> $DEST/debug/install.log 2>&1
|
|
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
display_alert "... $(basename $patch)" "failed" "wrn";
|
|
|
|
|
if [[ $EXIT_PATCHING_ERROR == "yes" ]]; then exit_with_error "Aborting due to" "EXIT_PATCHING_ERROR"; fi
|
|
|
|
|
else
|
|
|
|
|
display_alert "... $(basename $patch)" "succeeded" "info"
|
|
|
|
|
fi
|
|
|
|
|
}
|
2014-10-07 20:49:46 +02:00
|
|
|
|
|
2016-04-08 16:36:56 +03:00
|
|
|
|
install_external_applications ()
|
|
|
|
|
{
|
2014-10-08 09:53:25 +02:00
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2015-12-02 20:33:32 +01:00
|
|
|
|
# Install external applications example
|
2014-10-08 09:53:25 +02:00
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-04-08 16:56:20 +03:00
|
|
|
|
display_alert "Installing extra applications and drivers" "" "info"
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
2016-04-16 20:57:38 +02:00
|
|
|
|
# cleanup for install_kernel and install_board_specific
|
|
|
|
|
umount $CACHEDIR/sdcard/tmp >/dev/null 2>&1
|
|
|
|
|
|
2016-04-08 16:36:56 +03:00
|
|
|
|
for plugin in $SRC/lib/extras/*.sh; do
|
|
|
|
|
source $plugin
|
|
|
|
|
done
|
2016-02-26 17:20:03 +01:00
|
|
|
|
|
|
|
|
|
# MISC5 = sunxi display control
|
2016-04-23 19:06:39 +03:00
|
|
|
|
if [[ -n $MISC5_DIR && $BRANCH != next && $LINUXSOURCEDIR == *sunxi* ]]; then
|
2016-02-26 20:22:13 +01:00
|
|
|
|
cd "$SOURCES/$MISC5_DIR"
|
|
|
|
|
cp "$SOURCES/$LINUXSOURCEDIR/include/video/sunxi_disp_ioctl.h" .
|
2016-04-08 16:36:56 +03:00
|
|
|
|
make clean >/dev/null
|
|
|
|
|
make ARCH=$ARCHITECTURE CC="${CROSS_COMPILE}gcc" KSRC="$SOURCES/$LINUXSOURCEDIR/" >> $DEST/debug/compilation.log 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
install -m 755 a10disp "$CACHEDIR/sdcard/usr/local/bin"
|
2016-02-26 20:22:13 +01:00
|
|
|
|
fi
|
2016-04-08 16:36:56 +03:00
|
|
|
|
|
2016-02-26 20:22:13 +01:00
|
|
|
|
# MISC5 = sunxi display control / compile it for sun8i just in case sun7i stuff gets ported to sun8i and we're able to use it
|
2016-04-23 19:06:39 +03:00
|
|
|
|
if [[ -n $MISC5_DIR && $BRANCH != next && $LINUXSOURCEDIR == *sun8i* ]]; then
|
2016-02-26 20:22:13 +01:00
|
|
|
|
cd "$SOURCES/$MISC5_DIR"
|
|
|
|
|
wget -q "https://raw.githubusercontent.com/linux-sunxi/linux-sunxi/sunxi-3.4/include/video/sunxi_disp_ioctl.h"
|
2015-12-02 20:33:32 +01:00
|
|
|
|
make clean >/dev/null 2>&1
|
2016-04-08 16:36:56 +03:00
|
|
|
|
make ARCH=$ARCHITECTURE CC="${CROSS_COMPILE}gcc" KSRC="$SOURCES/$LINUXSOURCEDIR/" >> $DEST/debug/compilation.log 2>&1
|
2016-03-17 20:16:26 +01:00
|
|
|
|
install -m 755 a10disp "$CACHEDIR/sdcard/usr/local/bin"
|
2014-10-07 20:49:46 +02:00
|
|
|
|
fi
|
2016-02-20 13:49:19 +02:00
|
|
|
|
|
2016-04-06 20:16:12 +02:00
|
|
|
|
# h3disp/sun8i-corekeeper.sh for sun8i/3.4.x
|
2016-04-23 19:06:39 +03:00
|
|
|
|
if [[ $LINUXFAMILY == sun8i && $BRANCH == default ]]; then
|
2016-03-17 20:16:26 +01:00
|
|
|
|
install -m 755 "$SRC/lib/scripts/h3disp" "$CACHEDIR/sdcard/usr/local/bin"
|
2016-04-06 20:16:12 +02:00
|
|
|
|
install -m 755 "$SRC/lib/scripts/sun8i-corekeeper.sh" "$CACHEDIR/sdcard/usr/local/bin"
|
2016-04-06 23:09:56 +02:00
|
|
|
|
sed -i 's|^exit\ 0$|/usr/local/bin/sun8i-corekeeper.sh \&\n\n&|' "$CACHEDIR/sdcard/etc/rc.local"
|
2016-02-24 11:47:54 +01:00
|
|
|
|
fi
|
2014-10-07 20:49:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-25 20:04:33 +03:00
|
|
|
|
# write_uboot <loopdev>
|
|
|
|
|
#
|
|
|
|
|
# writes u-boot to loop device
|
|
|
|
|
# Parameters:
|
|
|
|
|
# loopdev: loop device with mounted rootfs image
|
|
|
|
|
write_uboot()
|
|
|
|
|
{
|
|
|
|
|
LOOP=$1
|
|
|
|
|
display_alert "Writing bootloader" "$LOOP" "info"
|
2016-03-23 20:58:58 +01:00
|
|
|
|
dpkg -x ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb /tmp/
|
2015-12-25 20:04:33 +03:00
|
|
|
|
|
|
|
|
|
if [[ $BOARD == *cubox* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/SPL of=$LOOP bs=512 seek=2 status=noxfer >/dev/null 2>&1)
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.img of=$LOOP bs=1K seek=42 status=noxfer >/dev/null 2>&1)
|
2016-01-08 19:50:53 +01:00
|
|
|
|
elif [[ $BOARD == *armada* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.mmc of=$LOOP bs=512 seek=1 status=noxfer >/dev/null 2>&1)
|
2015-12-25 20:04:33 +03:00
|
|
|
|
elif [[ $BOARD == *udoo* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/SPL of=$LOOP bs=1k seek=1 status=noxfer >/dev/null 2>&1)
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.img of=$LOOP bs=1k seek=69 conv=fsync >/dev/null 2>&1)
|
2016-04-22 21:19:31 +02:00
|
|
|
|
elif [[ $BOARD == *guitar* || $BOARD == *roseapple* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bootloader.bin of=$LOOP bs=512 seek=4097 conv=fsync > /dev/null 2>&1)
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot-dtb.bin of=$LOOP bs=512 seek=6144 conv=fsync > /dev/null 2>&1)
|
2016-03-22 10:42:47 +01:00
|
|
|
|
elif [[ $BOARD == *odroidxu4* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl1.bin.hardkernel of=$LOOP seek=1 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl2.bin.hardkernel of=$LOOP seek=31 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.bin of=$LOOP bs=512 seek=63 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/tzsw.bin.hardkernel of=$LOOP seek=719 conv=fsync ) > /dev/null 2>&1
|
2016-03-22 10:42:47 +01:00
|
|
|
|
( dd if=/dev/zero of=$LOOP seek=1231 count=32 bs=512 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
elif [[ $BOARD == *odroidc1* ]] ; then
|
2016-03-28 20:04:01 +02:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl1.bin.hardkernel of=$LOOP bs=1 count=442 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl1.bin.hardkernel of=$LOOP bs=512 skip=1 seek=1 conv=fsync ) > /dev/null 2>&1
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.bin of=$LOOP bs=512 seek=64 conv=fsync ) > /dev/null 2>&1
|
2016-03-22 20:55:39 +01:00
|
|
|
|
( dd if=/dev/zero of=$LOOP seek=1024 count=32 bs=512 conv=fsync ) > /dev/null 2>&1
|
2016-03-23 06:41:01 +01:00
|
|
|
|
elif [[ $BOARD == *odroidc2* ]] ; then
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl1.bin.hardkernel of=$LOOP bs=1 count=442 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/bl1.bin.hardkernel of=$LOOP bs=512 skip=1 seek=1 conv=fsync ) > /dev/null 2>&1
|
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot.bin of=$LOOP bs=512 seek=97 conv=fsync ) > /dev/null 2>&1
|
2016-03-23 06:41:01 +01:00
|
|
|
|
( dd if=/dev/zero of=$LOOP seek=1249 count=799 bs=512 conv=fsync ) > /dev/null 2>&1
|
2015-12-25 20:04:33 +03:00
|
|
|
|
else
|
2016-03-22 20:55:39 +01:00
|
|
|
|
( dd if=/dev/zero of=$LOOP bs=1k count=1023 seek=1 status=noxfer ) > /dev/null 2>&1
|
2016-03-23 20:58:58 +01:00
|
|
|
|
( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}/u-boot-sunxi-with-spl.bin of=$LOOP bs=1024 seek=8 status=noxfer >/dev/null 2>&1)
|
2015-12-25 20:04:33 +03:00
|
|
|
|
fi
|
2016-04-23 19:06:39 +03:00
|
|
|
|
[[ $? -ne 0 ]] && exit_with_error "U-boot failed to install" "@host"
|
2015-12-25 20:04:33 +03:00
|
|
|
|
rm -r /tmp/usr
|
|
|
|
|
sync
|
|
|
|
|
}
|
2016-03-19 17:26:15 +03:00
|
|
|
|
|
|
|
|
|
customize_image()
|
|
|
|
|
{
|
|
|
|
|
cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh
|
|
|
|
|
chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh
|
|
|
|
|
mkdir -p $CACHEDIR/sdcard/tmp/overlay
|
|
|
|
|
mount --bind $SRC/userpatches/overlay $CACHEDIR/sdcard/tmp/overlay
|
|
|
|
|
display_alert "Calling image customization script" "customize-image.sh" "info"
|
|
|
|
|
chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP"
|
|
|
|
|
umount $CACHEDIR/sdcard/tmp/overlay
|
|
|
|
|
}
|