Merge branch 'next-dev' into thunder-boot

This commit is contained in:
Joseph Chen 2020-04-20 19:55:03 +08:00
commit b0a6db3b4a
6 changed files with 68 additions and 31 deletions

View File

@ -339,12 +339,12 @@ config SPL_FIT_IMAGE_KB
depends on SPL_FIT depends on SPL_FIT
default 2048 default 2048
help help
SPL FIT image size in KiB. SPL FIT image size in KiB, default 2048KB = 1024KB(u-boot) + 1024KB(tee/atf + others).
config SPL_FIT_IMAGE_MULTIPLE config SPL_FIT_IMAGE_MULTIPLE
int "SPL FIT image multiple number" int "SPL FIT image multiple number"
depends on SPL_FIT depends on SPL_FIT
default 1 default 2
help help
SPL FIT image multiple number. SPL FIT image multiple number.

View File

@ -295,30 +295,30 @@ static void *fit_get_blob(struct blk_desc *dev_desc, disk_partition_t *part)
return NULL; return NULL;
if (blk_dread(dev_desc, part->start, blknum, fdt) != blknum) { if (blk_dread(dev_desc, part->start, blknum, fdt) != blknum) {
FIT_I("Failed to read fdt header\n"); debug("Failed to read fdt header\n");
goto fail; goto fail;
} }
if (fdt_check_header(fdt)) { if (fdt_check_header(fdt)) {
FIT_I("Invalid fdt header\n"); debug("Invalid fdt header\n");
goto fail; goto fail;
} }
if (!fit_is_ext_type(fdt)) { if (!fit_is_ext_type(fdt)) {
FIT_I("Not external type\n"); debug("Not external type\n");
goto fail; goto fail;
} }
blknum = DIV_ROUND_UP(fdt_totalsize(fdt), dev_desc->blksz); blknum = DIV_ROUND_UP(fdt_totalsize(fdt), dev_desc->blksz);
fit = memalign(ARCH_DMA_MINALIGN, blknum * dev_desc->blksz); fit = memalign(ARCH_DMA_MINALIGN, blknum * dev_desc->blksz);
if (!fit) { if (!fit) {
FIT_I("No memory\n"); debug("No memory\n");
goto fail; goto fail;
} }
if (blk_dread(dev_desc, part->start, blknum, fit) != blknum) { if (blk_dread(dev_desc, part->start, blknum, fit) != blknum) {
free(fit); free(fit);
FIT_I("Failed to read fit\n"); debug("Failed to read fit\n");
goto fail; goto fail;
} }
@ -504,7 +504,7 @@ int rockchip_read_fit_dtb(void *fdt_addr, char **hash, int *hash_size)
fit = fit_get_blob(dev_desc, &part); fit = fit_get_blob(dev_desc, &part);
if (!fit) { if (!fit) {
FIT_I("No fdt description\n"); FIT_I("No fdt blob\n");
return -EINVAL; return -EINVAL;
} }

View File

@ -436,6 +436,23 @@ static int reserve_malloc(void)
return 0; return 0;
} }
#ifdef CONFIG_SYS_NONCACHED_MEMORY
static int reserve_noncached(void)
{
phys_addr_t start, end;
size_t size;
end = ALIGN(gd->start_addr_sp, MMU_SECTION_SIZE) - MMU_SECTION_SIZE;
size = ALIGN(CONFIG_SYS_NONCACHED_MEMORY, MMU_SECTION_SIZE);
start = end - size;
gd->start_addr_sp = start;
debug("Reserving %zu for noncached_alloc() at: %08lx\n",
size, gd->start_addr_sp);
return 0;
}
#endif
/* (permanently) allocate a Board Info struct */ /* (permanently) allocate a Board Info struct */
static int reserve_board(void) static int reserve_board(void)
{ {
@ -874,6 +891,9 @@ static const init_fnc_t init_sequence_f[] = {
reserve_trace, reserve_trace,
reserve_uboot, reserve_uboot,
reserve_malloc, reserve_malloc,
#ifdef CONFIG_SYS_NONCACHED_MEMORY
reserve_noncached,
#endif
reserve_board, reserve_board,
setup_machine, setup_machine,
reserve_global_data, reserve_global_data,

View File

@ -1326,7 +1326,7 @@ int fit_image_verify_with_data(const void *fit, int image_noffset,
goto error; goto error;
} }
return 1; return 1; /* success */
error: error:
printf(" error!\n%s for '%s' hash node in '%s' image node\n", printf(" error!\n%s for '%s' hash node in '%s' image node\n",

View File

@ -566,7 +566,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#endif #endif
#if CONFIG_IS_ENABLED(OPTEE) #if CONFIG_IS_ENABLED(OPTEE)
case IH_OS_OP_TEE: case IH_OS_OP_TEE:
printf("Jumping to U-Boot via OP-TEE\n"); printf("Jumping to U-Boot(0x%08lx) via OP-TEE(0x%08lx)\n\n",
(ulong)spl_image.entry_point_os,
(ulong)spl_image.entry_point);
spl_cleanup_before_jump(&spl_image); spl_cleanup_before_jump(&spl_image);
spl_optee_entry(NULL, (void *)spl_image.entry_point_os, spl_optee_entry(NULL, (void *)spl_image.entry_point_os,
(void *)spl_image.fdt_addr, (void *)spl_image.fdt_addr,

49
make.sh
View File

@ -10,6 +10,7 @@ BOARD=$1
SUBCMD=$1 SUBCMD=$1
FUNCADDR=$1 FUNCADDR=$1
FILE=$2 FILE=$2
ARGS=$*
JOB=`sed -n "N;/processor/p" /proc/cpuinfo|wc -l` JOB=`sed -n "N;/processor/p" /proc/cpuinfo|wc -l`
SUPPORT_LIST=`ls configs/*[r,p][x,v,k][0-9][0-9]*_defconfig` SUPPORT_LIST=`ls configs/*[r,p][x,v,k][0-9][0-9]*_defconfig`
@ -148,7 +149,7 @@ function prepare()
{ {
case $BOARD in case $BOARD in
# Parse from exit .config # Parse from exit .config
''|elf*|loader*|spl*|itb|debug*|trust|uboot|map|sym|env|EXT_DTB=*|fit*|nopack) ''|elf*|loader*|spl*|itb|debug*|trust|uboot|map|sym|env|EXT_DTB=*|fit*|nopack|--rollback-index*)
if [ ! -f .config ]; then if [ ! -f .config ]; then
echo echo
echo "ERROR: No .config" echo "ERROR: No .config"
@ -167,7 +168,7 @@ function prepare()
;; ;;
#Subcmd #Subcmd
''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*|fit*|nopack) ''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*|fit*|nopack|--rollback-index*)
;; ;;
*) *)
@ -181,6 +182,8 @@ function prepare()
else else
echo "make for ${BOARD}_defconfig by -j${JOB}" echo "make for ${BOARD}_defconfig by -j${JOB}"
make ${BOARD}_defconfig ${OPTION} make ${BOARD}_defconfig ${OPTION}
# Skip 1st args
ARGS=`echo $ARGS | awk '{ $1=""; print $0 }'`
fi fi
;; ;;
esac esac
@ -235,8 +238,14 @@ function select_toolchain()
function sub_commands() function sub_commands()
{ {
# skip "--" parameter, such as "--rollback-index-..."
if [[ "$SUBCMD" != "--*" ]]; then
cmd=${SUBCMD%-*} cmd=${SUBCMD%-*}
opt=${SUBCMD#*-} opt=${SUBCMD#*-}
else
cmd=$SUBCMD
fi
elf=u-boot elf=u-boot
map=u-boot.map map=u-boot.map
sym=u-boot.sym sym=u-boot.sym
@ -268,9 +277,7 @@ function sub_commands()
;; ;;
fit) fit)
if [ "$opt" = "s" ]; then if [ "$opt" = "ns" ]; then
./scripts/fit-vboot.sh
else
./scripts/fit-vboot.sh --no-vboot ./scripts/fit-vboot.sh --no-vboot
fi fi
exit 0 exit 0
@ -316,6 +323,11 @@ function sub_commands()
exit 0 exit 0
;; ;;
--rollback-index*)
pack_fit_image $ARGS
exit 0
;;
EXT_DTB=*) EXT_DTB=*)
OPTION=${SUBCMD} OPTION=${SUBCMD}
;; ;;
@ -485,7 +497,7 @@ function pack_uboot_image()
exit 1 exit 1
fi fi
${RKTOOLS}/loaderimage --pack --uboot u-boot.bin uboot.img ${uboot_load_addr} ${PLATFORM_UBOOT_IMG_SIZE} ${RKTOOLS}/loaderimage --pack --uboot u-boot.bin uboot.img ${uboot_load_addr} ${PLATFORM_UBOOT_IMG_SIZE}
ls u-boot.img u-boot-dtb.img >/dev/null 2>&1 && rm u-boot.img u-boot-dtb.img -rf rm u-boot.img u-boot-dtb.img -rf
echo "pack uboot okay! Input: u-boot.bin" echo "pack uboot okay! Input: u-boot.bin"
} }
@ -558,7 +570,7 @@ function pack_spl_loader_image()
return return
fi fi
ls ${tmp_dir} >/dev/null 2>&1 && rm ${tmp_dir} -rf rm ${tmp_dir} -rf
mkdir ${tmp_dir} -p mkdir ${tmp_dir} -p
cp spl/u-boot-spl.bin ${tmp_dir}/ cp spl/u-boot-spl.bin ${tmp_dir}/
cp $ini $tmp_ini cp $ini $tmp_ini
@ -578,7 +590,7 @@ function pack_spl_loader_image()
${RKTOOLS}/boot_merger $tmp_ini ${RKTOOLS}/boot_merger $tmp_ini
rm ${tmp_dir} -rf rm ${tmp_dir} -rf
cd - cd -
ls *_loader_*.bin >/dev/null 2>&1 && rm *_loader_*.bin rm *_loader_*.bin -rf
mv ${RKBIN}/*_loader_*.bin ./ mv ${RKBIN}/*_loader_*.bin ./
filename=`basename *_loader_*.bin` filename=`basename *_loader_*.bin`
@ -605,8 +617,7 @@ function pack_loader_image()
return return
fi fi
ls *_loader_*.bin >/dev/null 2>&1 && rm *_loader_*.bin rm *_loader_*.bin -rf
numline=`cat $ini | wc -l` numline=`cat $ini | wc -l`
if [ $numline -eq 1 ]; then if [ $numline -eq 1 ]; then
image=`sed -n "/PATH=/p" $ini | tr -d '\r' | cut -d '=' -f 2` image=`sed -n "/PATH=/p" $ini | tr -d '\r' | cut -d '=' -f 2`
@ -666,7 +677,7 @@ function pack_trust_image()
return return
fi fi
ls trust*.img >/dev/null 2>&1 && rm trust*.img rm trust*.img -rf
if [ "$FILE" != "" ]; then if [ "$FILE" != "" ]; then
ini=$FILE; ini=$FILE;
else else
@ -698,9 +709,13 @@ function pack_trust_image()
function pack_fit_image() function pack_fit_image()
{ {
if grep -q '^CONFIG_FIT_SIGNATURE=y' .config ; then
./scripts/fit-vboot.sh $*
else
./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild ./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild
ls uboot.img trust*.img >/dev/null 2>&1 && rm uboot.img trust*.img -rf rm uboot.img trust*.img -rf
echo "pack uboot.img (with uboot trust) okay! Input: $ini" echo "pack uboot.img (with uboot trust) okay! Input: $ini"
fi
} }
function pack_images() function pack_images()
@ -711,7 +726,7 @@ function pack_images()
pack_trust_image pack_trust_image
pack_loader_image pack_loader_image
elif [ "$PACK_FORMAT" = "fit" ]; then elif [ "$PACK_FORMAT" = "fit" ]; then
pack_fit_image pack_fit_image $ARGS
fi fi
fi fi
} }
@ -719,13 +734,13 @@ function pack_images()
function clean_files() function clean_files()
{ {
if [ -f spl/u-boot-spl.dtb ]; then if [ -f spl/u-boot-spl.dtb ]; then
rm spl/u-boot-spl.dtb rm spl/u-boot-spl.dtb -rf
fi fi
if [ -f tpl/u-boot-tpl.dtb ]; then if [ -f tpl/u-boot-tpl.dtb ]; then
rm tpl/u-boot-tpl.dtb rm tpl/u-boot-tpl.dtb -rf
fi fi
if [ -f u-boot.dtb ]; then if [ -f u-boot.dtb ]; then
rm u-boot.dtb rm u-boot.dtb -rf
fi fi
} }
@ -734,7 +749,7 @@ function finish()
echo echo
if [ ! -z "$OPTION" ]; then if [ ! -z "$OPTION" ]; then
echo "Platform ${RKCHIP_LABEL} is build OK, with exist .config ($OPTION)" echo "Platform ${RKCHIP_LABEL} is build OK, with exist .config ($OPTION)"
elif [ "$BOARD" = '' ]; then elif [ "$BOARD" = '' -o "$BOARD" = 'nopack' ]; then
echo "Platform ${RKCHIP_LABEL} is build OK, with exist .config" echo "Platform ${RKCHIP_LABEL} is build OK, with exist .config"
else else
echo "Platform ${RKCHIP_LABEL} is build OK, with new .config(make ${BOARD}_defconfig)" echo "Platform ${RKCHIP_LABEL} is build OK, with new .config(make ${BOARD}_defconfig)"