rk1808: support rk1808 multi board boot

Change-Id: Ia52c026e133923d633afe5c02c97f6acca7b0b29
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Signed-off-by: Lin Huang <hl@rock-chips.com>
This commit is contained in:
Ziyuan Xu
2018-11-08 11:40:53 +08:00
committed by Lin Huang
parent 31d03abfec
commit dc54511ccf
3 changed files with 155 additions and 0 deletions

View File

@ -24,6 +24,7 @@ usage()
echo "rootfs -build default rootfs, currently build buildroot as default"
echo "buildroot -build buildroot rootfs"
echo "ramboot -build ramboot image"
echo "multi-npu_boot -build boot image for multi-npu board"
echo "yocto -build yocto rootfs, currently build ros as default"
echo "ros -build ros rootfs"
echo "debian -build debian rootfs"
@ -113,6 +114,23 @@ function build_ramboot(){
fi
}
function build_multi-npu_boot(){
if [ -z "$RK_MULTINPU_BOOT" ]; then
echo "=========Please set 'RK_MULTINPU_BOOT=y' in BoardConfig.mk========="
exit 1
fi
echo "=========Start build multi-npu boot========="
echo "TARGET_RAMBOOT_CONFIG=$RK_CFG_RAMBOOT"
echo "====================================="
/usr/bin/time -f "you take %E to build multi-npu boot" $COMMON_DIR/mk-multi-npu_boot.sh
if [ $? -eq 0 ]; then
echo "====Build multi-npu boot ok!===="
else
echo "====Build multi-npu boot failed!===="
exit 1
fi
}
function build_rootfs(){
build_buildroot
}
@ -310,6 +328,9 @@ elif [ $BUILD_TARGET == recovery ];then
elif [ $BUILD_TARGET == ramboot ];then
build_ramboot
exit 0
elif [ $BUILD_TARGET == multi-npu_boot ];then
build_multi-npu_boot
exit 0
elif [ $BUILD_TARGET == pcba ];then
build_pcba
exit 0

84
common/mk-multi-npu_boot.sh Executable file
View File

@ -0,0 +1,84 @@
#!/bin/bash
COMMON_DIR=$(cd `dirname $0`; pwd)
if [ -h $0 ]
then
CMD=$(readlink $0)
COMMON_DIR=$(dirname $CMD)
fi
cd $COMMON_DIR
cd ../../..
TOP_DIR=$(pwd)
echo "config is $RK_CFG_BUILDROOT"
if [ -z $RK_CFG_BUILDROOT ]
then
echo "config for building doesn't exist, skip!"
exit 0
fi
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_BUILDROOT
make
KERNEL_IMAGE=$TOP_DIR/$RK_KERNEL_IMG
KERNEL_DTB=$TOP_DIR/kernel/resource.img
UBOOT_DIR=$TOP_DIR/u-boot/
CPIO_IMG=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.cpio.gz
TARGET_IMAGE=$TOP_DIR/rockdev/$MULTINPU_BOOT_IMG
TARGET_DIR=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/target/opt
echo -n "pack $MULTINPU_BOOT_IMG..."
if [ -f $TARGET_DIR/boot.img ]
then
echo "remove old boot image"
rm $TARGET_DIR/boot.img
fi
# build kernel
if [ -f $KERNEL_IMAGE ]
then
echo "found kernel image"
else
echo "kernel image doesn't exist, now build kernel image"
$TOP_DIR/build.sh kernel
if [ $? -eq 0 ]; then
echo "build kernel done"
else
exit 1
fi
fi
# build uboot
if [ -f $UBOOT_DIR/uboot.img ]
then
echo "found uboot image"
else
echo "uboot image doesn't exist, now build uboot image"
$TOP_DIR/build.sh uboot
if [ $? -eq 0 ]; then
echo "build uboot done"
else
exit 1
fi
fi
cp $UBOOT_DIR/uboot.img $TARGET_DIR/uboot.img
cp $UBOOT_DIR/trust.img $TARGET_DIR/trust.img
cp $UBOOT_DIR/rk3399pro_npu_loader* $TARGET_DIR/MiniLoaderAll.bin
cp $KERNEL_IMAGE $TARGET_DIR/
# check if follower board need other dts
if [ -z $RK_KERNEL_SECOND_DTS ]
then
cp $KERNEL_DTB $TARGET_DIR/
else
cd $TOP_DIR/kernel
make
scripts/resource_tool --image=second_resource.img arch/arm64/boot/dts/rockchip/$RK_KERNEL_SECOND_DTS.dtb
cp second_resource.img $TARGET_DIR/resource.img
cd $TOP_DIR
fi
make
$TOP_DIR/kernel/scripts/mkbootimg --kernel $KERNEL_IMAGE --ramdisk $CPIO_IMG --second $KERNEL_DTB -o $TARGET_DIR/boot.img
echo "done."

View File

@ -0,0 +1,50 @@
#!/bin/bash
# Target arch
export RK_ARCH=arm64
# Uboot defconfig
export RK_UBOOT_DEFCONFIG=rk3399pro-npu
# Kernel defconfig
export RK_KERNEL_DEFCONFIG=rk1808_x4_linux_defconfig
# main board kernel dts
export RK_KERNEL_DTS=rk1808-evb-x4
# second board kernel dts
export RK_KERNEL_SECOND_DTS=rk1808-evb-x4-second
# boot image type
export RK_BOOT_IMG=
# kernel image path
export RK_KERNEL_IMG=kernel/arch/arm64/boot/Image
# parameter for GPT table
export RK_PARAMETER=parameter-buildroot.txt
# Buildroot config
export RK_CFG_BUILDROOT=rockchip_rk1808-multi
# Recovery config
export RK_CFG_RECOVERY=
# ramboot config
export RK_CFG_RAMBOOT=
# Pcba config
export RK_CFG_PCBA=
# Build jobs
export RK_JOBS=12
# target chip
export RK_TARGET_PRODUCT=rk1808-multi
# Set rootfs type, including ext2 ext4 squashfs
export RK_ROOTFS_TYPE=
# rootfs image path
export RK_ROOTFS_IMG=
# Set oem partition type, including ext2 squashfs
export RK_OEM_FS_TYPE=
# Set userdata partition type, including ext2, fat
export RK_USERDATA_FS_TYPE=
# Set flash type. support <emmc, nand, spi_nand, spi_nor>
export RK_STORAGE_TYPE=
#OEM config: /oem/dueros/aispeech/iflytekSDK/CaeDemo_VAD/smart_voice
export RK_OEM_DIR=
#userdata config
export RK_USERDATA_DIR=
#misc image
export RK_MISC=
#choose enable distro module
export RK_DISTRO_MODULE=
#enable multi-npu-boot image auto-build
export RK_MULTINPU_BOOT=y