[hikey][efi] scripts for efi workflow
Change-Id: If125285d6f229b6acf17e5c41bddc4a77dcd3c67
Esse commit está contido em:
commit de
CQ bot account: commit-bot@chromium.org
pai
6f402d4d68
commit
9ad9c0c5fc
Arquivo executável
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Fuchsia Authors
|
||||
#
|
||||
# Use of this source code is governed by a MIT-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Uploads boot image (kernel+ramdisk) into RAM of a hikey960 which is in fastboot
|
||||
# mode, and then executes image. Requires that the hikey be equiped with UEFI
|
||||
# bootloader.
|
||||
# Assumes this is run from the magenta source directory.
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: hikey-efi-boot-image <uefi repo path>"
|
||||
echo " see /docs/targets/hikey960-uefi.md for more info"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#where the hikey repos live
|
||||
HIKEY_DIR=$1
|
||||
MAGENTA_DIR=.
|
||||
MAGENTA_BUILD=${MAGENTA_DIR}/build-magenta-hikey960-arm64
|
||||
|
||||
KERNEL=${MAGENTA_BUILD}/magenta.bin-dtb
|
||||
RAMDISK=${MAGENTA_BUILD}/bootdata.bin
|
||||
|
||||
OUT_IMAGE=${MAGENTA_BUILD}/boot.img
|
||||
DTB_FILE=${MAGENTA_DIR}/kernel/target/hikey960/device-tree.dtb
|
||||
DT_IMAGE=${MAGENTA_BUILD}/dt.img
|
||||
|
||||
MEMBASE=0x00000000
|
||||
KERNEL_OFFSET=0x00080000
|
||||
RAMDISK_OFFSET=0x07c00000
|
||||
DT_OFFSET=0x07a00000
|
||||
|
||||
CMDLINE="TERM=uart"
|
||||
|
||||
# mkdtimg and mkbootimg can be found at:
|
||||
# https://github.com/96boards-hikey/tools-images-hikey960/tree/master/build-from-source
|
||||
|
||||
|
||||
${HIKEY_DIR}/tools-images-hikey960/build-from-source/mkbootimg --kernel $KERNEL \
|
||||
--kernel_offset $KERNEL_OFFSET \
|
||||
--base $MEMBASE \
|
||||
--ramdisk_offset $RAMDISK_OFFSET \
|
||||
--ramdisk $RAMDISK \
|
||||
--tags_offset $DT_OFFSET \
|
||||
--cmdline $CMDLINE \
|
||||
-o $OUT_IMAGE || exit 1
|
||||
|
||||
fastboot boot $OUT_IMAGE || exit 1
|
||||
Arquivo executável
+87
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Fuchsia Authors
|
||||
#
|
||||
# Use of this source code is governed by a MIT-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
RECOVERY_PORT=/dev/ttyUSB1
|
||||
|
||||
set -- `getopt "p:" "$@"`
|
||||
|
||||
while [ ! -z "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-p) RECOVERY_PORT=$2
|
||||
shift;;
|
||||
*) echo "$1"
|
||||
break;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: hikey-efi-build [-p <recovery tty path>] <uefi repo path>"
|
||||
echo " see /docs/targets/hikey960-uefi.md for more info"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ARCH=aarch64
|
||||
export CROSS_COMPILE_64=aarch64-linux-gnu-
|
||||
export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
|
||||
#You need to set this to the location where you have all the hikey repositories
|
||||
|
||||
BUILD_PATH=$1
|
||||
|
||||
BUILD_OPTION=DEBUG
|
||||
|
||||
export AARCH64_TOOLCHAIN=GCC5
|
||||
|
||||
export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools
|
||||
|
||||
export EDK2_DIR=${BUILD_PATH}/edk2
|
||||
|
||||
export EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}
|
||||
|
||||
cd ${EDK2_DIR}
|
||||
|
||||
# Build UEFI & ARM Trust Firmware
|
||||
|
||||
${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware hikey960
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " !!! UEFI edk2 failed to build !!! " >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Generate l-loader.bin
|
||||
|
||||
cd ${BUILD_PATH}/l-loader
|
||||
|
||||
ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
|
||||
|
||||
ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
|
||||
|
||||
ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
|
||||
|
||||
python gen_loader_hikey960.py -o l-loader.bin --img_bl1=bl1.bin --img_ns_bl1u=BL33_AP_UEFI.fd
|
||||
|
||||
PTABLE=aosp-32g SECTOR_SIZE=4096 SGDISK=./sgdisk bash -x generate_ptable.sh
|
||||
|
||||
cd ${BUILD_PATH}/tools-images-hikey960
|
||||
|
||||
#This will load the images into ram and boot them... If you want to make it
|
||||
# permanent, then they will need to be flashed via fastboot after this step.
|
||||
|
||||
ln -sf ../l-loader/l-loader.bin
|
||||
ln -sf ../l-loader/fip.bin
|
||||
|
||||
./hikey_idt -c config -p $RECOVERY_PORT
|
||||
Arquivo executável
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Fuchsia Authors
|
||||
#
|
||||
# Use of this source code is governed by a MIT-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
#After the target is booted into recovery mode using the hikey-uefi-build
|
||||
# script, this script can be used to permanently update the bootloader flash
|
||||
# to the newly built uefi images
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: hikey-efi-fastboot-update <uefi repo path>"
|
||||
echo " see /docs/targets/hikey960-uefi.md for more info"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#where the hikey repos live
|
||||
BUILD_PATH=$1
|
||||
|
||||
echo ${BUILD_PATH}
|
||||
|
||||
fastboot flash ptable ${BUILD_PATH}/l-loader/prm_ptable.img
|
||||
fastboot flash xloader ${BUILD_PATH}/tools-images-hikey960/sec_xloader.img
|
||||
fastboot flash fastboot ${BUILD_PATH}/tools-images-hikey960/l-loader.bin
|
||||
fastboot flash fip ${BUILD_PATH}/tools-images-hikey960/fip.bin
|
||||
|
||||
Arquivo executável
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Fuchsia Authors
|
||||
#
|
||||
# Use of this source code is governed by a MIT-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Flashes new boot image (kernel+ramdisk) into a hikey960 which is in fastboot
|
||||
# mode. Requires that the hikey be equiped with UEFI bootloader.
|
||||
# Assumes this is run from the magenta source directory.
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: hikey-efi-flash-image <uefi repo path>"
|
||||
echo " see /docs/targets/hikey960-uefi.md for more info"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#where the hikey repos live
|
||||
HIKEY_DIR=$1
|
||||
|
||||
MAGENTA_DIR=.
|
||||
MAGENTA_BUILD=${MAGENTA_DIR}/build-magenta-hikey960-arm64
|
||||
|
||||
KERNEL=${MAGENTA_BUILD}/magenta.bin-dtb
|
||||
RAMDISK=${MAGENTA_BUILD}/bootdata.bin
|
||||
|
||||
OUT_IMAGE=${MAGENTA_BUILD}/boot.img
|
||||
DTB_FILE=${MAGENTA_DIR}/kernel/target/hikey960/device-tree.dtb
|
||||
DT_IMAGE=${MAGENTA_BUILD}/dt.img
|
||||
|
||||
MEMBASE=0x00000000
|
||||
KERNEL_OFFSET=0x00080000
|
||||
RAMDISK_OFFSET=0x07c00000
|
||||
DT_OFFSET=0x07a00000
|
||||
|
||||
CMDLINE="TERM=uart"
|
||||
|
||||
# mkdtimg and mkbootimg can be found at:
|
||||
# https://github.com/96boards-hikey/tools-images-hikey960/tree/master/build-from-source
|
||||
|
||||
${HIKEY_DIR}/tools-images-hikey960/build-from-source/mkbootimg --kernel $KERNEL \
|
||||
--kernel_offset $KERNEL_OFFSET \
|
||||
--base $MEMBASE \
|
||||
--ramdisk_offset $RAMDISK_OFFSET \
|
||||
--ramdisk $RAMDISK \
|
||||
--tags_offset $DT_OFFSET \
|
||||
--cmdline $CMDLINE \
|
||||
-o $OUT_IMAGE || exit 1
|
||||
|
||||
fastboot flash boot $OUT_IMAGE || exit 1
|
||||
# Can't guarantee that the target has written image
|
||||
# to flash before the fastboot command completes, so
|
||||
# short delay here before reboot.
|
||||
sleep 1
|
||||
fastboot reboot || exit 1
|
||||
Referência em uma Nova Issue
Bloquear um usuário