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_LZO=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/bl33.bin
$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
# Clean up after previous build
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
if [ -f $DESTDIR/u-boot.bin.sd.bin ] ; then
cp -av $DESTDIR/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader
if [ $UBOOT_SYSTEM != "box" ]; then
if [ -f $DESTDIR/u-boot.bin.sd.bin ]; then
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
# Install boot.ini if it exists

View File

@ -1,22 +1,30 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. config/options $1
. config/options ""
DTB="$(${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} ${UBOOT_SYSTEM} dtb)"
mkimage_uboot(){
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
}
mkimage_autoscripts(){
echo "image: copying autoscript files and device trees"
mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/* ::
echo "image: copying autoscript files"
mcopy -s -o ${RELEASE_DIR}/3rdparty/bootloader/*script ::
mcopy -s -o ${RELEASE_DIR}/3rdparty/bootloader/*.scr ::
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(){
echo "image: creating uEnv.ini"
cat << EOF > "${LE_TMP}/uEnv.ini"
@ -39,25 +47,34 @@ EOF
}
mkimage_dtb(){
echo "image: copying device tree"
mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/dtb/$DTB ::
if [ "$DTB" != "@@DTB_NAME@@" ]; then
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
box|"")
DTB="@@DTB_NAME@@"
mkimage_autoscripts
mkimage_uEnv
mkimage_autoscripts
mkimage_bootini
mkimage_dtb
;;
khadas*|lepotato|nanopi-k2|odroid*)
mkimage_uboot
mkimage_extlinux
mkimage_dtb
;;
*)
mkimage_uEnv
mkimage_autoscripts
mkimage_bootini
mkimage_extlinux
mkimage_uboot
mkimage_dtb
;;
*)
mkimage_uboot
mkimage_extlinux
mkimage_autoscripts
mkimage_uEnv
;;
esac

View File

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