amlogic: convert bootloader/install to use LibreELEC/amlogic-boot-fip repo

This commit is contained in:
chewitt 2019-10-13 09:11:31 +00:00
parent d730f71874
commit d073de18ec

View File

@ -6,36 +6,100 @@ echo "$BOOTLOADER: creating u-boot.bin"
DESTDIR="$PKG_BUILD/fip"
mkdir -p $DESTDIR
FIPDIR="$(get_build_dir amlogic-boot-fip)"
FIPDIR="$(get_build_dir amlogic-boot-fip)/$UBOOT_SYSTEM"
case "${UBOOT_SYSTEM}" in
box|"")
# No-op, use vendor booloader
# no-op, use vendor booloader
;;
khadas-vim3*)
if [ "$UBOOT_SYSTEM" = "khadas-vim3" ]; then
AML_ENCRYPT_BIN="aml_encrypt_g12b"
else
AML_ENCRYPT_BIN="aml_encrypt_g12a"
fi
cp $FIPDIR/bl301.bin $DESTDIR/
cp $FIPDIR/acs.bin $DESTDIR/
cp $FIPDIR/aml_ddr.fw $DESTDIR/
cp $FIPDIR/bl2.bin $DESTDIR/
cp $FIPDIR/bl30.bin $DESTDIR/
cp $FIPDIR/bl31.img $DESTDIR/
cp $FIPDIR/blx_fix.sh $DESTDIR/
cp $FIPDIR/ddr3_1d.fw $DESTDIR/
cp $FIPDIR/ddr4_1d.fw $DESTDIR/
cp $FIPDIR/ddr4_2d.fw $DESTDIR/
cp $FIPDIR/diag_lpddr4.fw $DESTDIR/
cp $FIPDIR/lpddr3_1d.fw $DESTDIR/
cp $FIPDIR/lpddr4_1d.fw $DESTDIR/
cp $FIPDIR/lpddr4_2d.fw $DESTDIR/
cp $FIPDIR/piei.fw $DESTDIR/
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl30_zero.bin \
$DESTDIR/bl301.bin \
$DESTDIR/bl301_zero.bin \
$DESTDIR/bl30_new.bin bl30
$FIPDIR/blx_fix.sh $DESTDIR/bl2.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl2_zero.bin \
$DESTDIR/acs.bin \
$DESTDIR/bl21_zero.bin \
$DESTDIR/bl2_new.bin bl2
$FIPDIR/$AML_ENCRYPT_BIN --bl30sig --input $DESTDIR/bl30_new.bin \
--output $DESTDIR/bl30_new.bin.g12a.enc \
--level v3
$FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl30_new.bin.g12a.enc \
--output $DESTDIR/bl30_new.bin.enc \
--level v3 --type bl30
$FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl31.img \
--output $DESTDIR/bl31.img.enc \
--level v3 --type bl31
$FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl33.bin --compress lz4 \
--output $DESTDIR/bl33.bin.enc \
--level v3 --type bl33 --compress lz4
$FIPDIR/$AML_ENCRYPT_BIN --bl2sig --input $DESTDIR/bl2_new.bin \
--output $DESTDIR/bl2.n.bin.sig
$FIPDIR/$AML_ENCRYPT_BIN --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 \
--ddrfw1 $DESTDIR/ddr4_1d.fw \
--ddrfw2 $DESTDIR/ddr4_2d.fw \
--ddrfw3 $DESTDIR/ddr3_1d.fw \
--ddrfw4 $DESTDIR/piei.fw \
--ddrfw5 $DESTDIR/lpddr4_1d.fw \
--ddrfw6 $DESTDIR/lpddr4_2d.fw \
--ddrfw7 $DESTDIR/diag_lpddr4.fw \
--ddrfw8 $DESTDIR/aml_ddr.fw \
--ddrfw9 $DESTDIR/lpddr3_1d.fw \
--level v3
;;
odroid-c2)
FIPDIR+="/fip"
FUSEDIR="$(get_build_dir amlogic-boot-fip)/sd_fuse"
$FIPDIR/fip_create --bl30 $FIPDIR/gxb/bl30.bin \
--bl301 $FIPDIR/gxb/bl301.bin \
--bl31 $FIPDIR/gxb/bl31.bin \
--bl33 u-boot.bin $DESTDIR/fip.bin
$FIPDIR/fip_create --bl30 $FIPDIR/bl30.bin \
--bl301 $FIPDIR/bl301.bin \
--bl31 $FIPDIR/bl31.bin \
--bl33 $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/fip.bin
$FIPDIR/fip_create --dump $DESTDIR/fip.bin
cat $FIPDIR/gxb/bl2.package $DESTDIR/fip.bin > $DESTDIR/boot_new.bin
$FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.img
cat $FIPDIR/bl2.package $DESTDIR/fip.bin > $DESTDIR/boot_new.bin
$FIPDIR/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.img
dd if=$DESTDIR/u-boot.img of=$DESTDIR/u-boot.gxbb bs=512 skip=96
dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=1 count=442
dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=$FIPDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=1 count=442
dd if=$FIPDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=$DESTDIR/u-boot.gxbb of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 seek=97
;;
odroid-n2)
chmod +x $FIPDIR/blx_fix.sh
cp $FIPDIR/bl301.bin $DESTDIR/
cp $FIPDIR/acs.bin $DESTDIR/
cp $FIPDIR/aml_ddr.fw $DESTDIR/
@ -50,7 +114,7 @@ case "${UBOOT_SYSTEM}" in
cp $FIPDIR/lpddr4_1d.fw $DESTDIR/
cp $FIPDIR/lpddr4_2d.fw $DESTDIR/
cp $FIPDIR/piei.fw $DESTDIR/
cp u-boot.bin $DESTDIR/bl33.bin
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
@ -98,13 +162,13 @@ case "${UBOOT_SYSTEM}" in
;;
nanopi-k2)
cp $FIPDIR/gxb/bl2.bin $DESTDIR/
cp $FIPDIR/gxb/acs.bin $DESTDIR/
cp $FIPDIR/gxb/bl21.bin $DESTDIR/
cp $FIPDIR/gxb/bl30.bin $DESTDIR/
cp $FIPDIR/gxb/bl301.bin $DESTDIR/
cp $FIPDIR/gxb/bl31.img $DESTDIR/
cp u-boot.bin $DESTDIR/bl33.bin
cp $FIPDIR/bl2.bin $DESTDIR/
cp $FIPDIR/acs.bin $DESTDIR/
cp $FIPDIR/bl21.bin $DESTDIR/
cp $FIPDIR/bl30.bin $DESTDIR/
cp $FIPDIR/bl301.bin $DESTDIR/
cp $FIPDIR/bl31.img $DESTDIR/
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
@ -133,17 +197,17 @@ case "${UBOOT_SYSTEM}" in
cat $DESTDIR/bl2_new.bin $DESTDIR/fip.bin > $DESTDIR/boot_new.bin
$FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.bin
$FIPDIR/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.bin
;;
*)
cp $FIPDIR/gxl/bl2.bin $DESTDIR/
cp $FIPDIR/gxl/acs.bin $DESTDIR/
cp $FIPDIR/gxl/bl21.bin $DESTDIR/
cp $FIPDIR/gxl/bl30.bin $DESTDIR/
cp $FIPDIR/gxl/bl301.bin $DESTDIR/
cp $FIPDIR/gxl/bl31.img $DESTDIR/
cp u-boot.bin $DESTDIR/bl33.bin
*) # GXL/GXM
cp $FIPDIR/bl2.bin $DESTDIR/
cp $FIPDIR/acs.bin $DESTDIR/
cp $FIPDIR/bl21.bin $DESTDIR/
cp $FIPDIR/bl30.bin $DESTDIR/
cp $FIPDIR/bl301.bin $DESTDIR/
cp $FIPDIR/bl31.img $DESTDIR/
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
@ -161,11 +225,11 @@ case "${UBOOT_SYSTEM}" in
$DESTDIR/bl21_zero.bin \
$DESTDIR/bl2_new.bin bl2
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl30_new.bin
$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 --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc
$FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl30_new.bin
$FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img
$FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin
$FIPDIR/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig
$FIPDIR/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
@ -189,3 +253,4 @@ fi
if find_file_path bootloader/${UBOOT_SYSTEM}.ini; then
cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader/boot.ini
fi