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
|
|
||||||
297
common/build.sh
297
common/build.sh
@ -95,7 +95,6 @@ if [ ! -L "$BOARD_CONFIG" -a "$1" != "lunch" ]; then
|
|||||||
fi
|
fi
|
||||||
unset_board_config_all
|
unset_board_config_all
|
||||||
[ -L "$BOARD_CONFIG" ] && source $BOARD_CONFIG
|
[ -L "$BOARD_CONFIG" ] && source $BOARD_CONFIG
|
||||||
source device/rockchip/common/Version.mk
|
|
||||||
|
|
||||||
function prebuild_uboot()
|
function prebuild_uboot()
|
||||||
{
|
{
|
||||||
@ -111,17 +110,45 @@ function prebuild_uboot()
|
|||||||
UBOOT_COMPILE_COMMANDS="$(echo $UBOOT_COMPILE_COMMANDS)"
|
UBOOT_COMPILE_COMMANDS="$(echo $UBOOT_COMPILE_COMMANDS)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$RK_SECURITY_OTP_DEBUG" != "true" ]; then
|
|
||||||
UBOOT_COMPILE_COMMANDS="$UBOOT_COMPILE_COMMANDS --burn-key-hash"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||||
UBOOT_COMPILE_COMMANDS=" \
|
UBOOT_COMPILE_COMMANDS=" \
|
||||||
--boot_img $TOP_DIR/u-boot/boot.img \
|
|
||||||
--recovery_img $TOP_DIR/u-boot/recovery.img \
|
|
||||||
$UBOOT_COMPILE_COMMANDS \
|
$UBOOT_COMPILE_COMMANDS \
|
||||||
${RK_ROLLBACK_INDEX_BOOT:+--rollback-index-boot $RK_ROLLBACK_INDEX_BOOT} \
|
${RK_ROLLBACK_INDEX_BOOT:+--rollback-index-boot $RK_ROLLBACK_INDEX_BOOT} \
|
||||||
${RK_ROLLBACK_INDEX_UBOOT:+--rollback-index-uboot $RK_ROLLBACK_INDEX_UBOOT} "
|
${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
|
||||||
|
|
||||||
|
case "${mode:-normal}" in
|
||||||
|
uboot)
|
||||||
|
;;
|
||||||
|
boot)
|
||||||
|
UBOOT_COMPILE_COMMANDS=" \
|
||||||
|
--boot_img $TOP_DIR/u-boot/boot.img \
|
||||||
|
$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)"
|
UBOOT_COMPILE_COMMANDS="$(echo $UBOOT_COMPILE_COMMANDS)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -139,6 +166,7 @@ function usageuboot()
|
|||||||
{
|
{
|
||||||
check_config RK_UBOOT_DEFCONFIG || return 0
|
check_config RK_UBOOT_DEFCONFIG || return 0
|
||||||
prebuild_uboot
|
prebuild_uboot
|
||||||
|
prebuild_security_uboot $1
|
||||||
|
|
||||||
cd u-boot
|
cd u-boot
|
||||||
echo "cd u-boot"
|
echo "cd u-boot"
|
||||||
@ -181,8 +209,6 @@ function usagerootfs()
|
|||||||
;;
|
;;
|
||||||
debian)
|
debian)
|
||||||
;;
|
;;
|
||||||
distro)
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "make"
|
echo "make"
|
||||||
;;
|
;;
|
||||||
@ -214,6 +240,45 @@ function usagemodules()
|
|||||||
echo "make ARCH=$RK_ARCH modules -j$RK_JOBS"
|
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()
|
function usage()
|
||||||
{
|
{
|
||||||
echo "Usage: build.sh [OPTIONS]"
|
echo "Usage: build.sh [OPTIONS]"
|
||||||
@ -221,6 +286,7 @@ function usage()
|
|||||||
echo "BoardConfig*.mk -switch to specified board config"
|
echo "BoardConfig*.mk -switch to specified board config"
|
||||||
echo "lunch -list current SDK boards and switch to specified board config"
|
echo "lunch -list current SDK boards and switch to specified board config"
|
||||||
echo "uboot -build uboot"
|
echo "uboot -build uboot"
|
||||||
|
echo "uefi -build uefi"
|
||||||
echo "spl -build spl"
|
echo "spl -build spl"
|
||||||
echo "loader -build loader"
|
echo "loader -build loader"
|
||||||
echo "kernel -build kernel"
|
echo "kernel -build kernel"
|
||||||
@ -233,7 +299,6 @@ function usage()
|
|||||||
echo "yocto -build yocto rootfs"
|
echo "yocto -build yocto rootfs"
|
||||||
echo "ubuntu -build ubuntu rootfs"
|
echo "ubuntu -build ubuntu rootfs"
|
||||||
echo "debian -build debian rootfs"
|
echo "debian -build debian rootfs"
|
||||||
echo "distro -build distro rootfs"
|
|
||||||
echo "pcba -build pcba"
|
echo "pcba -build pcba"
|
||||||
echo "recovery -build recovery"
|
echo "recovery -build recovery"
|
||||||
echo "all -build uboot, kernel, rootfs, recovery image"
|
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 "external/<pkg> -build packages in the dir of external/*"
|
||||||
echo ""
|
echo ""
|
||||||
echo "createkeys -create secureboot root keys"
|
echo "createkeys -create secureboot root keys"
|
||||||
echo "security-rootfs -build rootfs and some relevant images 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_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 ""
|
||||||
echo "Default option is 'allsave'."
|
echo "Default option is 'allsave'."
|
||||||
}
|
}
|
||||||
@ -318,6 +386,20 @@ function build_check_power_domain(){
|
|||||||
tmp_grep_file=`mktemp`
|
tmp_grep_file=`mktemp`
|
||||||
|
|
||||||
dtc -I dtb -O dts -o ${dump_kernel_dtb_file} ${kernel_file_dtb_dts}.dtb 2>/dev/null
|
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
|
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"
|
echo "Not Found io-domains in ${kernel_file_dtb_dts}.dts"
|
||||||
rm -f $tmp_grep_file
|
rm -f $tmp_grep_file
|
||||||
@ -458,29 +540,42 @@ function build_pkg() {
|
|||||||
finish_build
|
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(){
|
function build_uboot(){
|
||||||
check_config RK_UBOOT_DEFCONFIG || return 0
|
check_config RK_UBOOT_DEFCONFIG || return 0
|
||||||
build_check_cross_compile
|
build_check_cross_compile
|
||||||
prebuild_uboot
|
prebuild_uboot
|
||||||
|
prebuild_security_uboot $@
|
||||||
|
|
||||||
echo "============Start building uboot============"
|
echo "============Start building uboot============"
|
||||||
echo "TARGET_UBOOT_CONFIG=$RK_UBOOT_DEFCONFIG"
|
echo "TARGET_UBOOT_CONFIG=$RK_UBOOT_DEFCONFIG"
|
||||||
echo "========================================="
|
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
|
cd u-boot
|
||||||
rm -f *_loader_*.bin
|
rm -f *_loader_*.bin
|
||||||
if [ "$RK_LOADER_UPDATE_SPL" = "true" ]; then
|
if [ "$RK_LOADER_UPDATE_SPL" = "true" ]; then
|
||||||
@ -511,7 +606,8 @@ function build_uboot(){
|
|||||||
|
|
||||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||||
ln -rsf $TOP_DIR/u-boot/boot.img $TOP_DIR/rockdev/
|
ln -rsf $TOP_DIR/u-boot/boot.img $TOP_DIR/rockdev/
|
||||||
ln -rsf $TOP_DIR/u-boot/recovery.img $TOP_DIR/rockdev/ || true
|
test -z "${RK_PACKAGE_FILE_AB}" && \
|
||||||
|
ln -rsf $TOP_DIR/u-boot/recovery.img $TOP_DIR/rockdev/ || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
@ -573,6 +669,11 @@ function build_kernel(){
|
|||||||
ln -sf $TOP_DIR/kernel/$RK_BOOT_IMG $TOP_DIR/rockdev/boot.img
|
ln -sf $TOP_DIR/kernel/$RK_BOOT_IMG $TOP_DIR/rockdev/boot.img
|
||||||
fi
|
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
|
build_check_power_domain
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
@ -636,6 +737,9 @@ function build_ramboot(){
|
|||||||
ln -rsf buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img \
|
ln -rsf buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img \
|
||||||
rockdev/boot.img
|
rockdev/boot.img
|
||||||
|
|
||||||
|
cp buildroot/output/$RK_CFG_RAMBOOT/images/ramboot.img \
|
||||||
|
u-boot/boot.img
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,21 +844,6 @@ function build_debian(){
|
|||||||
finish_build
|
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(){
|
function build_rootfs(){
|
||||||
check_config RK_ROOTFS_IMG || return 0
|
check_config RK_ROOTFS_IMG || return 0
|
||||||
|
|
||||||
@ -780,12 +869,6 @@ function build_rootfs(){
|
|||||||
ln -rsf debian/linaro-rootfs.img \
|
ln -rsf debian/linaro-rootfs.img \
|
||||||
$RK_ROOTFS_DIR/rootfs.ext4
|
$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
|
build_buildroot
|
||||||
for f in $(ls buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.*);do
|
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
|
RK_CFG_RECOVERY=$RK_UPDATE_SDCARD_CFG_RECOVERY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$RK_PACKAGE_FILE_AB" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
check_config RK_CFG_RECOVERY || return 0
|
check_config RK_CFG_RECOVERY || return 0
|
||||||
|
|
||||||
echo "==========Start building recovery=========="
|
echo "==========Start building recovery=========="
|
||||||
@ -822,6 +909,9 @@ function build_recovery(){
|
|||||||
ln -rsf buildroot/output/$RK_CFG_RECOVERY/images/recovery.img \
|
ln -rsf buildroot/output/$RK_CFG_RECOVERY/images/recovery.img \
|
||||||
rockdev/recovery.img
|
rockdev/recovery.img
|
||||||
|
|
||||||
|
cp buildroot/output/$RK_CFG_RECOVERY/images/recovery.img \
|
||||||
|
u-boot/recovery.img
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,10 +934,25 @@ BOOT_FIXED_CONFIGS="
|
|||||||
CONFIG_BLK_DEV_CRYPTOLOOP
|
CONFIG_BLK_DEV_CRYPTOLOOP
|
||||||
CONFIG_DM_VERITY"
|
CONFIG_DM_VERITY"
|
||||||
|
|
||||||
|
BOOT_OPTEE_FIXED_CONFIGS="
|
||||||
|
CONFIG_TEE
|
||||||
|
CONFIG_OPTEE"
|
||||||
|
|
||||||
UBOOT_FIXED_CONFIGS="
|
UBOOT_FIXED_CONFIGS="
|
||||||
CONFIG_FIT_SIGNATURE
|
CONFIG_FIT_SIGNATURE
|
||||||
CONFIG_SPL_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() {
|
function defconfig_check() {
|
||||||
# 1. defconfig 2. fixed config
|
# 1. defconfig 2. fixed config
|
||||||
echo debug-$1
|
echo debug-$1
|
||||||
@ -856,13 +961,26 @@ function defconfig_check() {
|
|||||||
echo "look for $i"
|
echo "look for $i"
|
||||||
result=$(cat $1 | grep "${i}=y" -w || echo "No found")
|
result=$(cat $1 | grep "${i}=y" -w || echo "No found")
|
||||||
if [ "$result" = "No found" ]; then
|
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;
|
return -1;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
return 0
|
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(){
|
function check_security_condition(){
|
||||||
# check security enabled
|
# check security enabled
|
||||||
test -z "$RK_SYSTEM_CHECK_METHOD" && return 0
|
test -z "$RK_SYSTEM_CHECK_METHOD" && return 0
|
||||||
@ -873,10 +991,45 @@ function check_security_condition(){
|
|||||||
return -1
|
return -1
|
||||||
fi
|
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"
|
echo "check kernel defconfig"
|
||||||
defconfig_check kernel/arch/$RK_ARCH/configs/$RK_KERNEL_DEFCONFIG "$BOOT_FIXED_CONFIGS"
|
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"
|
echo "check uboot defconfig"
|
||||||
defconfig_check u-boot/configs/${RK_UBOOT_DEFCONFIG}_defconfig "$UBOOT_FIXED_CONFIGS"
|
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(){
|
function build_all(){
|
||||||
@ -939,7 +1092,6 @@ function build_cleanall(){
|
|||||||
cd -
|
cd -
|
||||||
rm -rf buildroot/output
|
rm -rf buildroot/output
|
||||||
rm -rf yocto/build/tmp
|
rm -rf yocto/build/tmp
|
||||||
rm -rf distro/output
|
|
||||||
rm -rf debian/binary
|
rm -rf debian/binary
|
||||||
rm -rf ubuntu/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
|
test -d u-boot/keys && echo "ERROR: u-boot/keys has existed" && return -1
|
||||||
|
|
||||||
mkdir u-boot/keys -p
|
mkdir u-boot/keys -p
|
||||||
./rkbin/tools/rk_sign_tool kk --bits 2048 --out u-boot/keys
|
cd u-boot/keys
|
||||||
ln -s privateKey.pem u-boot/keys/dev.key
|
$TOP_DIR/rkbin/tools/rk_sign_tool kk --bits 2048
|
||||||
ln -s publicKey.pem u-boot/keys/dev.pubkey
|
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 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
|
# build targets
|
||||||
#=========================
|
#=========================
|
||||||
@ -1155,6 +1321,7 @@ for option in ${OPTIONS}; do
|
|||||||
toolchain) build_toolchain ;;
|
toolchain) build_toolchain ;;
|
||||||
spl) build_spl ;;
|
spl) build_spl ;;
|
||||||
uboot) build_uboot ;;
|
uboot) build_uboot ;;
|
||||||
|
uefi) build_uefi ;;
|
||||||
loader) build_loader ;;
|
loader) build_loader ;;
|
||||||
kernel) build_kernel ;;
|
kernel) build_kernel ;;
|
||||||
modules) build_modules ;;
|
modules) build_modules ;;
|
||||||
@ -1166,26 +1333,16 @@ for option in ${OPTIONS}; do
|
|||||||
info) build_info ;;
|
info) build_info ;;
|
||||||
app/*|external/*) build_pkg $option ;;
|
app/*|external/*) build_pkg $option ;;
|
||||||
createkeys) create_keys ;;
|
createkeys) create_keys ;;
|
||||||
security-rootfs)
|
security_boot) security_is_enabled; build_ramboot; build_uboot boot ;;
|
||||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" != "true" ]; then
|
security_uboot) security_is_enabled; build_uboot uboot ;;
|
||||||
echo "No security paramter found in .BoardConfig.mk"
|
security_recovery) security_is_enabled; build_recovery; build_uboot recovery ;;
|
||||||
exit 0
|
security_check) check_security_condition ;;
|
||||||
fi
|
security_rootfs)
|
||||||
|
security_is_enabled
|
||||||
build_rootfs
|
build_rootfs
|
||||||
build_ramboot
|
build_ramboot
|
||||||
build_uboot
|
build_uboot
|
||||||
echo "please update rootfs.img / boot.img / uboot.img"
|
echo "please update rootfs.img / boot.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
|
|
||||||
;;
|
;;
|
||||||
*) usage ;;
|
*) usage ;;
|
||||||
esac
|
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
|
source $BOARD_CONFIG
|
||||||
|
|
||||||
TEMPDIR=${OUTPUT}/tempfile
|
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=${TEMPDIR}/root.hash
|
||||||
ROOT_HASH_OFFSET=${TEMPDIR}/root.offset
|
ROOT_HASH_OFFSET=${TEMPDIR}/root.offset
|
||||||
INIT_FILE=${TOP_DIR}/buildroot/board/rockchip/common/security-ramdisk-overlay/init
|
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}`
|
ROOTFS_INFO=`ls -l ${INPUT}`
|
||||||
|
|
||||||
PACK=TRUE
|
PACK=TRUE
|
||||||
@ -45,10 +43,8 @@ else
|
|||||||
echo "`ls -l $INPUT`" > ${OUTPUT}/rootfs.info
|
echo "`ls -l $INPUT`" > ${OUTPUT}/rootfs.info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PACK" = "TRUE" ]; then
|
function pack_dmv() {
|
||||||
test -d ${TEMPDIR} || mkdir -p ${TEMPDIR}
|
|
||||||
cp ${INPUT} ${ROOTFS}
|
cp ${INPUT} ${ROOTFS}
|
||||||
ROOTFS_SIZE=`ls ${ROOTFS} -l | awk '{printf $5}'`
|
|
||||||
HASH_OFFSET=$[(ROOTFS_SIZE / 1024 / 1024 + 2) * 1024 * 1024]
|
HASH_OFFSET=$[(ROOTFS_SIZE / 1024 / 1024 + 2) * 1024 * 1024]
|
||||||
tempfile=`mktemp /tmp/temp.XXXXXX`
|
tempfile=`mktemp /tmp/temp.XXXXXX`
|
||||||
veritysetup --hash-offset=${HASH_OFFSET} format ${ROOTFS} ${ROOTFS} > ${tempfile}
|
veritysetup --hash-offset=${HASH_OFFSET} format ${ROOTFS} ${ROOTFS} > ${tempfile}
|
||||||
@ -57,14 +53,56 @@ if [ "$PACK" = "TRUE" ]; then
|
|||||||
cp ${tempfile} ${TEMPDIR}/tempfile
|
cp ${tempfile} ${TEMPDIR}/tempfile
|
||||||
rm ${tempfile}
|
rm ${tempfile}
|
||||||
echo ${HASH_OFFSET} > ${ROOT_HASH_OFFSET}
|
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
|
fi
|
||||||
|
|
||||||
cp ${TOP_DIR}/buildroot/board/rockchip/common/security-ramdisk-overlay/init.in ${INIT_FILE}
|
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}
|
sed -i "s/# exec busybox switch_root/exec busybox switch_root/" ${INIT_FILE}
|
||||||
|
|||||||
@ -18,27 +18,43 @@ fatal()
|
|||||||
|
|
||||||
usage()
|
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 SRC_DIR=$1
|
||||||
export TARGET=$2
|
export TARGET=$2
|
||||||
FS_TYPE=$3
|
FS_TYPE=$3
|
||||||
SIZE=$4
|
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
|
if [ "$FS_TYPE" = "ubi" ]; then
|
||||||
UBI_VOL_NAME=${5:-test}
|
UBI_VOL_NAME=${LABEL:-test}
|
||||||
# default page size 2KB
|
# default page size 2KB
|
||||||
DEFAULT_UBI_PAGE_SIZE=${6:-2048}
|
DEFAULT_UBI_PAGE_SIZE=${RK_UBI_PAGE_SIZE:-2048}
|
||||||
# default block size 128KB
|
# default block size 128KB
|
||||||
DEFAULT_UBI_BLOCK_SIZE=${7:-0x20000}
|
DEFAULT_UBI_BLOCK_SIZE=${RK_UBI_BLOCK_SIZE:-0x20000}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TEMP=$(mktemp -u)
|
TEMP=$(mktemp -u)
|
||||||
|
|
||||||
[ -d "$SRC_DIR" ] || usage
|
[ -d "$SRC_DIR" ] || usage "No such src dir: $SRC_DIR"
|
||||||
|
|
||||||
copy_to_ntfs()
|
copy_to_ntfs()
|
||||||
{
|
{
|
||||||
@ -81,30 +97,32 @@ check_host_tool()
|
|||||||
|
|
||||||
mkimage()
|
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
|
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
|
case $FS_TYPE in
|
||||||
ext[234])
|
ext[234])
|
||||||
if mke2fs -h 2>&1 | grep -wq "\-d"; then
|
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
|
else
|
||||||
echo "Detected old mke2fs(doesn't support '-d' option)!"
|
echo "Detected old mke2fs(doesn't support '-d' option)!"
|
||||||
mke2fs -t $FS_TYPE $TARGET || return -1
|
mke2fs -t $FS_TYPE $TARGET || return -1
|
||||||
copy_to_image || return -1
|
copy_to_image || return -1
|
||||||
fi
|
fi
|
||||||
# Set max-mount-counts to 0, and disable the time-dependent checking.
|
# 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)
|
msdos|fat|vfat)
|
||||||
# Use fat32 by default
|
# Use fat32 by default
|
||||||
mkfs.vfat -F 32 $TARGET && \
|
mkfs.vfat -F 32 $TARGET ${LABEL:+-n $LABEL} && \
|
||||||
MTOOLS_SKIP_CHECK=1 \
|
MTOOLS_SKIP_CHECK=1 \
|
||||||
mcopy -bspmn -D s -i $TARGET $SRC_DIR/* ::/
|
mcopy -bspmn -D s -i $TARGET $SRC_DIR/* ::/
|
||||||
;;
|
;;
|
||||||
ntfs)
|
ntfs)
|
||||||
# Enable compression
|
# Enable compression
|
||||||
mkntfs -FCQ $TARGET
|
mkntfs -FCQ $TARGET ${LABEL:+-L $LABEL}
|
||||||
if check_host_tool ntfscp; then
|
if check_host_tool ntfscp; then
|
||||||
copy_to_ntfs
|
copy_to_ntfs
|
||||||
else
|
else
|
||||||
@ -117,7 +135,7 @@ mkimage()
|
|||||||
mkimage_auto_sized()
|
mkimage_auto_sized()
|
||||||
{
|
{
|
||||||
tar cf $TEMP $SRC_DIR &>/dev/null
|
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
|
rm -rf $TEMP
|
||||||
echo "Making $TARGET from $SRC_DIR (auto sized)"
|
echo "Making $TARGET from $SRC_DIR (auto sized)"
|
||||||
|
|
||||||
@ -125,8 +143,8 @@ mkimage_auto_sized()
|
|||||||
RETRY=0
|
RETRY=0
|
||||||
|
|
||||||
while true;do
|
while true;do
|
||||||
EXTRA_SIZE=$(($SIZE / 50))
|
EXTRA_SIZE=$(($SIZE_KB / 50))
|
||||||
SIZE=$(($SIZE + ($EXTRA_SIZE > 4 ? $EXTRA_SIZE : 4)))
|
SIZE_KB=$(($SIZE_KB + ($EXTRA_SIZE > 4096 ? $EXTRA_SIZE : 4096)))
|
||||||
mkimage && break
|
mkimage && break
|
||||||
|
|
||||||
RETRY=$[RETRY+1]
|
RETRY=$[RETRY+1]
|
||||||
@ -164,19 +182,13 @@ mk_ubi_image()
|
|||||||
|
|
||||||
ubifs_lebsize=$(( $UBI_BLOCK_SIZE - 2 * $UBI_PAGE_SIZE ))
|
ubifs_lebsize=$(( $UBI_BLOCK_SIZE - 2 * $UBI_PAGE_SIZE ))
|
||||||
ubifs_miniosize=$UBI_PAGE_SIZE
|
ubifs_miniosize=$UBI_PAGE_SIZE
|
||||||
partition_size=$(( $SIZE ))
|
|
||||||
|
|
||||||
if [ $partition_size -le 0 ]; then
|
partition_size_str="$(( $SIZE_KB / 1024 ))MB"
|
||||||
echo "Error: ubifs partition MUST set partition size"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
partition_size_str="$(( $partition_size / 1024 / 1024 ))MB"
|
|
||||||
output_image=${temp_dir}/${UBI_VOL_NAME}_${ubi_page_size_str}_${ubi_block_size_str}_${partition_size_str}.ubi
|
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_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
|
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_lebsize=$UBI_BLOCK_SIZE"
|
||||||
echo "ubifs_miniosize=$UBI_PAGE_SIZE"
|
echo "ubifs_miniosize=$UBI_PAGE_SIZE"
|
||||||
@ -202,17 +214,16 @@ mk_ubi_image()
|
|||||||
|
|
||||||
rm -rf $TARGET
|
rm -rf $TARGET
|
||||||
case $FS_TYPE in
|
case $FS_TYPE in
|
||||||
squashfs)
|
|
||||||
mksquashfs $SRC_DIR $TARGET -noappend -comp lz4
|
|
||||||
;;
|
|
||||||
ext[234]|msdos|fat|vfat|ntfs)
|
ext[234]|msdos|fat|vfat|ntfs)
|
||||||
if [ ! "$SIZE" ]; then
|
if [ $SIZE_KB -eq 0 ]; then
|
||||||
mkimage_auto_sized
|
mkimage_auto_sized
|
||||||
else
|
else
|
||||||
mkimage && echo "Generated $TARGET"
|
mkimage && echo "Generated $TARGET"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ubi)
|
ubi)
|
||||||
|
[ $SIZE_KB -eq 0 ] && fatal "$FS_TYPE: auto size not supported."
|
||||||
|
|
||||||
UBI_PAGE_SIZE=2048
|
UBI_PAGE_SIZE=2048
|
||||||
UBI_BLOCK_SIZE=0x20000
|
UBI_BLOCK_SIZE=0x20000
|
||||||
mk_ubi_image
|
mk_ubi_image
|
||||||
@ -225,11 +236,15 @@ case $FS_TYPE in
|
|||||||
UBI_BLOCK_SIZE=0x40000
|
UBI_BLOCK_SIZE=0x40000
|
||||||
mk_ubi_image
|
mk_ubi_image
|
||||||
;;
|
;;
|
||||||
|
squashfs)
|
||||||
|
[ $SIZE_KB -eq 0 ] || fatal "$FS_TYPE: fixed size not supported."
|
||||||
|
mksquashfs $SRC_DIR $TARGET -noappend -comp lz4
|
||||||
|
;;
|
||||||
jffs2)
|
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
|
mkfs.jffs2 -r $SRC_DIR -o $TARGET 0x10000 --pad=0x400000 -s 0x1000 -n
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "File system: $FS_TYPE not support."
|
usage "File system: $FS_TYPE not supported."
|
||||||
usage
|
|
||||||
;;
|
;;
|
||||||
esac
|
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"
|
echo "Try to build init for $1"
|
||||||
|
|
||||||
SYSTEM_IMAGE=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.squashfs
|
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
|
if [ ! -e "$SYSTEM_IMAGE" ]; then
|
||||||
echo "ERROR: Please build system first"
|
echo "ERROR: Please build system first"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$COMMON_DIR/mk-dm.sh dm-v $SYSTEM_IMAGE
|
$COMMON_DIR/mk-dm.sh $1 $SYSTEM_IMAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMON_DIR=$(cd `dirname $0`; pwd)
|
COMMON_DIR=$(cd `dirname $0`; pwd)
|
||||||
@ -100,10 +104,9 @@ eval ROOTFS_IMAGE=\$${RAMDISK_TYPE}_IMG
|
|||||||
|
|
||||||
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||||
case "$RK_SYSTEM_CHECK_METHOD" in
|
case "$RK_SYSTEM_CHECK_METHOD" in
|
||||||
"DM-V")
|
"DM-V" | "DM-E")
|
||||||
rk_ramdisk_build_init "DM-V"
|
rk_ramdisk_build_init $RK_SYSTEM_CHECK_METHOD
|
||||||
;;
|
;;
|
||||||
# TODO: add DM-S for system encrypt
|
|
||||||
*)
|
*)
|
||||||
echo "do nothing ($RK_SYSTEM_CHECK_METHOD)"
|
echo "do nothing ($RK_SYSTEM_CHECK_METHOD)"
|
||||||
esac
|
esac
|
||||||
|
|||||||
@ -2,360 +2,287 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if ! which fakeroot; then
|
||||||
|
echo "fakeroot not found! (sudo apt-get install fakeroot)"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname $(realpath $BASH_SOURCE))
|
SCRIPT_DIR=$(dirname $(realpath $BASH_SOURCE))
|
||||||
TOP_DIR=$(realpath $SCRIPT_DIR/../../..)
|
TOP_DIR=$(realpath $SCRIPT_DIR/../../..)
|
||||||
cd $TOP_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()
|
function unset_board_config_all()
|
||||||
{
|
{
|
||||||
local tmp_file=`mktemp`
|
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 \
|
||||||
source $tmp_file
|
| sort | uniq > $tmp_file
|
||||||
rm -f $tmp_file
|
source $tmp_file
|
||||||
|
rm -f $tmp_file
|
||||||
}
|
}
|
||||||
unset_board_config_all
|
unset_board_config_all
|
||||||
|
|
||||||
source $TOP_DIR/device/rockchip/.BoardConfig.mk
|
source $DEV_DIR/.BoardConfig.mk
|
||||||
ROCKDEV=$TOP_DIR/rockdev
|
ROCKDEV=$TOP_DIR/rockdev
|
||||||
PARAMETER=$TOP_DIR/device/rockchip/$RK_TARGET_PRODUCT/$RK_PARAMETER
|
PARAMETER=$DEV_DIR/$RK_TARGET_PRODUCT/$RK_PARAMETER
|
||||||
if [ "${RK_OEM_DIR}x" != "x" ];then
|
MISC_IMG=$DEV_DIR/rockimg/$RK_MISC
|
||||||
OEM_DIR=$TOP_DIR/device/rockchip/oem/$RK_OEM_DIR
|
if [ "$RK_RAMDISK_SECURITY_BOOTUP" = "true" ];then
|
||||||
|
ROOTFS_IMG=$IMG_DIR/security-system.img
|
||||||
else
|
else
|
||||||
OEM_DIR=
|
ROOTFS_IMG=$TOP_DIR/$RK_ROOTFS_IMG
|
||||||
fi
|
fi
|
||||||
USER_DATA_DIR=$TOP_DIR/device/rockchip/userdata/$RK_USERDATA_DIR
|
|
||||||
MISC_IMG=$TOP_DIR/device/rockchip/rockimg/$RK_MISC
|
ROOTFS_IMG_SOURCE=$IMG_DIR/rootfs.$RK_ROOTFS_TYPE
|
||||||
ROOTFS_IMG=$TOP_DIR/$RK_ROOTFS_IMG
|
RAMBOOT_IMG=$OUT_DIR/$RK_CFG_RAMBOOT/images/ramboot.img
|
||||||
ROOTFS_IMG_SOURCE=$TOP_DIR/buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.$RK_ROOTFS_TYPE
|
RECOVERY_IMG=$OUT_DIR/$RK_CFG_RECOVERY/images/recovery.img
|
||||||
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
|
|
||||||
TRUST_IMG=$TOP_DIR/u-boot/trust.img
|
TRUST_IMG=$TOP_DIR/u-boot/trust.img
|
||||||
UBOOT_IMG=$TOP_DIR/u-boot/uboot.img
|
UBOOT_IMG=$TOP_DIR/u-boot/uboot.img
|
||||||
BOOT_IMG=$TOP_DIR/kernel/$RK_BOOT_IMG
|
BOOT_IMG=$TOP_DIR/kernel/$RK_BOOT_IMG
|
||||||
LOADER=$TOP_DIR/u-boot/*_loader_v*.bin
|
LOADER=$(echo $TOP_DIR/u-boot/*_loader_*v*.bin | head -1)
|
||||||
SPL=$TOP_DIR/u-boot/*_loader_spl.bin
|
SPL=$(echo $TOP_DIR/u-boot/*_loader_spl.bin | head -1)
|
||||||
#SPINOR_LOADER=$TOP_DIR/u-boot/*_loader_spinor_v*.bin
|
|
||||||
MKIMAGE=$SCRIPT_DIR/mk-image.sh
|
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
|
mkdir -p $ROCKDEV
|
||||||
|
|
||||||
# Require buildroot host tools to do image packing.
|
# Require buildroot host tools to do image packing.
|
||||||
if [ ! -d "$TARGET_OUTPUT_DIR" ]; then
|
if [ ! -d "$TARGET_OUTPUT_DIR" ]; then
|
||||||
echo "Source buildroot/build/envsetup.sh"
|
message "Source buildroot/build/envsetup.sh"
|
||||||
if [ "${RK_CFG_RAMBOOT}x" != "x" ];then
|
if [ "${RK_CFG_RAMBOOT}" ];then
|
||||||
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_RAMBOOT
|
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_RAMBOOT
|
||||||
fi
|
fi
|
||||||
if [ "${RK_CFG_BUILDROOT}x" != "x" ];then
|
if [ "${RK_CFG_BUILDROOT}" ];then
|
||||||
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_BUILDROOT
|
source $TOP_DIR/buildroot/build/envsetup.sh $RK_CFG_BUILDROOT
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOT support the grow partition
|
# Parse size limit from parameter.txt, 0 means unlimited or not exists.
|
||||||
get_partition_size() {
|
partition_size_kb() {
|
||||||
echo $PARAMETER
|
PART_NAME=$1
|
||||||
|
PART_STR=$(grep -oE "[^,^:^\(]*\(${PART_NAME}[\)_:][^\)]*\)" $PARAMETER)
|
||||||
PARTITIONS_PREFIX=`echo -n "CMDLINE: mtdparts=rk29xxnand:"`
|
PART_SIZE=$(echo $PART_STR | grep -oE "^[^@^-]*")
|
||||||
while read line
|
echo $(( ${PART_SIZE:-0} / 2 ))
|
||||||
do
|
|
||||||
if [[ $line =~ $PARTITIONS_PREFIX ]]
|
|
||||||
then
|
|
||||||
partitions=`echo $line | sed "s/$PARTITIONS_PREFIX//g"`
|
|
||||||
echo $partitions
|
|
||||||
break
|
|
||||||
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
|
|
||||||
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`
|
|
||||||
|
|
||||||
[[ $part_size =~ "-" ]] && continue
|
|
||||||
|
|
||||||
part_size=$(($part_size))
|
|
||||||
part_size_bytes=$[$part_size*512]
|
|
||||||
|
|
||||||
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"
|
|
||||||
;;
|
|
||||||
boot|boot_[ab])
|
|
||||||
boot_part_size_bytes=$part_size_bytes
|
|
||||||
PART_NAME_NEED_TO_CHECK="$PART_NAME_NEED_TO_CHECK:$part_name"
|
|
||||||
;;
|
|
||||||
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"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_partition_size() {
|
# Assert the image's size smaller than parameter.txt's limit
|
||||||
|
assert_size() {
|
||||||
|
PART_NAME="$1"
|
||||||
|
IMG="$2"
|
||||||
|
|
||||||
while true
|
PART_SIZE=$(partition_size_kb $PART_NAME)
|
||||||
do
|
[ "$PART_SIZE" -gt 0 ] || return 0
|
||||||
part_name=${PART_NAME_NEED_TO_CHECK##*:}
|
|
||||||
case $part_name in
|
IMG_SIZE=$(stat -c "%s" "$IMG")
|
||||||
uboot|uboot_[ab])
|
|
||||||
uboot_img=`realpath $ROCKDEV/uboot.img`
|
if [ $PART_SIZE -lt $(( "$IMG_SIZE" / 1024 )) ]; then
|
||||||
if [ $uboot_part_size_bytes -lt `du -b $uboot_img | awk '{print $1}'` ]
|
fatal "error: $IMG's size exceed parameter.txt's limit!"
|
||||||
then
|
fi
|
||||||
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
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $RK_ROOTFS_IMG ]
|
link_image() {
|
||||||
then
|
SRC="$1"
|
||||||
if [ -f $ROOTFS_IMG ]
|
DST="$2"
|
||||||
then
|
FALLBACK="$3"
|
||||||
echo -n "create rootfs.img..."
|
|
||||||
ln -rsf $ROOTFS_IMG $ROCKDEV/rootfs.img
|
message "Linking $DST from $SRC..."
|
||||||
echo "done."
|
|
||||||
else
|
if [ ! -e "$SRC" ]; then
|
||||||
echo "warning: $ROOTFS_IMG not found!"
|
if [ -e "$FALLBACK" ]; then
|
||||||
if [ -f $ROOTFS_IMG_SOURCE ];then
|
SRC="$FALLBACK"
|
||||||
echo "Fallback to $ROOTFS_IMG_SOURCE"
|
message "Fallback to $SRC"
|
||||||
ln -rsf $ROOTFS_IMG_SOURCE $ROCKDEV/rootfs.img
|
else
|
||||||
fi
|
message "warning: $SRC not found!"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -rsf "$SRC" "$ROCKDEV/$DST"
|
||||||
|
assert_size "${DST%.img}" "$SRC"
|
||||||
|
|
||||||
|
message "Done linking $DST"
|
||||||
|
}
|
||||||
|
|
||||||
|
link_image_optional() {
|
||||||
|
link_image "$@" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
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}
|
||||||
|
;;
|
||||||
|
*m|*M)
|
||||||
|
SIZE=${SIZE//m/M}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
link_image_optional "$PARAMETER" parameter.txt
|
||||||
|
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $PARAMETER ]
|
pack_extra_partitions
|
||||||
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
|
|
||||||
|
|
||||||
get_partition_size
|
message "Images in $ROCKDEV are ready!"
|
||||||
|
|
||||||
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"
|
|
||||||
|
|||||||
@ -4,71 +4,109 @@ TARGET_DIR=$1
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
RK_LEGACY_PARTITIONS=" \
|
RK_LEGACY_PARTITIONS=" \
|
||||||
${RK_OEM_FS_TYPE:+oem:/oem:${RK_OEM_FS_TYPE}}
|
${RK_OEM_FS_TYPE:+oem:/oem:${RK_OEM_FS_TYPE}}
|
||||||
${RK_USERDATA_FS_TYPE:+userdata:/userdata:${RK_USERDATA_FS_TYPE}}
|
${RK_USERDATA_FS_TYPE:+userdata:/userdata:${RK_USERDATA_FS_TYPE}}
|
||||||
"
|
"
|
||||||
|
|
||||||
# <dev>:<mount point>:<fs type>:<source dir>, for example:
|
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||||
# RK_EXTRA_PARTITIONS="oem:/oem:ext2:oem_normal userdata:/userdata:vfat:userdata_empty"
|
# 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}}
|
RK_EXTRA_PARTITIONS=${RK_EXTRA_PARTITIONS:-${RK_LEGACY_PARTITIONS}}
|
||||||
|
|
||||||
function fixup_root()
|
function fixup_root()
|
||||||
{
|
{
|
||||||
echo "Fixing up rootfs type: $1"
|
echo "Fixing up rootfs type: $1"
|
||||||
|
|
||||||
FS_TYPE=$1
|
FS_TYPE=$1
|
||||||
sed -i "s#\([[:space:]]/[[:space:]]\+\)\w\+#\1${FS_TYPE}#" \
|
sed -i "s#\([[:space:]]/[[:space:]]\+\)\w\+#\1${FS_TYPE}#" \
|
||||||
${TARGET_DIR}/etc/fstab
|
${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()
|
function fixup_part()
|
||||||
{
|
{
|
||||||
echo "Fixing up partition: $@"
|
echo "Fixing up partition: ${@//: }"
|
||||||
|
|
||||||
if echo $1 | grep -qE "^/"; then
|
DEV="$(partition_arg "$*" 1)"
|
||||||
DEV=$1
|
|
||||||
else
|
|
||||||
DEV="PARTLABEL=$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
MOUNT=${2:-/$1}
|
# Dev is either <name> or /dev/.../<name>
|
||||||
FS_TYPE=${3:-auto}
|
[ "$DEV" ] || return 0
|
||||||
OPT=${4:-defaults}
|
echo $DEV | grep -qE "^/" || DEV="PARTLABEL=$DEV"
|
||||||
|
|
||||||
sed -i "/[[:space:]]${MOUNT//\//\\\/}[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
MOUNT="$(partition_arg "$*" 2 "/${DEV##*[/=]}")"
|
||||||
|
FS_TYPE="$(partition_arg "$*" 3 ext2)"
|
||||||
|
MOUNT_OPTS="$(partition_arg "$*" 4 defaults)"
|
||||||
|
|
||||||
echo -e "${DEV}\t${MOUNT}\t${FS_TYPE}\t${OPT}\t0 2" >> \
|
sed -i "/[[:space:]]${MOUNT//\//\\\/}[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||||
${TARGET_DIR}/etc/fstab
|
sed -i "/^${DEV//\//\\\/}[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||||
|
|
||||||
mkdir -p ${TARGET_DIR}/${MOUNT}
|
echo -e "${DEV}\t${MOUNT}\t${FS_TYPE}\t${MOUNT_OPTS}\t0 2" >> \
|
||||||
|
${TARGET_DIR}/etc/fstab
|
||||||
|
|
||||||
|
mkdir -p ${TARGET_DIR}/${MOUNT}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixup_fstab()
|
function fixup_fstab()
|
||||||
{
|
{
|
||||||
echo "Fixing up /etc/fstab..."
|
echo "Fixing up /etc/fstab..."
|
||||||
|
|
||||||
case "${RK_ROOTFS_TYPE}" in
|
case "${RK_ROOTFS_TYPE}" in
|
||||||
ext[234])
|
ext[234])
|
||||||
fixup_root ${RK_ROOTFS_TYPE}
|
fixup_root ${RK_ROOTFS_TYPE}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
fixup_root auto
|
fixup_root auto
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
for part in ${RK_EXTRA_PARTITIONS}; do
|
sed -i "/[[:space:]]debugfs[[:space:]]/d" ${TARGET_DIR}/etc/fstab
|
||||||
fixup_part $(echo "${part}" | xargs -d':')
|
echo -e "debugfs\t/sys/kernel/debug\tdebugfs\tdefaults\t0 0" >> \
|
||||||
done
|
${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
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_build_info()
|
function add_build_info()
|
||||||
{
|
{
|
||||||
[ -f ${TARGET_DIR}/etc/os-release ] && \
|
[ -f ${TARGET_DIR}/etc/os-release ] && \
|
||||||
sed -i "/^BUILD_ID=/d" ${TARGET_DIR}/etc/os-release
|
sed -i "/^BUILD_ID=/d" ${TARGET_DIR}/etc/os-release
|
||||||
|
|
||||||
echo "Adding build-info to /etc/os-release..."
|
echo "Adding build-info to /etc/os-release..."
|
||||||
echo "BUILD_INFO=\"$(whoami)@$(hostname) $(date)${@:+ - $@}\"" >> \
|
echo "BUILD_INFO=\"$(whoami)@$(hostname) $(date)${@:+ - $@}\"" >> \
|
||||||
${TARGET_DIR}/etc/os-release
|
${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()
|
function add_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}
|
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||||
# Set ramboot image type
|
# Set ramboot image type
|
||||||
export RK_RAMBOOT_TYPE=
|
export RK_RAMBOOT_TYPE=
|
||||||
# Set oem partition type, including ext2 squashfs
|
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||||
export RK_OEM_FS_TYPE=ext2
|
export RK_EXTRA_PARTITIONS=" \
|
||||||
# Set userdata partition type, including ext2, fat
|
oem:/oem:ext2:defaults:oem_nvr:auto:resize
|
||||||
export RK_USERDATA_FS_TYPE=ext2
|
userdata:/userdata:ext2:defaults:userdata_empty:auto:resize
|
||||||
#OEM config
|
"
|
||||||
export RK_OEM_DIR=oem_nvr
|
|
||||||
# OEM build on buildroot
|
# OEM build on buildroot
|
||||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||||
#userdata config
|
|
||||||
export RK_USERDATA_DIR=userdata_empty
|
|
||||||
#misc image
|
#misc image
|
||||||
export RK_MISC=wipe_all-misc.img
|
export RK_MISC=wipe_all-misc.img
|
||||||
#choose enable distro module
|
#choose enable distro module
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export RK_RECOVERY_FIT_ITS=boot4recovery.its
|
|||||||
# ramboot config
|
# ramboot config
|
||||||
export RK_CFG_RAMBOOT=
|
export RK_CFG_RAMBOOT=
|
||||||
# Pcba config
|
# Pcba config
|
||||||
export RK_CFG_PCBA=
|
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||||
# Build jobs
|
# Build jobs
|
||||||
export RK_JOBS=12
|
export RK_JOBS=12
|
||||||
# target chip
|
# target chip
|
||||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
|||||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||||
# Set ramboot image type
|
# Set ramboot image type
|
||||||
export RK_RAMBOOT_TYPE=
|
export RK_RAMBOOT_TYPE=
|
||||||
# Set oem partition type, including ext2 squashfs
|
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||||
export RK_OEM_FS_TYPE=ext2
|
export RK_EXTRA_PARTITIONS=" \
|
||||||
# Set userdata partition type, including ext2, fat
|
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||||
export RK_USERDATA_FS_TYPE=ext2
|
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||||
#OEM config
|
"
|
||||||
export RK_OEM_DIR=oem_normal
|
|
||||||
# OEM build on buildroot
|
# OEM build on buildroot
|
||||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||||
#userdata config
|
|
||||||
export RK_USERDATA_DIR=userdata_normal
|
|
||||||
#misc image
|
#misc image
|
||||||
export RK_MISC=wipe_all-misc.img
|
export RK_MISC=wipe_all-misc.img
|
||||||
#choose enable distro module
|
#choose enable distro module
|
||||||
export RK_DISTRO_MODULE=
|
export RK_DISTRO_MODULE=
|
||||||
# Define pre-build script for this board
|
# Define pre-build script for this board
|
||||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
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
|
# ramboot config
|
||||||
export RK_CFG_RAMBOOT=
|
export RK_CFG_RAMBOOT=
|
||||||
# Pcba config
|
# Pcba config
|
||||||
export RK_CFG_PCBA=
|
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||||
# Build jobs
|
# Build jobs
|
||||||
export RK_JOBS=12
|
export RK_JOBS=12
|
||||||
# target chip
|
# target chip
|
||||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
|||||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||||
# Set ramboot image type
|
# Set ramboot image type
|
||||||
export RK_RAMBOOT_TYPE=
|
export RK_RAMBOOT_TYPE=
|
||||||
# Set oem partition type, including ext2 squashfs
|
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||||
export RK_OEM_FS_TYPE=ext2
|
export RK_EXTRA_PARTITIONS=" \
|
||||||
# Set userdata partition type, including ext2, fat
|
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||||
export RK_USERDATA_FS_TYPE=ext2
|
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||||
#OEM config
|
"
|
||||||
export RK_OEM_DIR=oem_normal
|
|
||||||
# OEM build on buildroot
|
# OEM build on buildroot
|
||||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||||
#userdata config
|
|
||||||
export RK_USERDATA_DIR=userdata_normal
|
|
||||||
#misc image
|
#misc image
|
||||||
export RK_MISC=wipe_all-misc.img
|
export RK_MISC=wipe_all-misc.img
|
||||||
#choose enable distro module
|
#choose enable distro module
|
||||||
export RK_DISTRO_MODULE=
|
export RK_DISTRO_MODULE=
|
||||||
# Define pre-build script for this board
|
# Define pre-build script for this board
|
||||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
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
|
# ramboot config
|
||||||
export RK_CFG_RAMBOOT=
|
export RK_CFG_RAMBOOT=
|
||||||
# Pcba config
|
# Pcba config
|
||||||
export RK_CFG_PCBA=
|
export RK_CFG_PCBA=rockchip_rk3588_pcba
|
||||||
# Build jobs
|
# Build jobs
|
||||||
export RK_JOBS=12
|
export RK_JOBS=12
|
||||||
# target chip
|
# target chip
|
||||||
@ -44,19 +44,18 @@ export RK_YOCTO_MACHINE=rockchip-rk3588-evb
|
|||||||
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
|
||||||
# Set ramboot image type
|
# Set ramboot image type
|
||||||
export RK_RAMBOOT_TYPE=
|
export RK_RAMBOOT_TYPE=
|
||||||
# Set oem partition type, including ext2 squashfs
|
# <dev>:<mount point>:<fs type>:<mount flags>:<source dir>:<image size(M|K|auto)>:[options]
|
||||||
export RK_OEM_FS_TYPE=ext2
|
export RK_EXTRA_PARTITIONS=" \
|
||||||
# Set userdata partition type, including ext2, fat
|
oem:/oem:ext2:defaults:oem_normal:auto:resize
|
||||||
export RK_USERDATA_FS_TYPE=ext2
|
userdata:/userdata:ext2:defaults:userdata_normal:auto:resize
|
||||||
#OEM config
|
"
|
||||||
export RK_OEM_DIR=oem_normal
|
|
||||||
# OEM build on buildroot
|
# OEM build on buildroot
|
||||||
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
#export RK_OEM_BUILDIN_BUILDROOT=YES
|
||||||
#userdata config
|
|
||||||
export RK_USERDATA_DIR=userdata_normal
|
|
||||||
#misc image
|
#misc image
|
||||||
export RK_MISC=wipe_all-misc.img
|
export RK_MISC=wipe_all-misc.img
|
||||||
#choose enable distro module
|
#choose enable distro module
|
||||||
export RK_DISTRO_MODULE=
|
export RK_DISTRO_MODULE=
|
||||||
# Define pre-build script for this board
|
# Define pre-build script for this board
|
||||||
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh
|
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
|
CHECK_MASK: 0x80
|
||||||
PWR_HLD: 0,0,A,0,1
|
PWR_HLD: 0,0,A,0,1
|
||||||
TYPE: GPT
|
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: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