amlogic: updates to bootloader scripts

This commit is contained in:
chewitt 2019-06-15 08:48:54 +00:00
parent 4faed5429f
commit 5b5c8a0cc0
4 changed files with 65 additions and 28 deletions

View File

@ -1,3 +1,4 @@
CONFIG_LZ4=y CONFIG_LZ4=y
CONFIG_LZO=y CONFIG_LZO=y
CONFIG_LZMA=y CONFIG_LZMA=y
CONFIG_BOOTDELAY=0

View File

@ -165,19 +165,24 @@ case "${UBOOT_SYSTEM}" in
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin
$FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig
$FIPDIR/gxl/aml_encrypt_gxl --bootmk --output $DESTDIR/u-boot.bin.sd.bin --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc $FIPDIR/gxl/aml_encrypt_gxl --bootmk --output $DESTDIR/u-boot.bin --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc
;; ;;
esac esac
# Clean up after previous build # Clean up after previous build
rm -rf $INSTALL/usr/share/bootloader/boot.ini rm -rf $INSTALL/usr/share/bootloader/boot.ini
rm -rf $INSTALL/usr/share/bootloader/u-boot.bin.sd.bin rm -rf $INSTALL/usr/share/bootloader/u-boot*
# Install u-boot
mkdir -p $INSTALL/usr/share/bootloader mkdir -p $INSTALL/usr/share/bootloader
if [ $UBOOT_SYSTEM != "box" ]; then
if [ -f $DESTDIR/u-boot.bin.sd.bin ] ; then if [ -f $DESTDIR/u-boot.bin.sd.bin ]; then
cp -av $DESTDIR/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader cp -av $DESTDIR/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader
fi
if [ -f $DESTDIR/u-boot.bin ]; then
cp -av $DESTDIR/u-boot.bin $INSTALL/usr/share/bootloader
fi
fi fi
# Install boot.ini if it exists # Install boot.ini if it exists

View File

@ -1,22 +1,30 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. config/options $1 . config/options ""
DTB="$(${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} ${UBOOT_SYSTEM} dtb)" DTB="$(${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} ${UBOOT_SYSTEM} dtb)"
mkimage_uboot(){ mkimage_uboot(){
echo "image: writing u-boot to $(basename $DISK)" echo "image: writing u-boot to $(basename $DISK)"
dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=1 count=444 >"$SAVE_ERROR" 2>&1 || show_error
dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error
} }
mkimage_autoscripts(){ mkimage_autoscripts(){
echo "image: copying autoscript files and device trees" echo "image: copying autoscript files"
mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/* :: mcopy -s -o ${RELEASE_DIR}/3rdparty/bootloader/*script ::
mcopy -s -o ${RELEASE_DIR}/3rdparty/bootloader/*.scr ::
touch "$RELEASE_DIR/3rdparty/bootloader/aml_autoscript.zip" touch "$RELEASE_DIR/3rdparty/bootloader/aml_autoscript.zip"
} }
mkimage_bootini(){
if [ -f ${RELEASE_DIR}/3rdparty/bootloader/boot.ini ]; then
echo "image: copying boot.ini"
mcopy -s -o ${RELEASE_DIR}/3rdparty/bootloader/boot.ini ::
fi
}
mkimage_uEnv(){ mkimage_uEnv(){
echo "image: creating uEnv.ini" echo "image: creating uEnv.ini"
cat << EOF > "${LE_TMP}/uEnv.ini" cat << EOF > "${LE_TMP}/uEnv.ini"
@ -39,25 +47,34 @@ EOF
} }
mkimage_dtb(){ mkimage_dtb(){
echo "image: copying device tree" if [ "$DTB" != "@@DTB_NAME@@" ]; then
mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/dtb/$DTB :: echo "image: copying device tree"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/$DTB" ::
else
echo "image: copying device trees"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb" ::
fi
} }
case "${UBOOT_SYSTEM}" in case "${UBOOT_SYSTEM}" in
box|"") box|"")
DTB="@@DTB_NAME@@" DTB="@@DTB_NAME@@"
mkimage_autoscripts
mkimage_uEnv mkimage_uEnv
mkimage_autoscripts
mkimage_bootini
mkimage_dtb
;; ;;
khadas*|lepotato|nanopi-k2|odroid*) khadas*|lepotato|nanopi-k2|odroid*)
mkimage_uboot
mkimage_extlinux
mkimage_dtb
;;
*)
mkimage_uEnv
mkimage_autoscripts
mkimage_bootini
mkimage_extlinux mkimage_extlinux
mkimage_uboot mkimage_uboot
mkimage_dtb mkimage_dtb
;; ;;
*)
mkimage_uboot
mkimage_extlinux
mkimage_autoscripts
mkimage_uEnv
;;
esac esac

View File

@ -22,18 +22,32 @@
# mount $BOOT_ROOT rw # mount $BOOT_ROOT rw
mount -o remount,rw $BOOT_ROOT mount -o remount,rw $BOOT_ROOT
# update device trees # update extlinux device trees
for dtbfile in $BOOT_ROOT/dtb/*.dtb ; do if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then
dtb=$(basename $dtbfile) for dtbfile in $BOOT_ROOT/*.dtb ; do
echo "Updating $dtb" dtb=$(basename $dtbfile)
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true echo "Updating $dtb"
done cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true
done
fi
# update box device trees
if [ -f $BOOT_ROOT/uEnv.ini ]; then
for dtbfile in $BOOT_ROOT/dtb/*.dtb ; do
dtb=$(basename $dtbfile)
echo "Updating $dtb"
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true
done
fi
# update u-boot scripts # update u-boot scripts
for scriptfile in $SYSTEM_ROOT/usr/share/bootloader/*_autoscript* $SYSTEM_ROOT/usr/share/bootloader/*.scr ; do if [ -f $BOOT_ROOT/uEnv.ini ]; then
echo "Updating $(basename $scriptfile)" for scriptfile in $SYSTEM_ROOT/usr/share/bootloader/*_autoscript* $SYSTEM_ROOT/usr/share/bootloader/*.scr ; do
cp -p $scriptfile $BOOT_ROOT 2>/dev/null || true script=$(basename $scriptfile)
done echo "Updating $script"
cp -p $SYSTEM_ROOT/usr/share/bootloader/$script $BOOT_ROOT/ 2>/dev/null || true
done
fi
# mount $BOOT_ROOT ro # mount $BOOT_ROOT ro
sync sync