Merge remote-tracking branch 'rockchip/master'
This commit is contained in:
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#MODEL NAME
|
||||
export RK_MODEL=RKXXXX_RETROGAME
|
||||
|
||||
#SOFT VERSION
|
||||
export RK_VERSION=V1.0.0
|
||||
|
||||
#OTA HOST
|
||||
export RK_OTA_HOST=172.16.21.205:8080
|
||||
293
common/build.sh
293
common/build.sh
@ -95,7 +95,6 @@ if [ ! -L "$BOARD_CONFIG" -a "$1" != "lunch" ]; then
|
||||
fi
|
||||
unset_board_config_all
|
||||
[ -L "$BOARD_CONFIG" ] && source $BOARD_CONFIG
|
||||
source device/rockchip/common/Version.mk
|
||||
|
||||
function prebuild_uboot()
|
||||
{
|
||||
@ -111,17 +110,45 @@ function prebuild_uboot()
|
||||
UBOOT_COMPILE_COMMANDS="$(echo $UBOOT_COMPILE_COMMANDS)"
|
||||
fi
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
UBOOT_COMPILE_COMMANDS=" \
|
||||
$UBOOT_COMPILE_COMMANDS \
|
||||
${RK_ROLLBACK_INDEX_BOOT:+--rollback-index-boot $RK_ROLLBACK_INDEX_BOOT} \
|
||||
${RK_ROLLBACK_INDEX_UBOOT:+--rollback-index-uboot $RK_ROLLBACK_INDEX_UBOOT} "
|
||||
fi
|
||||
}
|
||||
|
||||
function prebuild_security_uboot()
|
||||
{
|
||||
local mode=$1
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
if [ "$RK_SECURITY_OTP_DEBUG" != "true" ]; then
|
||||
UBOOT_COMPILE_COMMANDS="$UBOOT_COMPILE_COMMANDS --burn-key-hash"
|
||||
fi
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
case "${mode:-normal}" in
|
||||
uboot)
|
||||
;;
|
||||
boot)
|
||||
UBOOT_COMPILE_COMMANDS=" \
|
||||
--boot_img $TOP_DIR/u-boot/boot.img \
|
||||
--recovery_img $TOP_DIR/u-boot/recovery.img \
|
||||
$UBOOT_COMPILE_COMMANDS \
|
||||
${RK_ROLLBACK_INDEX_BOOT:+--rollback-index-boot $RK_ROLLBACK_INDEX_BOOT} \
|
||||
${RK_ROLLBACK_INDEX_UBOOT:+--rollback-index-uboot $RK_ROLLBACK_INDEX_UBOOT} "
|
||||
$UBOOT_COMPILE_COMMANDS "
|
||||
;;
|
||||
recovery)
|
||||
UBOOT_COMPILE_COMMANDS=" \
|
||||
--recovery_img $TOP_DIR/u-boot/recovery.img
|
||||
$UBOOT_COMPILE_COMMANDS "
|
||||
;;
|
||||
*)
|
||||
UBOOT_COMPILE_COMMANDS=" \
|
||||
--boot_img $TOP_DIR/u-boot/boot.img \
|
||||
$UBOOT_COMPILE_COMMANDS "
|
||||
test -z "${RK_PACKAGE_FILE_AB}" && \
|
||||
UBOOT_COMPILE_COMMANDS="$UBOOT_COMPILE_COMMANDS --recovery_img $TOP_DIR/u-boot/recovery.img"
|
||||
;;
|
||||
esac
|
||||
|
||||
UBOOT_COMPILE_COMMANDS="$(echo $UBOOT_COMPILE_COMMANDS)"
|
||||
fi
|
||||
}
|
||||
@ -139,6 +166,7 @@ function usageuboot()
|
||||
{
|
||||
check_config RK_UBOOT_DEFCONFIG || return 0
|
||||
prebuild_uboot
|
||||
prebuild_security_uboot $1
|
||||
|
||||
cd u-boot
|
||||
echo "cd u-boot"
|
||||
@ -181,8 +209,6 @@ function usagerootfs()
|
||||
;;
|
||||
debian)
|
||||
;;
|
||||
distro)
|
||||
;;
|
||||
*)
|
||||
echo "make"
|
||||
;;
|
||||
@ -214,6 +240,45 @@ function usagemodules()
|
||||
echo "make ARCH=$RK_ARCH modules -j$RK_JOBS"
|
||||
}
|
||||
|
||||
function usagesecurity()
|
||||
{
|
||||
case "$1" in
|
||||
uboot) usageboot $1;;
|
||||
boot)
|
||||
usageramboot;
|
||||
echo "cp buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img u-boot/boot.img"
|
||||
usageuboot $1;;
|
||||
recovery)
|
||||
usagerecovery;
|
||||
echo "cp buildroot/output/$RK_CFG_RECOVERY/images/recovery.img u-boot/recovery.img"
|
||||
usageuboot $1;;
|
||||
rootfs)
|
||||
usagerootfs;
|
||||
usagesecurity boot;;
|
||||
*);;
|
||||
esac
|
||||
}
|
||||
|
||||
function usagesecurity_uboot()
|
||||
{
|
||||
usageuboot uboot
|
||||
}
|
||||
|
||||
function usagesecurity_boot()
|
||||
{
|
||||
usagesecurity boot
|
||||
}
|
||||
|
||||
function usagesecurity_recovery()
|
||||
{
|
||||
usagesecurity recovery
|
||||
}
|
||||
|
||||
function usagesecurity_rootfs()
|
||||
{
|
||||
usagesecurity rootfs
|
||||
}
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo "Usage: build.sh [OPTIONS]"
|
||||
@ -221,6 +286,7 @@ function usage()
|
||||
echo "BoardConfig*.mk -switch to specified board config"
|
||||
echo "lunch -list current SDK boards and switch to specified board config"
|
||||
echo "uboot -build uboot"
|
||||
echo "uefi -build uefi"
|
||||
echo "spl -build spl"
|
||||
echo "loader -build loader"
|
||||
echo "kernel -build kernel"
|
||||
@ -233,7 +299,6 @@ function usage()
|
||||
echo "yocto -build yocto rootfs"
|
||||
echo "ubuntu -build ubuntu rootfs"
|
||||
echo "debian -build debian rootfs"
|
||||
echo "distro -build distro rootfs"
|
||||
echo "pcba -build pcba"
|
||||
echo "recovery -build recovery"
|
||||
echo "all -build uboot, kernel, rootfs, recovery image"
|
||||
@ -250,8 +315,11 @@ function usage()
|
||||
echo "external/<pkg> -build packages in the dir of external/*"
|
||||
echo ""
|
||||
echo "createkeys -create secureboot root keys"
|
||||
echo "security-rootfs -build rootfs and some relevant images with security paramter"
|
||||
echo "security-boot -build boot with security paramter"
|
||||
echo "security_rootfs -build rootfs and some relevant images with security paramter (just for dm-v)"
|
||||
echo "security_boot -build boot with security paramter"
|
||||
echo "security_uboot -build uboot with security paramter"
|
||||
echo "security_recovery -build recovery with security paramter"
|
||||
echo "security_check -check security paramter if it's good"
|
||||
echo ""
|
||||
echo "Default option is 'allsave'."
|
||||
}
|
||||
@ -318,6 +386,20 @@ function build_check_power_domain(){
|
||||
tmp_grep_file=`mktemp`
|
||||
|
||||
dtc -I dtb -O dts -o ${dump_kernel_dtb_file} ${kernel_file_dtb_dts}.dtb 2>/dev/null
|
||||
|
||||
if [ "$RK_SYSTEM_CHECK_METHOD" = "DM-E" ] ; then
|
||||
if ! grep "compatible = \"linaro,optee-tz\";" $dump_kernel_dtb_file > /dev/null 2>&1 ; then
|
||||
echo "Please add: "
|
||||
echo " optee: optee {"
|
||||
echo " compatible = \"linaro,optee-tz\";"
|
||||
echo " method = \"smc\";"
|
||||
echo " status = \"okay\";"
|
||||
echo " }"
|
||||
echo "To your dts file"
|
||||
return -1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -Pzo "io-domains\s*{(\n|\w|-|;|=|<|>|\"|_|\s|,)*};" $dump_kernel_dtb_file 1>$tmp_grep_file 2>/dev/null; then
|
||||
echo "Not Found io-domains in ${kernel_file_dtb_dts}.dts"
|
||||
rm -f $tmp_grep_file
|
||||
@ -458,29 +540,42 @@ function build_pkg() {
|
||||
finish_build
|
||||
}
|
||||
|
||||
function build_uefi(){
|
||||
build_check_cross_compile
|
||||
local kernel_file_dtb
|
||||
|
||||
if [ "$RK_ARCH" == "arm" ]; then
|
||||
kernel_file_dtb="${TOP_DIR}/kernel/arch/arm/boot/dts/${RK_KERNEL_DTS}.dtb"
|
||||
else
|
||||
kernel_file_dtb="${TOP_DIR}/kernel/arch/arm64/boot/dts/rockchip/${RK_KERNEL_DTS}.dtb"
|
||||
fi
|
||||
|
||||
echo "============Start building uefi============"
|
||||
echo "Copy kernel dtb $kernel_file_dtb to uefi/edk2-platforms/Platform/Rockchip/DeviceTree/rk3588.dtb"
|
||||
echo "========================================="
|
||||
if [ ! -f $kernel_file_dtb ]; then
|
||||
echo "Please compile the kernel before"
|
||||
return -1
|
||||
fi
|
||||
|
||||
cp $kernel_file_dtb uefi/edk2-platforms/Platform/Rockchip/DeviceTree/rk3588.dtb
|
||||
cd uefi
|
||||
./make.sh $RK_UBOOT_DEFCONFIG
|
||||
cd -
|
||||
|
||||
finish_build
|
||||
}
|
||||
|
||||
function build_uboot(){
|
||||
check_config RK_UBOOT_DEFCONFIG || return 0
|
||||
build_check_cross_compile
|
||||
prebuild_uboot
|
||||
prebuild_security_uboot $@
|
||||
|
||||
echo "============Start building uboot============"
|
||||
echo "TARGET_UBOOT_CONFIG=$RK_UBOOT_DEFCONFIG"
|
||||
echo "========================================="
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
if [ -n "$RK_CFG_RAMBOOT" ];then
|
||||
build_ramboot
|
||||
else
|
||||
build_kernel
|
||||
fi
|
||||
|
||||
if [ -n "$RK_CFG_RECOVERY" ]; then
|
||||
build_recovery
|
||||
fi
|
||||
cp -f $TOP_DIR/rockdev/boot.img $TOP_DIR/u-boot/boot.img
|
||||
cp -f $TOP_DIR/rockdev/recovery.img $TOP_DIR/u-boot/recovery.img || true
|
||||
fi
|
||||
|
||||
cd u-boot
|
||||
rm -f *_loader_*.bin
|
||||
if [ "$RK_LOADER_UPDATE_SPL" = "true" ]; then
|
||||
@ -511,6 +606,7 @@ function build_uboot(){
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
ln -rsf $TOP_DIR/u-boot/boot.img $TOP_DIR/rockdev/
|
||||
test -z "${RK_PACKAGE_FILE_AB}" && \
|
||||
ln -rsf $TOP_DIR/u-boot/recovery.img $TOP_DIR/rockdev/ || true
|
||||
fi
|
||||
|
||||
@ -573,6 +669,11 @@ function build_kernel(){
|
||||
ln -sf $TOP_DIR/kernel/$RK_BOOT_IMG $TOP_DIR/rockdev/boot.img
|
||||
fi
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
cp $TOP_DIR/kernel/$RK_BOOT_IMG \
|
||||
$TOP_DIR/u-boot/boot.img
|
||||
fi
|
||||
|
||||
build_check_power_domain
|
||||
|
||||
finish_build
|
||||
@ -636,6 +737,9 @@ function build_ramboot(){
|
||||
ln -rsf buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img \
|
||||
rockdev/boot.img
|
||||
|
||||
cp buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img \
|
||||
u-boot/boot.img
|
||||
|
||||
finish_build
|
||||
}
|
||||
|
||||
@ -740,21 +844,6 @@ function build_debian(){
|
||||
finish_build
|
||||
}
|
||||
|
||||
function build_distro(){
|
||||
check_config RK_DISTRO_DEFCONFIG || return 0
|
||||
|
||||
echo "===========Start building distro==========="
|
||||
echo "TARGET_ARCH=$RK_ARCH"
|
||||
echo "RK_DISTRO_DEFCONFIG=$RK_DISTRO_DEFCONFIG"
|
||||
echo "========================================"
|
||||
|
||||
cd distro
|
||||
make $RK_DISTRO_DEFCONFIG
|
||||
/usr/bin/time -f "you take %E to build distro" distro/make.sh
|
||||
|
||||
finish_build
|
||||
}
|
||||
|
||||
function build_rootfs(){
|
||||
check_config RK_ROOTFS_IMG || return 0
|
||||
|
||||
@ -780,12 +869,6 @@ function build_rootfs(){
|
||||
ln -rsf debian/linaro-rootfs.img \
|
||||
$RK_ROOTFS_DIR/rootfs.ext4
|
||||
;;
|
||||
distro)
|
||||
build_distro
|
||||
for f in $(ls distro/output/images/rootfs.*);do
|
||||
ln -rsf $f $RK_ROOTFS_DIR/
|
||||
done
|
||||
;;
|
||||
*)
|
||||
build_buildroot
|
||||
for f in $(ls buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.*);do
|
||||
@ -810,6 +893,10 @@ function build_recovery(){
|
||||
RK_CFG_RECOVERY=$RK_UPDATE_SDCARD_CFG_RECOVERY
|
||||
fi
|
||||
|
||||
if [ ! -z "$RK_PACKAGE_FILE_AB" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
check_config RK_CFG_RECOVERY || return 0
|
||||
|
||||
echo "==========Start building recovery=========="
|
||||
@ -822,6 +909,9 @@ function build_recovery(){
|
||||
ln -rsf buildroot/output/$RK_CFG_RECOVERY/images/recovery.img \
|
||||
rockdev/recovery.img
|
||||
|
||||
cp buildroot/output/$RK_CFG_RECOVERY/images/recovery.img \
|
||||
u-boot/recovery.img
|
||||
|
||||
finish_build
|
||||
}
|
||||
|
||||
@ -844,10 +934,25 @@ BOOT_FIXED_CONFIGS="
|
||||
CONFIG_BLK_DEV_CRYPTOLOOP
|
||||
CONFIG_DM_VERITY"
|
||||
|
||||
BOOT_OPTEE_FIXED_CONFIGS="
|
||||
CONFIG_TEE
|
||||
CONFIG_OPTEE"
|
||||
|
||||
UBOOT_FIXED_CONFIGS="
|
||||
CONFIG_FIT_SIGNATURE
|
||||
CONFIG_SPL_FIT_SIGNATURE"
|
||||
|
||||
UBOOT_AB_FIXED_CONFIGS="
|
||||
CONFIG_ANDROID_AB"
|
||||
|
||||
ROOTFS_UPDATE_ENGINEBIN_CONFIGS="
|
||||
BR2_PACKAGE_RECOVERY
|
||||
BR2_PACKAGE_RECOVERY_UPDATEENGINEBIN"
|
||||
|
||||
ROOTFS_AB_FIXED_CONFIGS="
|
||||
$ROOTFS_UPDATE_ENGINEBIN_CONFIGS
|
||||
BR2_PACKAGE_RECOVERY_BOOTCONTROL"
|
||||
|
||||
function defconfig_check() {
|
||||
# 1. defconfig 2. fixed config
|
||||
echo debug-$1
|
||||
@ -856,13 +961,26 @@ function defconfig_check() {
|
||||
echo "look for $i"
|
||||
result=$(cat $1 | grep "${i}=y" -w || echo "No found")
|
||||
if [ "$result" = "No found" ]; then
|
||||
echo "${i} Not found"
|
||||
echo -e "\e[41;1;37mSecurity: No found config ${i} in $1 \e[0m"
|
||||
echo "make sure your config include this list"
|
||||
echo "---------------------------------------"
|
||||
echo "$2"
|
||||
echo "---------------------------------------"
|
||||
return -1;
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
function find_string_in_config(){
|
||||
result=$(cat "$2" | grep "$1" || echo "No found")
|
||||
if [ "$result" = "No found" ]; then
|
||||
echo "Security: No found string $1 in $2"
|
||||
return -1;
|
||||
fi
|
||||
return 0;
|
||||
}
|
||||
|
||||
function check_security_condition(){
|
||||
# check security enabled
|
||||
test -z "$RK_SYSTEM_CHECK_METHOD" && return 0
|
||||
@ -873,10 +991,45 @@ function check_security_condition(){
|
||||
return -1
|
||||
fi
|
||||
|
||||
if [ "$RK_SYSTEM_CHECK_METHOD" = "DM-E" ]; then
|
||||
if [ ! -e u-boot/keys/root_passwd ]; then
|
||||
echo "ERROR: No root passwd(u-boot/keys/root_passwd) found in u-boot"
|
||||
echo " echo your root key for sudo to u-boot/keys/root_passwd"
|
||||
echo " some operations need supper user permission when create encrypt image"
|
||||
return -1
|
||||
fi
|
||||
|
||||
if [ ! -e u-boot/keys/system_enc_key ]; then
|
||||
echo "ERROR: No enc key(u-boot/keys/system_enc_key) found in u-boot"
|
||||
echo " Create it by ./build.sh createkeys or move your key to it"
|
||||
return -1
|
||||
fi
|
||||
|
||||
BOOT_FIXED_CONFIGS="${BOOT_FIXED_CONFIGS}
|
||||
${BOOT_OPTEE_FIXED_CONFIGS}"
|
||||
fi
|
||||
|
||||
echo "check kernel defconfig"
|
||||
defconfig_check kernel/arch/$RK_ARCH/configs/$RK_KERNEL_DEFCONFIG "$BOOT_FIXED_CONFIGS"
|
||||
|
||||
if [ ! -z "${RK_PACKAGE_FILE_AB}" ]; then
|
||||
UBOOT_FIXED_CONFIGS="${UBOOT_FIXED_CONFIGS}
|
||||
${UBOOT_AB_FIXED_CONFIGS}"
|
||||
|
||||
defconfig_check buildroot/configs/${RK_CFG_BUILDROOT}_defconfig "$ROOTFS_AB_FIXED_CONFIGS"
|
||||
fi
|
||||
echo "check uboot defconfig"
|
||||
defconfig_check u-boot/configs/${RK_UBOOT_DEFCONFIG}_defconfig "$UBOOT_FIXED_CONFIGS"
|
||||
|
||||
if [ "$RK_SYSTEM_CHECK_METHOD" = "DM-E" ]; then
|
||||
echo "check ramdisk defconfig"
|
||||
defconfig_check buildroot/configs/${RK_CFG_RAMBOOT}_defconfig "$ROOTFS_UPDATE_ENGINEBIN_CONFIGS"
|
||||
fi
|
||||
|
||||
echo "check rootfs defconfig"
|
||||
find_string_in_config "BR2_ROOTFS_OVERLAY=\".*board/rockchip/common/security-system-overlay.*" "buildroot/configs/${RK_CFG_BUILDROOT}_defconfig"
|
||||
|
||||
echo "Security: finish check"
|
||||
}
|
||||
|
||||
function build_all(){
|
||||
@ -939,7 +1092,6 @@ function build_cleanall(){
|
||||
cd -
|
||||
rm -rf buildroot/output
|
||||
rm -rf yocto/build/tmp
|
||||
rm -rf distro/output
|
||||
rm -rf debian/binary
|
||||
rm -rf ubuntu/binary
|
||||
|
||||
@ -1101,12 +1253,26 @@ function create_keys() {
|
||||
test -d u-boot/keys && echo "ERROR: u-boot/keys has existed" && return -1
|
||||
|
||||
mkdir u-boot/keys -p
|
||||
./rkbin/tools/rk_sign_tool kk --bits 2048 --out u-boot/keys
|
||||
ln -s privateKey.pem u-boot/keys/dev.key
|
||||
ln -s publicKey.pem u-boot/keys/dev.pubkey
|
||||
cd u-boot/keys
|
||||
$TOP_DIR/rkbin/tools/rk_sign_tool kk --bits 2048
|
||||
cd -
|
||||
|
||||
ln -s private_key.pem u-boot/keys/dev.key
|
||||
ln -s public_key.pem u-boot/keys/dev.pubkey
|
||||
openssl req -batch -new -x509 -key u-boot/keys/dev.key -out u-boot/keys/dev.crt
|
||||
|
||||
openssl rand -out u-boot/keys/system_enc_key -hex 32
|
||||
}
|
||||
|
||||
function security_is_enabled()
|
||||
{
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" != "true" ]; then
|
||||
echo "No security paramter found in .BoardConfig.mk"
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#=========================
|
||||
# build targets
|
||||
#=========================
|
||||
@ -1155,6 +1321,7 @@ for option in ${OPTIONS}; do
|
||||
toolchain) build_toolchain ;;
|
||||
spl) build_spl ;;
|
||||
uboot) build_uboot ;;
|
||||
uefi) build_uefi ;;
|
||||
loader) build_loader ;;
|
||||
kernel) build_kernel ;;
|
||||
modules) build_modules ;;
|
||||
@ -1166,26 +1333,16 @@ for option in ${OPTIONS}; do
|
||||
info) build_info ;;
|
||||
app/*|external/*) build_pkg $option ;;
|
||||
createkeys) create_keys ;;
|
||||
security-rootfs)
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" != "true" ]; then
|
||||
echo "No security paramter found in .BoardConfig.mk"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
security_boot) security_is_enabled; build_ramboot; build_uboot boot ;;
|
||||
security_uboot) security_is_enabled; build_uboot uboot ;;
|
||||
security_recovery) security_is_enabled; build_recovery; build_uboot recovery ;;
|
||||
security_check) check_security_condition ;;
|
||||
security_rootfs)
|
||||
security_is_enabled
|
||||
build_rootfs
|
||||
build_ramboot
|
||||
build_uboot
|
||||
echo "please update rootfs.img / boot.img / uboot.img"
|
||||
;;
|
||||
security-boot)
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" != "true" ]; then
|
||||
echo "No security paramter found in .BoardConfig.mk"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
build_kernel
|
||||
build_ramboot
|
||||
build_uboot
|
||||
echo "please update rootfs.img / boot.img"
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
#!/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)
|
||||
DEBIAN=$TOP_DIR/distro
|
||||
sudo $DEBIAN/rkdebootstrap --base $* --shrink --package
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -20,18 +20,16 @@ BOARD_CONFIG=$TOP_DIR/device/rockchip/.BoardConfig.mk
|
||||
source $BOARD_CONFIG
|
||||
|
||||
TEMPDIR=${OUTPUT}/tempfile
|
||||
ROOTFS=${OUTPUT}/dmv.img
|
||||
if [ "$MODE" = "DM-E" ]; then
|
||||
ROOTFS=${OUTPUT}/enc.img
|
||||
cipher=aes-cbc-plain
|
||||
key=`cat u-boot/keys/system_enc_key`
|
||||
else
|
||||
ROOTFS=${OUTPUT}/dmv.img
|
||||
fi
|
||||
ROOT_HASH=${TEMPDIR}/root.hash
|
||||
ROOT_HASH_OFFSET=${TEMPDIR}/root.offset
|
||||
INIT_FILE=${TOP_DIR}/buildroot/board/rockchip/common/security-ramdisk-overlay/init
|
||||
PARTITION_CMD=`cat $TOP_DIR/device/rockchip/${RK_TARGET_PRODUCT}/${RK_PARAMETER} | grep CMDLINE`
|
||||
|
||||
if [ -z "`echo ${PARTITION_CMD} | grep \(rootfs\)`" ]; then
|
||||
echo -e "\033[41;1m ERROR: no rootfs in parameter \033[0m"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
PARTITION_NUM=`echo ${PARTITION_CMD} | sed "s/\(rootfs\).*/,/g" | grep -o , | wc -l`
|
||||
ROOTFS_INFO=`ls -l ${INPUT}`
|
||||
|
||||
PACK=TRUE
|
||||
@ -45,10 +43,8 @@ else
|
||||
echo "`ls -l $INPUT`" > ${OUTPUT}/rootfs.info
|
||||
fi
|
||||
|
||||
if [ "$PACK" = "TRUE" ]; then
|
||||
test -d ${TEMPDIR} || mkdir -p ${TEMPDIR}
|
||||
function pack_dmv() {
|
||||
cp ${INPUT} ${ROOTFS}
|
||||
ROOTFS_SIZE=`ls ${ROOTFS} -l | awk '{printf $5}'`
|
||||
HASH_OFFSET=$[(ROOTFS_SIZE / 1024 / 1024 + 2) * 1024 * 1024]
|
||||
tempfile=`mktemp /tmp/temp.XXXXXX`
|
||||
veritysetup --hash-offset=${HASH_OFFSET} format ${ROOTFS} ${ROOTFS} > ${tempfile}
|
||||
@ -57,14 +53,56 @@ if [ "$PACK" = "TRUE" ]; then
|
||||
cp ${tempfile} ${TEMPDIR}/tempfile
|
||||
rm ${tempfile}
|
||||
echo ${HASH_OFFSET} > ${ROOT_HASH_OFFSET}
|
||||
}
|
||||
|
||||
function pack_dme() {
|
||||
sectors=`ls -l ${INPUT} | awk '{printf $5}'`
|
||||
sectors=$[(sectors + (21 * 1024 * 1024) - 1) / 512] # remain 20M for partition info / unit: 512 bytes
|
||||
|
||||
loopdevice=`losetup -f`
|
||||
mappername=encfs-$(shuf -i 1-10000000000000000000 -n 1)
|
||||
dd if=/dev/null of=${ROOTFS} seek=${sectors} bs=512
|
||||
sudo -S losetup ${loopdevice} ${ROOTFS} < u-boot/keys/root_passwd
|
||||
sudo -S dmsetup create $mappername --table "0 $sectors crypt $cipher $key 0 $loopdevice 0 1 allow_discards" < u-boot/keys/root_passwd
|
||||
sudo -S dd if=${INPUT} of=/dev/mapper/${mappername} conv=fsync < u-boot/keys/root_passwd
|
||||
sync && sudo -S dmsetup remove ${mappername} < u-boot/keys/root_passwd
|
||||
sudo -S losetup -d ${loopdevice} < u-boot/keys/root_passwd
|
||||
|
||||
rm ${TEMPDIR}/enc.info || true
|
||||
echo "sectors=${sectors}" > ${TEMPDIR}/enc.info
|
||||
echo "cipher=${cipher}" >> ${TEMPDIR}/enc.info
|
||||
echo "key=${key}" >> ${TEMPDIR}/enc.info
|
||||
}
|
||||
|
||||
if [ "$PACK" = "TRUE" ]; then
|
||||
test -d ${TEMPDIR} || mkdir -p ${TEMPDIR}
|
||||
ROOTFS_SIZE=`ls ${INPUT} -l | awk '{printf $5}'`
|
||||
|
||||
if [ "$MODE" = "DM-V" ]; then
|
||||
pack_dmv
|
||||
elif [ "$MODE" = "DM-E" ]; then
|
||||
pack_dme
|
||||
fi
|
||||
|
||||
ln -rsf ${ROOTFS} ${OUTPUT}/security-system.img
|
||||
fi
|
||||
|
||||
cp ${TOP_DIR}/buildroot/board/rockchip/common/security-ramdisk-overlay/init.in ${INIT_FILE}
|
||||
TMP_HASH=`cat ${ROOT_HASH}`
|
||||
TMP_OFFSET=`cat ${ROOT_HASH_OFFSET}`
|
||||
sed -i "s/OFFSET=/OFFSET=${TMP_OFFSET}/" ${INIT_FILE}
|
||||
sed -i "s/HASH=/HASH=${TMP_HASH}/" ${INIT_FILE}
|
||||
sed -i "s/BLOCK=/BLOCK=${PARTITION_NUM}/" ${INIT_FILE}
|
||||
|
||||
# sed -i "/exec \/sbin/i\#/usr/sbin/veritysetup --hash-offset=${TMP_OFFSET} create vroot /dev/mmcblk0p3 ${TMP_HASH}" ${INIT_FILE}
|
||||
if [ "$MODE" = "DM-V" ]; then
|
||||
TMP_HASH=`cat ${ROOT_HASH}`
|
||||
TMP_OFFSET=`cat ${ROOT_HASH_OFFSET}`
|
||||
sed -i "s/OFFSET=/OFFSET=${TMP_OFFSET}/" ${INIT_FILE}
|
||||
sed -i "s/HASH=/HASH=${TMP_HASH}/" ${INIT_FILE}
|
||||
sed -i "s/ENC_EN=/ENC_EN=false/" ${INIT_FILE}
|
||||
elif [ "$MODE" = "DM-E" ]; then
|
||||
source ${TEMPDIR}/enc.info
|
||||
|
||||
sed -i "s/ENC_EN=/ENC_EN=true/" ${INIT_FILE}
|
||||
sed -i "s/CIPHER=/CIPHER=${cipher}/" ${INIT_FILE}
|
||||
|
||||
echo "Generate misc with key"
|
||||
${COMMON_DIR}/mk-misc.sh ${COMMON_DIR}/../rockimg/${RK_MISC} ${COMMON_DIR}/../rockimg/misc.img 64 $(cat ${TOP_DIR}/u-boot/keys/system_enc_key)
|
||||
fi
|
||||
|
||||
sed -i "s/# exec busybox switch_root/exec busybox switch_root/" ${INIT_FILE}
|
||||
|
||||
@ -18,27 +18,43 @@ fatal()
|
||||
|
||||
usage()
|
||||
{
|
||||
fatal "Usage: $0 <src_dir> <target_image> <fs_type> [size]"
|
||||
echo $@
|
||||
fatal "Usage: $0 <src_dir> <target_image> <fs_type> <size(M|K)|auto(0)> [label]"
|
||||
}
|
||||
|
||||
[ ! $# -lt 3 ] || usage
|
||||
[ ! $# -lt 4 ] || usage "Not enough args${@+: $0 $@}"
|
||||
|
||||
export SRC_DIR=$1
|
||||
export TARGET=$2
|
||||
FS_TYPE=$3
|
||||
SIZE=$4
|
||||
LABEL=$5
|
||||
|
||||
case $SIZE in
|
||||
auto)
|
||||
SIZE_KB=0
|
||||
;;
|
||||
*K)
|
||||
SIZE_KB=$(( ${SIZE%K} ))
|
||||
;;
|
||||
*)
|
||||
SIZE_KB=$(( ${SIZE%M} * 1024 )) # default is MB
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $SIZE_KB | grep -vq [^0-9] || usage "Invalid size: $SIZE_KB"
|
||||
|
||||
if [ "$FS_TYPE" = "ubi" ]; then
|
||||
UBI_VOL_NAME=${5:-test}
|
||||
UBI_VOL_NAME=${LABEL:-test}
|
||||
# default page size 2KB
|
||||
DEFAULT_UBI_PAGE_SIZE=${6:-2048}
|
||||
DEFAULT_UBI_PAGE_SIZE=${RK_UBI_PAGE_SIZE:-2048}
|
||||
# default block size 128KB
|
||||
DEFAULT_UBI_BLOCK_SIZE=${7:-0x20000}
|
||||
DEFAULT_UBI_BLOCK_SIZE=${RK_UBI_BLOCK_SIZE:-0x20000}
|
||||
fi
|
||||
|
||||
TEMP=$(mktemp -u)
|
||||
|
||||
[ -d "$SRC_DIR" ] || usage
|
||||
[ -d "$SRC_DIR" ] || usage "No such src dir: $SRC_DIR"
|
||||
|
||||
copy_to_ntfs()
|
||||
{
|
||||
@ -81,30 +97,32 @@ check_host_tool()
|
||||
|
||||
mkimage()
|
||||
{
|
||||
echo "Making $TARGET from $SRC_DIR with size(${SIZE}M)"
|
||||
echo "Making $TARGET from $SRC_DIR with size(${SIZE_KB}KB)"
|
||||
rm -rf $TARGET
|
||||
dd of=$TARGET bs=1M seek=$SIZE count=0 2>&1 || fatal "Failed to dd image!"
|
||||
dd of=$TARGET bs=1K seek=$SIZE_KB count=0 &>/dev/null || \
|
||||
fatal "Failed to dd image!"
|
||||
case $FS_TYPE in
|
||||
ext[234])
|
||||
if mke2fs -h 2>&1 | grep -wq "\-d"; then
|
||||
mke2fs -t $FS_TYPE $TARGET -d $SRC_DIR || return -1
|
||||
mke2fs -t $FS_TYPE $TARGET -d $SRC_DIR \
|
||||
|| return -1
|
||||
else
|
||||
echo "Detected old mke2fs(doesn't support '-d' option)!"
|
||||
mke2fs -t $FS_TYPE $TARGET || return -1
|
||||
copy_to_image || return -1
|
||||
fi
|
||||
# Set max-mount-counts to 0, and disable the time-dependent checking.
|
||||
tune2fs -c 0 -i 0 $TARGET
|
||||
tune2fs -c 0 -i 0 $TARGET ${LABEL:+-L $LABEL}
|
||||
;;
|
||||
msdos|fat|vfat)
|
||||
# Use fat32 by default
|
||||
mkfs.vfat -F 32 $TARGET && \
|
||||
mkfs.vfat -F 32 $TARGET ${LABEL:+-n $LABEL} && \
|
||||
MTOOLS_SKIP_CHECK=1 \
|
||||
mcopy -bspmn -D s -i $TARGET $SRC_DIR/* ::/
|
||||
;;
|
||||
ntfs)
|
||||
# Enable compression
|
||||
mkntfs -FCQ $TARGET
|
||||
mkntfs -FCQ $TARGET ${LABEL:+-L $LABEL}
|
||||
if check_host_tool ntfscp; then
|
||||
copy_to_ntfs
|
||||
else
|
||||
@ -117,7 +135,7 @@ mkimage()
|
||||
mkimage_auto_sized()
|
||||
{
|
||||
tar cf $TEMP $SRC_DIR &>/dev/null
|
||||
SIZE=$(du -m $TEMP|grep -o "^[0-9]*")
|
||||
SIZE_KB=$(du -k $TEMP|grep -o "^[0-9]*")
|
||||
rm -rf $TEMP
|
||||
echo "Making $TARGET from $SRC_DIR (auto sized)"
|
||||
|
||||
@ -125,8 +143,8 @@ mkimage_auto_sized()
|
||||
RETRY=0
|
||||
|
||||
while true;do
|
||||
EXTRA_SIZE=$(($SIZE / 50))
|
||||
SIZE=$(($SIZE + ($EXTRA_SIZE > 4 ? $EXTRA_SIZE : 4)))
|
||||
EXTRA_SIZE=$(($SIZE_KB / 50))
|
||||
SIZE_KB=$(($SIZE_KB + ($EXTRA_SIZE > 4096 ? $EXTRA_SIZE : 4096)))
|
||||
mkimage && break
|
||||
|
||||
RETRY=$[RETRY+1]
|
||||
@ -164,19 +182,13 @@ mk_ubi_image()
|
||||
|
||||
ubifs_lebsize=$(( $UBI_BLOCK_SIZE - 2 * $UBI_PAGE_SIZE ))
|
||||
ubifs_miniosize=$UBI_PAGE_SIZE
|
||||
partition_size=$(( $SIZE ))
|
||||
|
||||
if [ $partition_size -le 0 ]; then
|
||||
echo "Error: ubifs partition MUST set partition size"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
partition_size_str="$(( $partition_size / 1024 / 1024 ))MB"
|
||||
partition_size_str="$(( $SIZE_KB / 1024 ))MB"
|
||||
output_image=${temp_dir}/${UBI_VOL_NAME}_${ubi_page_size_str}_${ubi_block_size_str}_${partition_size_str}.ubi
|
||||
temp_ubifs_image=$BUILDROOT_IMAGE_DIR/${UBI_VOL_NAME}_${ubi_page_size_str}_${ubi_block_size_str}_${partition_size_str}.ubifs
|
||||
temp_ubinize_file=$BUILDROOT_IMAGE_DIR/${UBI_VOL_NAME}_${ubi_page_size_str}_${ubi_block_size_str}_${partition_size_str}_ubinize.cfg
|
||||
|
||||
ubifs_maxlebcnt=$(( $partition_size / $ubifs_lebsize ))
|
||||
ubifs_maxlebcnt=$(( $SIZE_KB * 1024 / $ubifs_lebsize ))
|
||||
|
||||
echo "ubifs_lebsize=$UBI_BLOCK_SIZE"
|
||||
echo "ubifs_miniosize=$UBI_PAGE_SIZE"
|
||||
@ -202,17 +214,16 @@ mk_ubi_image()
|
||||
|
||||
rm -rf $TARGET
|
||||
case $FS_TYPE in
|
||||
squashfs)
|
||||
mksquashfs $SRC_DIR $TARGET -noappend -comp lz4
|
||||
;;
|
||||
ext[234]|msdos|fat|vfat|ntfs)
|
||||
if [ ! "$SIZE" ]; then
|
||||
if [ $SIZE_KB -eq 0 ]; then
|
||||
mkimage_auto_sized
|
||||
else
|
||||
mkimage && echo "Generated $TARGET"
|
||||
fi
|
||||
;;
|
||||
ubi)
|
||||
[ $SIZE_KB -eq 0 ] && fatal "$FS_TYPE: auto size not supported."
|
||||
|
||||
UBI_PAGE_SIZE=2048
|
||||
UBI_BLOCK_SIZE=0x20000
|
||||
mk_ubi_image
|
||||
@ -225,11 +236,15 @@ case $FS_TYPE in
|
||||
UBI_BLOCK_SIZE=0x40000
|
||||
mk_ubi_image
|
||||
;;
|
||||
squashfs)
|
||||
[ $SIZE_KB -eq 0 ] || fatal "$FS_TYPE: fixed size not supported."
|
||||
mksquashfs $SRC_DIR $TARGET -noappend -comp lz4
|
||||
;;
|
||||
jffs2)
|
||||
[ $SIZE_KB -eq 0 ] || fatal "$FS_TYPE: fixed size not supported."
|
||||
mkfs.jffs2 -r $SRC_DIR -o $TARGET 0x10000 --pad=0x400000 -s 0x1000 -n
|
||||
;;
|
||||
*)
|
||||
echo "File system: $FS_TYPE not support."
|
||||
usage
|
||||
usage "File system: $FS_TYPE not supported."
|
||||
;;
|
||||
esac
|
||||
|
||||
34
common/mk-misc.sh
Executable file
34
common/mk-misc.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
INPUT=$1
|
||||
OUTPUT=$2
|
||||
SIZE=$3
|
||||
BUF=$4
|
||||
|
||||
COMMON_DIR=$(dirname $(readlink -f $0))
|
||||
ROCKIMG_DIR=${COMMON_DIR}/../rockimg
|
||||
|
||||
if [ ! -e ${INPUT} ]; then
|
||||
echo "ERROR: No input file \"${INPUT}\""
|
||||
exit -1
|
||||
fi
|
||||
|
||||
rm ${ROCKIMG_DIR}/${OUTPUT} || true
|
||||
|
||||
if [ ${SIZE} -gt 1024 ]; then
|
||||
echo "ERROR: SIZE bigger than 1K"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
BIG_END=$[SIZE / 256]
|
||||
LIT_END=$[SIZE - (BIG_END * 256)]
|
||||
BIG_END=$(echo "ibase=10;obase=16;${BIG_END}" | bc)
|
||||
LIT_END=$(echo "ibase=10;obase=16;${LIT_END}" | bc)
|
||||
|
||||
dd if=${INPUT} of=${OUTPUT} bs=1k count=10
|
||||
echo -en "\x${LIT_END}\x${BIG_END}" >> ${OUTPUT}
|
||||
echo -n "$BUF" >> ${OUTPUT}
|
||||
SKIP=$[10 * 1024 + SIZE + 2]
|
||||
dd if=${INPUT} of=${OUTPUT} seek=${SKIP} skip=${SKIP} bs=1
|
||||
@ -34,13 +34,17 @@ rk_ramdisk_build_init()
|
||||
{
|
||||
echo "Try to build init for $1"
|
||||
|
||||
if [ "$RK_SYSTEM_CHECK_METHOD" = "DM-V" ]; then
|
||||
SYSTEM_IMAGE=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.squashfs
|
||||
else
|
||||
SYSTEM_IMAGE=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.${RK_ROOTFS_TYPE}
|
||||
fi
|
||||
if [ ! -e "$SYSTEM_IMAGE" ]; then
|
||||
echo "ERROR: Please build system first"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
$COMMON_DIR/mk-dm.sh dm-v $SYSTEM_IMAGE
|
||||
$COMMON_DIR/mk-dm.sh $1 $SYSTEM_IMAGE
|
||||
}
|
||||
|
||||
COMMON_DIR=$(cd `dirname $0`; pwd)
|
||||
@ -100,10 +104,9 @@ eval ROOTFS_IMAGE=\$${RAMDISK_TYPE}_IMG
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
case "$RK_SYSTEM_CHECK_METHOD" in
|
||||
"DM-V")
|
||||
rk_ramdisk_build_init "DM-V"
|
||||
"DM-V" | "DM-E")
|
||||
rk_ramdisk_build_init $RK_SYSTEM_CHECK_METHOD
|
||||
;;
|
||||
# TODO: add DM-S for system encrypt
|
||||
*)
|
||||
echo "do nothing ($RK_SYSTEM_CHECK_METHOD)"
|
||||
esac
|
||||
|
||||
@ -2,360 +2,287 @@
|
||||
|
||||
set -e
|
||||
|
||||
if ! which fakeroot; then
|
||||
echo "fakeroot not found! (sudo apt-get install fakeroot)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR=$(dirname $(realpath $BASH_SOURCE))
|
||||
TOP_DIR=$(realpath $SCRIPT_DIR/../../..)
|
||||
cd $TOP_DIR
|
||||
|
||||
DEV_DIR="$TOP_DIR/device/rockchip"
|
||||
OUT_DIR="$TOP_DIR/buildroot/output"
|
||||
IMG_DIR="$OUT_DIR/$RK_CFG_BUILDROOT/images"
|
||||
|
||||
function unset_board_config_all()
|
||||
{
|
||||
local tmp_file=`mktemp`
|
||||
grep -o "^export.*RK_.*=" `find $TOP_DIR/device/rockchip -name "Board*.mk" -type f` -h | sort | uniq > $tmp_file
|
||||
grep -o "^export.*RK_.*=" `find $DEV_DIR -name "Board*.mk" -type f` -h \
|
||||
| sort | uniq > $tmp_file
|
||||
source $tmp_file
|
||||
rm -f $tmp_file
|
||||
}
|
||||
unset_board_config_all
|
||||
|
||||
source $TOP_DIR/device/rockchip/.BoardConfig.mk
|
||||
source $DEV_DIR/.BoardConfig.mk
|
||||
ROCKDEV=$TOP_DIR/rockdev
|
||||
PARAMETER=$TOP_DIR/device/rockchip/$RK_TARGET_PRODUCT/$RK_PARAMETER
|
||||
if [ "${RK_OEM_DIR}x" != "x" ];then
|
||||
OEM_DIR=$TOP_DIR/device/rockchip/oem/$RK_OEM_DIR
|
||||
PARAMETER=$DEV_DIR/$RK_TARGET_PRODUCT/$RK_PARAMETER
|
||||
MISC_IMG=$DEV_DIR/rockimg/$RK_MISC
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
ROOTFS_IMG=$IMG_DIR/security-system.img
|
||||
else
|
||||
OEM_DIR=
|
||||
ROOTFS_IMG=$TOP_DIR/$RK_ROOTFS_IMG
|
||||
fi
|
||||
USER_DATA_DIR=$TOP_DIR/device/rockchip/userdata/$RK_USERDATA_DIR
|
||||
MISC_IMG=$TOP_DIR/device/rockchip/rockimg/$RK_MISC
|
||||
ROOTFS_IMG=$TOP_DIR/$RK_ROOTFS_IMG
|
||||
ROOTFS_IMG_SOURCE=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.$RK_ROOTFS_TYPE
|
||||
RAMBOOT_IMG=$TOP_DIR/buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img
|
||||
RECOVERY_IMG=$TOP_DIR/buildroot/output/$RK_CFG_RECOVERY/images/recovery.img
|
||||
if which fakeroot; then
|
||||
FAKEROOT_TOOL="`which fakeroot`"
|
||||
else
|
||||
echo -e "Install fakeroot First."
|
||||
echo -e " sudo apt-get install fakeroot"
|
||||
exit -1
|
||||
fi
|
||||
OEM_FAKEROOT_SCRIPT=$ROCKDEV/oem.fs
|
||||
USERDATA_FAKEROOT_SCRIPT=$ROCKDEV/userdata.fs
|
||||
|
||||
ROOTFS_IMG_SOURCE=$IMG_DIR/rootfs.$RK_ROOTFS_TYPE
|
||||
RAMBOOT_IMG=$OUT_DIR/$RK_CFG_RAMBOOT/images/ramboot.img
|
||||
RECOVERY_IMG=$OUT_DIR/$RK_CFG_RECOVERY/images/recovery.img
|
||||
TRUST_IMG=$TOP_DIR/u-boot/trust.img
|
||||
UBOOT_IMG=$TOP_DIR/u-boot/uboot.img
|
||||
BOOT_IMG=$TOP_DIR/kernel/$RK_BOOT_IMG
|
||||
LOADER=$TOP_DIR/u-boot/*_loader_v*.bin
|
||||
SPL=$TOP_DIR/u-boot/*_loader_spl.bin
|
||||
#SPINOR_LOADER=$TOP_DIR/u-boot/*_loader_spinor_v*.bin
|
||||
LOADER=$(echo $TOP_DIR/u-boot/*_loader_*v*.bin | head -1)
|
||||
SPL=$(echo $TOP_DIR/u-boot/*_loader_spl.bin | head -1)
|
||||
MKIMAGE=$SCRIPT_DIR/mk-image.sh
|
||||
|
||||
message() {
|
||||
echo -e "\e[36m $@ \e[0m"
|
||||
}
|
||||
|
||||
fatal() {
|
||||
echo -e "\e[31m $@ \e[0m"
|
||||
exit -1
|
||||
}
|
||||
|
||||
mkdir -p $ROCKDEV
|
||||
|
||||
# Require buildroot host tools to do image packing.
|
||||
if [ ! -d "$TARGET_OUTPUT_DIR" ]; then
|
||||
echo "Source buildroot/build/envsetup.sh"
|
||||
if [ "${RK_CFG_RAMBOOT}x" != "x" ];then
|
||||
message "Source buildroot/build/envsetup.sh"
|
||||
if [ "${RK_CFG_RAMBOOT}" ];then
|
||||
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_RAMBOOT
|
||||
fi
|
||||
if [ "${RK_CFG_BUILDROOT}x" != "x" ];then
|
||||
if [ "${RK_CFG_BUILDROOT}" ];then
|
||||
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_BUILDROOT
|
||||
fi
|
||||
fi
|
||||
|
||||
# NOT support the grow partition
|
||||
get_partition_size() {
|
||||
echo $PARAMETER
|
||||
# Parse size limit from parameter.txt, 0 means unlimited or not exists.
|
||||
partition_size_kb() {
|
||||
PART_NAME=$1
|
||||
PART_STR=$(grep -oE "[^,^:^\(]*\(${PART_NAME}[\)_:][^\)]*\)" $PARAMETER)
|
||||
PART_SIZE=$(echo $PART_STR | grep -oE "^[^@^-]*")
|
||||
echo $(( ${PART_SIZE:-0} / 2 ))
|
||||
}
|
||||
|
||||
PARTITIONS_PREFIX=`echo -n "CMDLINE: mtdparts=rk29xxnand:"`
|
||||
while read line
|
||||
do
|
||||
if [[ $line =~ $PARTITIONS_PREFIX ]]
|
||||
then
|
||||
partitions=`echo $line | sed "s/$PARTITIONS_PREFIX//g"`
|
||||
echo $partitions
|
||||
break
|
||||
# Assert the image's size smaller than parameter.txt's limit
|
||||
assert_size() {
|
||||
PART_NAME="$1"
|
||||
IMG="$2"
|
||||
|
||||
PART_SIZE=$(partition_size_kb $PART_NAME)
|
||||
[ "$PART_SIZE" -gt 0 ] || return 0
|
||||
|
||||
IMG_SIZE=$(stat -c "%s" "$IMG")
|
||||
|
||||
if [ $PART_SIZE -lt $(( "$IMG_SIZE" / 1024 )) ]; then
|
||||
fatal "error: $IMG's size exceed parameter.txt's limit!"
|
||||
fi
|
||||
done < $PARAMETER
|
||||
}
|
||||
|
||||
if [ -z $partitions ]
|
||||
then
|
||||
echo -e "\e[31m $PARAMETER parse no find string \"$PARTITIONS_PREFIX\" or The last line is not empty or other reason\e[0m"
|
||||
return
|
||||
link_image() {
|
||||
SRC="$1"
|
||||
DST="$2"
|
||||
FALLBACK="$3"
|
||||
|
||||
message "Linking $DST from $SRC..."
|
||||
|
||||
if [ ! -e "$SRC" ]; then
|
||||
if [ -e "$FALLBACK" ]; then
|
||||
SRC="$FALLBACK"
|
||||
message "Fallback to $SRC"
|
||||
else
|
||||
message "warning: $SRC not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
PART_NAME_NEED_TO_CHECK=""
|
||||
IFS=,
|
||||
for part in $partitions;
|
||||
do
|
||||
part_size=`echo $part | cut -d '@' -f1`
|
||||
part_name=`echo $part | cut -d '(' -f2|cut -d ')' -f1`
|
||||
ln -rsf "$SRC" "$ROCKDEV/$DST"
|
||||
assert_size "${DST%.img}" "$SRC"
|
||||
|
||||
[[ $part_size =~ "-" ]] && continue
|
||||
message "Done linking $DST"
|
||||
}
|
||||
|
||||
part_size=$(($part_size))
|
||||
part_size_bytes=$[$part_size*512]
|
||||
link_image_optional() {
|
||||
link_image "$@" || true
|
||||
}
|
||||
|
||||
case $part_name in
|
||||
uboot|uboot_[ab])
|
||||
uboot_part_size_bytes=$part_size_bytes
|
||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
||||
pack_image() {
|
||||
SRC="$1"
|
||||
DST="$2"
|
||||
FS_TYPE="$3"
|
||||
SIZE="${4:-$(partition_size_kb "${DST%.img}")}"
|
||||
LABEL="$5"
|
||||
EXTRA_CMD="$6"
|
||||
|
||||
FAKEROOT_SCRIPT="$ROCKDEV/${DST%.img}.fs"
|
||||
|
||||
message "Packing $DST from $SRC..."
|
||||
|
||||
if [ ! -d "$SRC" ]; then
|
||||
message "warning: $SRC not found!"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cat << EOF > $FAKEROOT_SCRIPT
|
||||
#!/bin/sh -e
|
||||
$EXTRA_CMD
|
||||
$MKIMAGE "$SRC" "$ROCKDEV/$DST" "$FS_TYPE" "$SIZE" "$LABEL"
|
||||
EOF
|
||||
|
||||
chmod a+x "$FAKEROOT_SCRIPT"
|
||||
fakeroot -- "$FAKEROOT_SCRIPT"
|
||||
rm -f "$FAKEROOT_SCRIPT"
|
||||
|
||||
assert_size "${DST%.img}" "$ROCKDEV/$DST"
|
||||
|
||||
message "Done packing $DST"
|
||||
}
|
||||
|
||||
# Convert legacy partition variables to new style
|
||||
legacy_partion() {
|
||||
PART_NAME="$1"
|
||||
SRC="$2"
|
||||
FS_TYPE="$3"
|
||||
SIZE="${4:-0}"
|
||||
MOUNT="/$PART_NAME"
|
||||
OPT=""
|
||||
|
||||
[ "$FS_TYPE" ] || return 0
|
||||
[ "$SRC" ] || return 0
|
||||
|
||||
# Fixed size for ubi
|
||||
if [ "$FS_TYPE" = ubi ]; then
|
||||
OPT="fixed"
|
||||
fi
|
||||
|
||||
case $SIZE in
|
||||
*k|*K)
|
||||
SIZE=${SIZE//k/K}
|
||||
;;
|
||||
boot|boot_[ab])
|
||||
boot_part_size_bytes=$part_size_bytes
|
||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
||||
*m|*M)
|
||||
SIZE=${SIZE//m/M}
|
||||
;;
|
||||
recovery)
|
||||
recovery_part_size_bytes=$part_size_bytes
|
||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
||||
;;
|
||||
rootfs|system_[ab])
|
||||
rootfs_part_size_bytes=$part_size_bytes
|
||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
||||
;;
|
||||
oem)
|
||||
oem_part_size_bytes=$part_size_bytes
|
||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
||||
*)
|
||||
SIZE=$(( ${SIZE} / 1024 ))K # default is bytes
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$PART_NAME:$MOUNT:$FS_TYPE:defaults:$SRC:${SIZE}:$OPT"
|
||||
}
|
||||
|
||||
RK_LEGACY_PARTITIONS=" \
|
||||
$(legacy_partion oem "$RK_OEM_DIR" "$RK_OEM_FS_TYPE" "$RK_OEM_PARTITION_SIZE")
|
||||
$(legacy_partion userdata "$RK_USERDATA_DIR" "$RK_USERDATA_FS_TYPE" "$RK_USERDATA_PARTITION_SIZE")
|
||||
"
|
||||
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
# for example:
|
||||
# RK_EXTRA_PARTITIONS="oem:/oem:ext2:defaults:oem_normal:256M:fixed
|
||||
# userdata:/userdata:vfat:errors=remount-ro:userdata_empty:auto"
|
||||
RK_EXTRA_PARTITIONS="${RK_EXTRA_PARTITIONS:-${RK_LEGACY_PARTITIONS}}"
|
||||
|
||||
partition_arg() {
|
||||
PART="$1"
|
||||
I="$2"
|
||||
DEFAULT="$3"
|
||||
|
||||
ARG=$(echo $PART | cut -d':' -f"$I")
|
||||
echo ${ARG:-$DEFAULT}
|
||||
}
|
||||
|
||||
pack_extra_partitions() {
|
||||
for part in ${RK_EXTRA_PARTITIONS//@/ }; do
|
||||
DEV="$(partition_arg "$part" 1)"
|
||||
|
||||
# Dev is either <name> or /dev/.../<name>
|
||||
[ "$DEV" ] || continue
|
||||
PART_NAME="${DEV##*/}"
|
||||
|
||||
MOUNT="$(partition_arg "$part" 2 "/$PART_NAME")"
|
||||
FS_TYPE="$(partition_arg "$part" 3)"
|
||||
|
||||
SRC="$(partition_arg "$part" 5)"
|
||||
|
||||
# Src is either none or relative path to device/rockchip/<name>/
|
||||
# or absolute path
|
||||
case "$SRC" in
|
||||
"")
|
||||
continue
|
||||
;;
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
SRC="$DEV_DIR/$PART_NAME/$SRC"
|
||||
;;
|
||||
esac
|
||||
|
||||
SIZE="$(partition_arg "$part" 6 auto)"
|
||||
OPTS="$(partition_arg "$part" 7)"
|
||||
LABEL=
|
||||
EXTRA_CMD=
|
||||
|
||||
# Special handling for oem
|
||||
if [ "$PART_NAME" = oem ]; then
|
||||
# Skip packing oem when builtin
|
||||
[ "${RK_OEM_BUILDIN_BUILDROOT}" != "YES" ] || continue
|
||||
|
||||
if [ -d "$SRC/www" ]; then
|
||||
EXTRA_CMD="chown -R www-data:www-data $SRC/www"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Skip boot time resize by adding a label
|
||||
if echo $OPTS | grep -wq fixed; then
|
||||
LABEL="$PART_NAME"
|
||||
fi
|
||||
|
||||
pack_image "$SRC" "${PART_NAME}.img" "$FS_TYPE" "$SIZE" "$LABEL" \
|
||||
"$EXTRA_CMD"
|
||||
done
|
||||
}
|
||||
|
||||
check_partition_size() {
|
||||
link_image_optional "$PARAMETER" parameter.txt
|
||||
|
||||
while true
|
||||
do
|
||||
part_name=${PART_NAME_NEED_TO_CHECK##*:}
|
||||
case $part_name in
|
||||
uboot|uboot_[ab])
|
||||
uboot_img=`realpath $ROCKDEV/uboot.img`
|
||||
if [ $uboot_part_size_bytes -lt `du -b $uboot_img | awk '{print $1}'` ]
|
||||
then
|
||||
echo -e "\e[31m error: uboot image size exceed parameter! \e[0m"
|
||||
return -1
|
||||
fi
|
||||
;;
|
||||
boot|boot_[ab])
|
||||
boot_img=`realpath $ROCKDEV/boot.img`
|
||||
if [ $boot_part_size_bytes -lt `du -b $boot_img | awk '{print $1}'` ]
|
||||
then
|
||||
echo -e "\e[31m error: boot image size exceed parameter! \e[0m"
|
||||
return -1
|
||||
fi
|
||||
;;
|
||||
recovery)
|
||||
if [ -f $RECOVERY_IMG ]
|
||||
then
|
||||
if [ $recovery_part_size_bytes -lt `du -b $RECOVERY_IMG | awk '{print $1}'` ]
|
||||
then
|
||||
echo -e "\e[31m error: recovery image size exceed parameter! \e[0m"
|
||||
return -1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
rootfs|system_[ab])
|
||||
rootfs_img=`realpath $ROCKDEV/rootfs.img`
|
||||
if [ -f $rootfs_img ]
|
||||
then
|
||||
if [ $rootfs_part_size_bytes -lt `du -bD $rootfs_img | awk '{print $1}'` ]
|
||||
then
|
||||
echo -e "\e[31m error: rootfs image size exceed parameter! \e[0m"
|
||||
return -1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
PART_NAME_NEED_TO_CHECK=${PART_NAME_NEED_TO_CHECK%:*}
|
||||
if [ -z "$PART_NAME_NEED_TO_CHECK" ]; then
|
||||
break
|
||||
fi
|
||||
link_image_optional "$UBOOT_IMG" uboot.img
|
||||
|
||||
[ "$RK_UBOOT_FORMAT_TYPE" != "fit" ] && \
|
||||
link_image_optional "$TRUST_IMG" trust.img
|
||||
|
||||
link_image_optional "$LOADER" MiniLoaderAll.bin "$SPL"
|
||||
|
||||
[ "$RK_BOOT_IMG" ] && link_image_optional "$BOOT_IMG" boot.img
|
||||
|
||||
[ $RK_CFG_RAMBOOT ] && link_image_optional "$RAMBOOT_IMG" boot.img
|
||||
|
||||
[ "$RK_CFG_RECOVERY" ] && link_image_optional "$RECOVERY_IMG" recovery.img
|
||||
|
||||
[ "$RK_MISC" ] && \
|
||||
link_image_optional "$DEV_DIR/rockimg/misc.img" misc.img "$MISC_IMG"
|
||||
|
||||
[ "$RK_ROOTFS_IMG" ] && \
|
||||
link_image_optional "$ROOTFS_IMG" rootfs.img "$ROOTFS_IMG_SOURCE"
|
||||
|
||||
[ "${RK_OEM_BUILDIN_BUILDROOT}" = "YES" ] && \
|
||||
link_image_optional "$IMG_DIR/oem.img" oem.img
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ]; then
|
||||
for part in boot recovery rootfs;do
|
||||
test -e $TOP_DIR/u-boot/${part}.img &&
|
||||
link_image "$TOP_DIR/u-boot/${part}.img" ${part}.img && \
|
||||
message "Enabled ramdisk security $part..." || true
|
||||
done
|
||||
}
|
||||
|
||||
if [ $RK_ROOTFS_IMG ]
|
||||
then
|
||||
if [ -f $ROOTFS_IMG ]
|
||||
then
|
||||
echo -n "create rootfs.img..."
|
||||
ln -rsf $ROOTFS_IMG $ROCKDEV/rootfs.img
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $ROOTFS_IMG not found!"
|
||||
if [ -f $ROOTFS_IMG_SOURCE ];then
|
||||
echo "Fallback to $ROOTFS_IMG_SOURCE"
|
||||
ln -rsf $ROOTFS_IMG_SOURCE $ROCKDEV/rootfs.img
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $PARAMETER ]
|
||||
then
|
||||
echo -n "create parameter..."
|
||||
ln -rsf $PARAMETER $ROCKDEV/parameter.txt
|
||||
echo "done."
|
||||
else
|
||||
echo -e "\e[31m error: $PARAMETER not found! \e[0m"
|
||||
exit -1
|
||||
fi
|
||||
pack_extra_partitions
|
||||
|
||||
get_partition_size
|
||||
|
||||
if [ $RK_CFG_RECOVERY ]
|
||||
then
|
||||
if [ -f $RECOVERY_IMG ]
|
||||
then
|
||||
echo -n "create recovery.img..."
|
||||
ln -rsf $RECOVERY_IMG $ROCKDEV/recovery.img
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $RECOVERY_IMG not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $RK_MISC ]
|
||||
then
|
||||
if [ -f $MISC_IMG ]
|
||||
then
|
||||
echo -n "create misc.img..."
|
||||
ln -rsf $MISC_IMG $ROCKDEV/misc.img
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $MISC_IMG not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${RK_OEM_BUILDIN_BUILDROOT}x" != "YESx" ]
|
||||
then
|
||||
if [ -d "$OEM_DIR" ]
|
||||
then
|
||||
echo "#!/bin/sh" > $OEM_FAKEROOT_SCRIPT
|
||||
echo "set -e" >> $OEM_FAKEROOT_SCRIPT
|
||||
if [ -d $OEM_DIR/www ]; then
|
||||
echo "chown -R www-data:www-data $OEM_DIR/www" >> $OEM_FAKEROOT_SCRIPT
|
||||
fi
|
||||
if [ "$RK_OEM_FS_TYPE" = "ubi" ]; then
|
||||
echo "$MKIMAGE $OEM_DIR $ROCKDEV/oem.img $RK_OEM_FS_TYPE ${RK_OEM_PARTITION_SIZE:-$oem_part_size_bytes} oem $RK_UBI_PAGE_SIZE $RK_UBI_BLOCK_SIZE" >> $OEM_FAKEROOT_SCRIPT
|
||||
else
|
||||
echo "$MKIMAGE $OEM_DIR $ROCKDEV/oem.img $RK_OEM_FS_TYPE" >> $OEM_FAKEROOT_SCRIPT
|
||||
fi
|
||||
chmod a+x $OEM_FAKEROOT_SCRIPT
|
||||
$FAKEROOT_TOOL -- $OEM_FAKEROOT_SCRIPT
|
||||
rm -f $OEM_FAKEROOT_SCRIPT
|
||||
else
|
||||
echo "warning: $OEM_DIR not found!"
|
||||
fi
|
||||
else
|
||||
if [ -f "$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/oem.img" ]; then
|
||||
ln -sfr $TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/oem.img $ROCKDEV/oem.img
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $RK_USERDATA_DIR ]
|
||||
then
|
||||
if [ -d "$USER_DATA_DIR" ]
|
||||
then
|
||||
echo "#!/bin/sh" > $USERDATA_FAKEROOT_SCRIPT
|
||||
echo "set -e" >> $USERDATA_FAKEROOT_SCRIPT
|
||||
if [ "$RK_USERDATA_FS_TYPE" = "ubi" ]; then
|
||||
echo "$MKIMAGE $USER_DATA_DIR $ROCKDEV/userdata.img $RK_USERDATA_FS_TYPE $RK_USERDATA_PARTITION_SIZE userdata $RK_UBI_PAGE_SIZE $RK_UBI_BLOCK_SIZE" >> $USERDATA_FAKEROOT_SCRIPT
|
||||
else
|
||||
echo "$MKIMAGE $USER_DATA_DIR $ROCKDEV/userdata.img $RK_USERDATA_FS_TYPE" >> $USERDATA_FAKEROOT_SCRIPT
|
||||
fi
|
||||
chmod a+x $USERDATA_FAKEROOT_SCRIPT
|
||||
$FAKEROOT_TOOL -- $USERDATA_FAKEROOT_SCRIPT
|
||||
rm -f $USERDATA_FAKEROOT_SCRIPT
|
||||
else
|
||||
echo "warning: $USER_DATA_DIR not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $UBOOT_IMG ]
|
||||
then
|
||||
echo -n "create uboot.img..."
|
||||
ln -rsf $UBOOT_IMG $ROCKDEV/uboot.img
|
||||
echo "done."
|
||||
else
|
||||
echo -e "\e[31m error: $UBOOT_IMG not found! \e[0m"
|
||||
fi
|
||||
|
||||
if [ "$RK_UBOOT_FORMAT_TYPE" = "fit" ]; then
|
||||
rm -f $ROCKDEV/trust.img
|
||||
echo "uboot fotmat type is fit, so ignore trust.img..."
|
||||
else
|
||||
if [ -f $TRUST_IMG ]
|
||||
then
|
||||
echo -n "create trust.img..."
|
||||
ln -rsf $TRUST_IMG $ROCKDEV/trust.img
|
||||
echo "done."
|
||||
else
|
||||
echo -e "\e[31m error: $TRUST_IMG not found! \e[0m"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $LOADER ]
|
||||
then
|
||||
echo -n "create loader..."
|
||||
ln -rsf $LOADER $ROCKDEV/MiniLoaderAll.bin
|
||||
echo "done."
|
||||
elif [ -f $SPL ]
|
||||
then
|
||||
echo -n "create spl..."
|
||||
ln -rsf $SPL $ROCKDEV/MiniLoaderAll.bin
|
||||
echo "done."
|
||||
else
|
||||
echo -e "\e[31m error: $LOADER not found,or there are multiple loaders! \e[0m"
|
||||
rm $LOADER || true
|
||||
fi
|
||||
|
||||
#if [ -f $SPINOR_LOADER ]
|
||||
#then
|
||||
# echo -n "create spinor loader..."
|
||||
# ln -rsf $SPINOR_LOADER $ROCKDEV/MiniLoaderAll_SpiNor.bin
|
||||
# echo "done."
|
||||
#else
|
||||
# rm $SPINOR_LOADER_PATH 2>/dev/null
|
||||
#fi
|
||||
|
||||
if [ $RK_BOOT_IMG ]
|
||||
then
|
||||
if [ -f $BOOT_IMG ]
|
||||
then
|
||||
echo -n "create boot.img..."
|
||||
ln -rsf $BOOT_IMG $ROCKDEV/boot.img
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $BOOT_IMG not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $RK_CFG_RAMBOOT ]
|
||||
then
|
||||
if [ -f $RAMBOOT_IMG ]
|
||||
then
|
||||
echo -n "create boot.img..."
|
||||
ln -rsf $RAMBOOT_IMG $ROCKDEV/boot.img
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $RAMBOOT_IMG not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||
if [ -f $TOP_DIR/u-boot/boot.img ]
|
||||
then
|
||||
echo -n "Enable ramdisk security bootup, create boot.img..."
|
||||
ln -rsf $TOP_DIR/u-boot/boot.img $ROCKDEV/boot.img
|
||||
if [ -e ${ROCKDEV}/recovery.img ]; then
|
||||
echo "Enable ramdisk security bootup, create recovery.img..."
|
||||
ln -rsf $TOP_DIR/u-boot/recovery.img $ROCKDEV/recovery.img
|
||||
fi
|
||||
|
||||
if [ -e $TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/dmv.img ]; then
|
||||
echo "Enable ramdisk security bootup, create rootfs.img..."
|
||||
ln -rsf $TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/dmv.img $ROCKDEV/rootfs.img
|
||||
fi
|
||||
|
||||
echo "done."
|
||||
else
|
||||
echo "warning: $TOP_DIR/u-boot/boot.img not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
check_partition_size
|
||||
|
||||
echo -e "\e[36m Image: image in rockdev is ready \e[0m"
|
||||
message "Images in $ROCKDEV are ready!"
|
||||
|
||||
@ -8,8 +8,10 @@ RK_LEGACY_PARTITIONS=" \
|
||||
${RK_USERDATA_FS_TYPE:+userdata:/userdata:${RK_USERDATA_FS_TYPE}}
|
||||
"
|
||||
|
||||
# <dev>:<mount point>:<fs type>:<source dir>, for example:
|
||||
# RK_EXTRA_PARTITIONS="oem:/oem:ext2:oem_normal userdata:/userdata:vfat:userdata_empty"
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
# for example:
|
||||
# RK_EXTRA_PARTITIONS="oem:/oem:ext2:defaults:oem_normal:256M:fixed
|
||||
# userdata:/userdata:vfat:errors=remount-ro:userdata_empty:auto"
|
||||
RK_EXTRA_PARTITIONS=${RK_EXTRA_PARTITIONS:-${RK_LEGACY_PARTITIONS}}
|
||||
|
||||
function fixup_root()
|
||||
@ -21,23 +23,33 @@ function fixup_root()
|
||||
${TARGET_DIR}/etc/fstab
|
||||
}
|
||||
|
||||
partition_arg() {
|
||||
PART="$1"
|
||||
I="$2"
|
||||
DEFAULT="$3"
|
||||
|
||||
ARG=$(echo $PART | cut -d':' -f"$I")
|
||||
echo ${ARG:-$DEFAULT}
|
||||
}
|
||||
|
||||
function fixup_part()
|
||||
{
|
||||
echo "Fixing up partition: $@"
|
||||
echo "Fixing up partition: ${@//: }"
|
||||
|
||||
if echo $1 | grep -qE "^/"; then
|
||||
DEV=$1
|
||||
else
|
||||
DEV="PARTLABEL=$1"
|
||||
fi
|
||||
DEV="$(partition_arg "$*" 1)"
|
||||
|
||||
MOUNT=${2:-/$1}
|
||||
FS_TYPE=${3:-auto}
|
||||
OPT=${4:-defaults}
|
||||
# Dev is either <name> or /dev/.../<name>
|
||||
[ "$DEV" ] || return 0
|
||||
echo $DEV | grep -qE "^/" || DEV="PARTLABEL=$DEV"
|
||||
|
||||
MOUNT="$(partition_arg "$*" 2 "/${DEV##*[/=]}")"
|
||||
FS_TYPE="$(partition_arg "$*" 3 ext2)"
|
||||
MOUNT_OPTS="$(partition_arg "$*" 4 defaults)"
|
||||
|
||||
sed -i "/[[:space:]]${MOUNT//\//\\\/}[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||
sed -i "/^${DEV//\//\\\/}[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||
|
||||
echo -e "${DEV}\t${MOUNT}\t${FS_TYPE}\t${OPT}\t0 2" >> \
|
||||
echo -e "${DEV}\t${MOUNT}\t${FS_TYPE}\t${MOUNT_OPTS}\t0 2" >> \
|
||||
${TARGET_DIR}/etc/fstab
|
||||
|
||||
mkdir -p ${TARGET_DIR}/${MOUNT}
|
||||
@ -56,8 +68,21 @@ function fixup_fstab()
|
||||
;;
|
||||
esac
|
||||
|
||||
for part in ${RK_EXTRA_PARTITIONS}; do
|
||||
fixup_part $(echo "${part}" | xargs -d':')
|
||||
sed -i "/[[:space:]]debugfs[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||
echo -e "debugfs\t/sys/kernel/debug\tdebugfs\tdefaults\t0 0" >> \
|
||||
${TARGET_DIR}/etc/fstab
|
||||
|
||||
sed -i "/[[:space:]]pstore[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||
echo -e "pstore\t/sys/fs/pstore\tpstore\tdefaults\t0 0" >> \
|
||||
${TARGET_DIR}/etc/fstab
|
||||
|
||||
if echo $TARGET_DIR | grep -qE "_recovery/target/*$"; then
|
||||
fixup_part "/dev/sda1:/mnt/usb_storage:vfat:defaults::"
|
||||
fixup_part "/dev/mmcblk1p1:/mnt/external_sd:vfat:defaults::"
|
||||
fi
|
||||
|
||||
for part in ${RK_EXTRA_PARTITIONS//@/ }; do
|
||||
fixup_part $part
|
||||
done
|
||||
}
|
||||
|
||||
@ -71,6 +96,19 @@ function add_build_info()
|
||||
${TARGET_DIR}/etc/os-release
|
||||
}
|
||||
|
||||
function add_dirs_and_links()
|
||||
{
|
||||
echo "Adding dirs and links..."
|
||||
|
||||
cd ${TARGET_DIR}
|
||||
mkdir -p mnt/sdcard mnt/usb0
|
||||
ln -sf mnt/usb0 mnt/usb_storage
|
||||
ln -sf mnt/sdcard mnt/external_sd
|
||||
ln -sf mnt/usb0 udisk
|
||||
ln -sf mnt/sdcard sdcard
|
||||
ln -sf userdata data
|
||||
}
|
||||
|
||||
function add_dirs_and_links()
|
||||
{
|
||||
echo "Adding dirs and links..."
|
||||
|
||||
59
rk3126c/BoardConfig-rk3126c-evb-ddr3-v10-slc-nand.mk
Normal file
59
rk3126c/BoardConfig-rk3126c-evb-ddr3-v10-slc-nand.mk
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rk3126
|
||||
# SPL INI
|
||||
export RK_SPL_INI_CONFIG=RK3126MINIALL_WO_FTL.ini
|
||||
# Uboot defconfig fragment,config rk-nand.config
|
||||
export RK_UBOOT_DEFCONFIG_FRAGMENT=rk312x-slc-nand.config
|
||||
# Trust ini config
|
||||
export RK_TRUST_INI_CONFIG=RK3126TOS_LADDR.ini
|
||||
# Uboot size
|
||||
export RK_UBOOT_SIZE_CONFIG=1024\ 2
|
||||
# Trust size
|
||||
export RK_TRUST_SIZE_CONFIG=1024\ 2
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rk3126_linux_defconfig
|
||||
# Kernel defconfig fragment
|
||||
export RK_KERNEL_DEFCONFIG_FRAGMENT=rk312x-slc-nand.config
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rk3126c-evb-ddr3-v10-linux-slc
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm/boot/zImage
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter-buildroot-slc.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rk3126c
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rk312x_recovery
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=rockchip_rk3126c_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rk3126c
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=ubi
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ubi
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ubi
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
|
||||
export RK_USERDATA_PARTITION_SIZE=0xB400000
|
||||
export RK_OEM_PARTITION_SIZE=0x1400000
|
||||
50
rk3126c/BoardConfig-rk3126c-evb-ddr3-v10.mk
Executable file
50
rk3126c/BoardConfig-rk3126c-evb-ddr3-v10.mk
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rk3126
|
||||
# Trust ini config
|
||||
export RK_TRUST_INI_CONFIG=RK3126TOS_LADDR.ini
|
||||
# Uboot size
|
||||
export RK_UBOOT_SIZE_CONFIG=1024\ 2
|
||||
# Trust size
|
||||
export RK_TRUST_SIZE_CONFIG=1024\ 2
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rk3126_linux_defconfig
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rk3126c-evb-ddr3-v10-linux
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm/boot/zImage
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter-buildroot.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rk3126c
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rk312x_recovery
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=rockchip_rk3126c_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rk3126c
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=squashfs
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
14
rk3126c/parameter-buildroot-slc.txt
Normal file
14
rk3126c/parameter-buildroot-slc.txt
Normal file
@ -0,0 +1,14 @@
|
||||
FIRMWARE_VER: 8.1
|
||||
MACHINE_MODEL: RK3126
|
||||
MACHINE_ID: 007
|
||||
MANUFACTURER: RK3126
|
||||
MAGIC: 0x5041524B
|
||||
ATAG: 0x00200800
|
||||
MACHINE: 3126
|
||||
CHECK_MASK: 0x80
|
||||
PWR_HLD: 0,0,A,0,1
|
||||
TYPE: GPT
|
||||
CMDLINE: mtdparts=rk29xxnand:0x0000800@0x00001800(vnvm),0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00000800@0x00006000(misc),0x00004000@0x00006800(boot),0x00007000@0x0000a800(recovery),0x00018000@0x00011800(rootfs),0x0000A000@0x00029800(oem),-@0x00033800(userdata:grow)
|
||||
uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
|
||||
# partition size default
|
||||
# 1MB(vnvm),4MB(uboot),4MB(trust),1MB(misc),8MB(boot),14MB(recovery),20MB(oem),48MB(rootfs),-(userdata)
|
||||
46
rk3128/BoardConfig-rk3128-evb-ddr3-v10.mk
Executable file
46
rk3128/BoardConfig-rk3128-evb-ddr3-v10.mk
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rk3128
|
||||
# Trust ini config
|
||||
export RK_TRUST_INI_CONFIG=RK3128TOS.ini
|
||||
# Uboot size
|
||||
export RK_UBOOT_SIZE_CONFIG=1024\ 2
|
||||
# Trust size
|
||||
export RK_TRUST_SIZE_CONFIG=1024\ 2
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rk312x_linux_defconfig
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rk3128-evb-ddr3-v10-linux
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm/boot/zImage
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter-buildroot.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rk312x
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rk312x_recovery
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=rockchip_rk3128_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rk3128
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=squashfs
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
53
rk3326/BoardConfig-rk3326-evb-lp3-v12-32bit.mk
Executable file
53
rk3326/BoardConfig-rk3326-evb-lp3-v12-32bit.mk
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm64
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rk3326
|
||||
# Trust choose ignore bl32, including --ignore-bl32
|
||||
export TRUST_PACK_IGNORE_BL32=
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rk3326_linux_defconfig
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rk3326-evb-lp3-v12-linux
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm64/boot/Image
|
||||
export RK_KERNEL_ZIMG=kernel/arch/arm64/boot/Image.lz4
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rk3326_32
|
||||
# Debian 10 config
|
||||
export RK_DISTRO_DEFCONFIG=rk3326_defconfig
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rk3326_recovery
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=rockchip_rk3326_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rk3326
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=ext4
|
||||
# Set debian version (debian10: buster, debian11: bullseye)
|
||||
export RK_DEBIAN_VERSION=buster
|
||||
# yocto machine
|
||||
export RK_YOCTO_MACHINE=rockchip-rk3326-evb
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
53
rk3326/BoardConfig-rk3326-evb-lp3-v12.mk
Executable file
53
rk3326/BoardConfig-rk3326-evb-lp3-v12.mk
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm64
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rk3326
|
||||
# Trust choose ignore bl32, including --ignore-bl32
|
||||
export TRUST_PACK_IGNORE_BL32=
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rk3326_linux_defconfig
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rk3326-evb-lp3-v12-linux
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm64/boot/Image
|
||||
export RK_KERNEL_ZIMG=kernel/arch/arm64/boot/Image.lz4
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rk3326_64
|
||||
# Debian 10 config
|
||||
export RK_DISTRO_DEFCONFIG=rk3326_defconfig
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rk3326_recovery
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=rockchip_rk3326_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rk3326
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=ext4
|
||||
# Set debian version (debian10: buster, debian11: bullseye)
|
||||
export RK_DEBIAN_VERSION=buster
|
||||
# yocto machine
|
||||
export RK_YOCTO_MACHINE=rockchip-rk3326-evb
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
4
rk3588/BoardConfig-ab-base.mk
Normal file
4
rk3588/BoardConfig-ab-base.mk
Normal file
@ -0,0 +1,4 @@
|
||||
export RK_PACKAGE_FILE_AB=rk3588-package-file-ab
|
||||
export RK_MISC=blank-misc.img
|
||||
export RK_PARAMETER=parameter-ab.txt
|
||||
export RK_CFG_RECOVERY=
|
||||
@ -44,16 +44,13 @@ export RK_YOCTO_MACHINE=
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set ramboot image type
|
||||
export RK_RAMBOOT_TYPE=
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_nvr
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
export RK_EXTRA_PARTITIONS=" \
|
||||
oem:/oem:ext2:defaults:oem_nvr:auto:resize
|
||||
userdata:/userdata:ext2:defaults:userdata_empty:auto:resize
|
||||
"
|
||||
# OEM build on buildroot
|
||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_empty
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
|
||||
@ -29,7 +29,7 @@ export RK_RECOVERY_FIT_ITS=boot4recovery.its
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=
|
||||
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set ramboot image type
|
||||
export RK_RAMBOOT_TYPE=
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
export RK_EXTRA_PARTITIONS=" \
|
||||
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||
"
|
||||
# OEM build on buildroot
|
||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
# Define pre-build script for this board
|
||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
||||
# Define package-file
|
||||
export RK_PACKAGE_FILE=rk3588-package-file
|
||||
|
||||
@ -29,7 +29,7 @@ export RK_RECOVERY_FIT_ITS=boot4recovery.its
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=
|
||||
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set ramboot image type
|
||||
export RK_RAMBOOT_TYPE=
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
export RK_EXTRA_PARTITIONS=" \
|
||||
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||
"
|
||||
# OEM build on buildroot
|
||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
# Define pre-build script for this board
|
||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
||||
# Define package-file
|
||||
export RK_PACKAGE_FILE=rk3588-package-file
|
||||
|
||||
@ -29,7 +29,7 @@ export RK_RECOVERY_FIT_ITS=boot4recovery.its
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=
|
||||
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set ramboot image type
|
||||
export RK_RAMBOOT_TYPE=
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||
export RK_EXTRA_PARTITIONS=" \
|
||||
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||
"
|
||||
# OEM build on buildroot
|
||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||
#userdata config
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
# Define pre-build script for this board
|
||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
||||
# Define package-file
|
||||
export RK_PACKAGE_FILE=rk3588-package-file
|
||||
|
||||
11
rk3588/parameter-ab.txt
Normal file
11
rk3588/parameter-ab.txt
Normal file
@ -0,0 +1,11 @@
|
||||
FIRMWARE_VER: 1.0
|
||||
MACHINE_MODEL: RK3588
|
||||
MACHINE_ID: 007
|
||||
MANUFACTURER: RK3588
|
||||
MAGIC: 0x5041524B
|
||||
ATAG: 0x00200800
|
||||
MACHINE: 0xffffffff
|
||||
CHECK_MASK: 0x80
|
||||
PWR_HLD: 0,0,A,0,1
|
||||
TYPE: GPT
|
||||
CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot_a),0x00040000@0x00028000(boot_b),0x00010000@0x00068000(backup),0x00e00000@0x00078000(system_a),0x00e00000@0x00e78000(system_b),0x00040000@0x01c78000(oem),-@0x01cb8000(userdata:grow)
|
||||
@ -8,5 +8,6 @@ MACHINE: 0xffffffff
|
||||
CHECK_MASK: 0x80
|
||||
PWR_HLD: 0,0,A,0,1
|
||||
TYPE: GPT
|
||||
CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),0x01c00000@0x00078000(rootfs),0x00040000@0x01c78000(oem),-@0x01d18000(userdata:grow)
|
||||
CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(misc),0x00020000@0x00008000(boot),0x00040000@0x00028000(recovery),0x00010000@0x00068000(backup),0x01c00000@0x00078000(rootfs),0x00040000@0x01c78000(oem),-@0x01cb8000(userdata:grow)
|
||||
uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
|
||||
uuid:boot=7A3F0000-0000-446A-8000-702F00006273
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Target arch
|
||||
export RK_ARCH=arm
|
||||
# Uboot defconfig
|
||||
export RK_UBOOT_DEFCONFIG=rv1126
|
||||
# Uboot image format type: fit(flattened image tree)
|
||||
export RK_UBOOT_FORMAT_TYPE=fit
|
||||
# Kernel defconfig
|
||||
export RK_KERNEL_DEFCONFIG=rv1126_defconfig
|
||||
# Kernel defconfig fragment
|
||||
export RK_KERNEL_DEFCONFIG_FRAGMENT=rv1126-dictionary-pen.config
|
||||
# Kernel dts
|
||||
export RK_KERNEL_DTS=rv1126-dictionary-pen-v11
|
||||
# boot image type
|
||||
export RK_BOOT_IMG=zboot.img
|
||||
# kernel image path
|
||||
export RK_KERNEL_IMG=kernel/arch/arm/boot/zImage
|
||||
# kernel image format type: fit(flattened image tree)
|
||||
export RK_KERNEL_FIT_ITS=boot.its
|
||||
# parameter for GPT table
|
||||
export RK_PARAMETER=parameter-buildroot.txt
|
||||
# Buildroot config
|
||||
export RK_CFG_BUILDROOT=rockchip_rv1126_rv1109_weston_qt
|
||||
# Recovery config
|
||||
export RK_CFG_RECOVERY=rockchip_rv1126_rv1109_recovery
|
||||
# Recovery image format type: fit(flattened image tree)
|
||||
export RK_RECOVERY_FIT_ITS=boot4recovery.its
|
||||
# ramboot config
|
||||
export RK_CFG_RAMBOOT=
|
||||
# Pcba config
|
||||
export RK_CFG_PCBA=
|
||||
# Build jobs
|
||||
export RK_JOBS=12
|
||||
# target chip
|
||||
export RK_TARGET_PRODUCT=rv1126_rv1109
|
||||
# Set rootfs type, including ext2 ext4 squashfs
|
||||
export RK_ROOTFS_TYPE=ext4
|
||||
# rootfs image path
|
||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||
# Set ramboot image type
|
||||
export RK_RAMBOOT_TYPE=
|
||||
# Set oem partition type, including ext2 squashfs
|
||||
export RK_OEM_FS_TYPE=ext2
|
||||
# Set userdata partition type, including ext2, fat
|
||||
export RK_USERDATA_FS_TYPE=ext2
|
||||
#OEM config
|
||||
export RK_OEM_DIR=oem_normal
|
||||
# OEM build on buildroot
|
||||
export RK_OEM_BUILDIN_BUILDROOT=NO
|
||||
#userdata config, if not define this, system will format by RK_USERDATA_FS_TYPE
|
||||
export RK_USERDATA_DIR=userdata_normal
|
||||
#misc image
|
||||
export RK_MISC=wipe_all-misc.img
|
||||
#choose enable distro module
|
||||
export RK_DISTRO_MODULE=
|
||||
# Define pre-build script for this board
|
||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
||||
# Define package-file for update.img
|
||||
export RK_PACKAGE_FILE=rv1126_rv1109-package-file
|
||||
Reference in New Issue
Block a user