blob: f68f0f7255ab9dee7e37b27d4c72a791d8680006 [file] [log] [blame]
shijie.xiongffcaf582022-11-08 17:16:58 +08001#!/bin/bash
2#
3# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
4#
5# SPDX-License-Identifier: MIT
6#
7
8#RTOS root directory
9RTOS_BASE_DIR=$(realpath $(dirname $(readlink -f ${BASH_SOURCE[0]:-$0}))/..)
10
11## external resource path ##
shijie.xiongfec9efd2022-11-10 11:32:33 +080012if [ -z $1 ] || [ -z $2 ]; then
13 echo -e "\033[41;33m Notice: parameter error !!! \033[0m"
14 echo -e "\033[33m usage: ./c3_fastboot.sh bl22_path u-boot_path \033[0m"
15 exit 1
16else
17 BL22_DIR=$1
18 UBOOT_DIR=$2
19fi
shijie.xiongffcaf582022-11-08 17:16:58 +080020
21#Get the current project environment variables
22source $RTOS_BASE_DIR/scripts/env.sh arm64 c3 aw419_c308l fastboot
23
24#RTOS object file path
25RTOS_BUILD_DIR=$RTOS_BASE_DIR/output/$ARCH-$BOARD-$PRODUCT/freertos
26RTOS_IMAGE_A=$RTOS_BUILD_DIR/rtos_1.bin
27RTOS_IMAGE_B=$RTOS_BUILD_DIR/rtos_2.bin
28
shijie.xiongfec9efd2022-11-10 11:32:33 +080029function lz4_rtos() {
30 pushd $RTOS_BASE_DIR/lib/utilities/lz4
31 cp $RTOS_IMAGE_A .
32 ./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x04e00000 -d 0
33 cp ./self_decompress_firmware.bin $RTOS_IMAGE_A
34 popd
35}
36
shijie.xiongffcaf582022-11-08 17:16:58 +080037function bl22_compile() {
38 if [ -d $BL22_DIR ]; then
39 pushd $BL22_DIR
shijie.xiongfec9efd2022-11-10 11:32:33 +080040 if [ -f ./mk ]; then
41 echo aaaaaaa
42 ./mk c3
43 fi
shijie.xiongffcaf582022-11-08 17:16:58 +080044 cp ./bl22.bin $RTOS_BUILD_DIR/bl22.bin
45 popd
46 fi
47}
48
shijie.xiongffcaf582022-11-08 17:16:58 +080049function package_fastboot() {
shijie.xiongffcaf582022-11-08 17:16:58 +080050 pushd $UBOOT_DIR
shijie.xiongfec9efd2022-11-10 11:32:33 +080051 if [ -d ./fastboot ]; then
52 rm -rf ./fastboot
53 fi
54 mkdir -p ./fastboot
55 cp $RTOS_IMAGE_A ./fastboot
56 cp $RTOS_IMAGE_B ./fastboot
57 cp $RTOS_BUILD_DIR/bl22.bin ./fastboot
shijie.xiongffcaf582022-11-08 17:16:58 +080058 #./mk c3_aw419 --update-bl2 --bl31 ./blob-bl31.bin.signed
shijie.xiongc2bab512022-11-10 17:53:37 +080059 #./mk c3_aw419 --update-bl2 --update-bl2e --bl31 ./blob-bl31.bin.signed
60 ./mk c3_aw419
shijie.xiongffcaf582022-11-08 17:16:58 +080061 popd
62}
63
64#compile the rtos image
65cd $RTOS_BASE_DIR && make scatter
66#lz4 compression
67lz4_rtos
68#compile the bl22 image
69bl22_compile
70#compile the u-boot image
71package_fastboot