Support building with user prebuilt rootfs
This commit is contained in:
parent
6cf97cc3f9
commit
c9c29dd8e7
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@
|
||||||
RK-RELEASE-NOTES-V1.4.1.txt
|
RK-RELEASE-NOTES-V1.4.1.txt
|
||||||
IMAGE/
|
IMAGE/
|
||||||
output/
|
output/
|
||||||
|
prebuilt_rootfs.tar.gz
|
||||||
|
|
@ -39,6 +39,7 @@ SDK_CONFIG_DIR=${SDK_ROOT_DIR}/config
|
||||||
DTS_CONFIG=${SDK_CONFIG_DIR}/dts_config
|
DTS_CONFIG=${SDK_CONFIG_DIR}/dts_config
|
||||||
KERNEL_DEFCONFIG=${SDK_CONFIG_DIR}/kernel_defconfig
|
KERNEL_DEFCONFIG=${SDK_CONFIG_DIR}/kernel_defconfig
|
||||||
BUILDROOT_DEFCONFIG=${SDK_CONFIG_DIR}/buildroot_defconfig
|
BUILDROOT_DEFCONFIG=${SDK_CONFIG_DIR}/buildroot_defconfig
|
||||||
|
PREBUILT_ROOTFS_PATH=${SDK_ROOT_DIR}/prebuilt_rootfs.tar.gz
|
||||||
|
|
||||||
if [ $(getconf _NPROCESSORS_ONLN) -eq 1 ]; then
|
if [ $(getconf _NPROCESSORS_ONLN) -eq 1 ]; then
|
||||||
export RK_JOBS=1
|
export RK_JOBS=1
|
||||||
|
|
@ -105,6 +106,14 @@ function msg_error() {
|
||||||
echo -e "${C_RED}[$(basename $0):error] $1${C_NORMAL}"
|
echo -e "${C_RED}[$(basename $0):error] $1${C_NORMAL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_prebuilt_rootfs() {
|
||||||
|
if [ -f "$PREBUILT_ROOTFS_PATH" ] && [ $CONFIG_USE_PREBUILT_ROOTFS == "y" ]; then
|
||||||
|
echo "y"
|
||||||
|
else
|
||||||
|
echo "n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
err_handler() {
|
err_handler() {
|
||||||
ret=$?
|
ret=$?
|
||||||
[ "$ret" -eq 0 ] && return
|
[ "$ret" -eq 0 ] && return
|
||||||
|
|
@ -654,6 +663,18 @@ function build_sysdrv() {
|
||||||
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
||||||
rootfs_out_dir="$RK_PROJECT_OUTPUT/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}"
|
rootfs_out_dir="$RK_PROJECT_OUTPUT/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}"
|
||||||
|
|
||||||
|
if [ $(check_prebuilt_rootfs) == "y" ]; then
|
||||||
|
make -C ${SDK_SYSDRV_DIR} uboot
|
||||||
|
make -C ${SDK_SYSDRV_DIR} kernel
|
||||||
|
make -C ${SDK_SYSDRV_DIR} env
|
||||||
|
|
||||||
|
rootfs_tarball=$PREBUILT_ROOTFS_PATH
|
||||||
|
if [ -d $rootfs_out_dir ]; then
|
||||||
|
rm -rf $rootfs_out_dir
|
||||||
|
fi
|
||||||
|
mkdir -p $rootfs_out_dir
|
||||||
|
tar xf $rootfs_tarball -C $rootfs_out_dir
|
||||||
|
else
|
||||||
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
||||||
mkdir -p $RK_PROJECT_OUTPUT
|
mkdir -p $RK_PROJECT_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
@ -669,6 +690,8 @@ function build_sysdrv() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
||||||
|
fi
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -693,12 +716,20 @@ function build_kernel() {
|
||||||
function build_rootfs() {
|
function build_rootfs() {
|
||||||
check_config RK_BOOT_MEDIUM || check_config RK_TARGET_ROOTFS || return 0
|
check_config RK_BOOT_MEDIUM || check_config RK_TARGET_ROOTFS || return 0
|
||||||
|
|
||||||
make rootfs -C ${SDK_SYSDRV_DIR}
|
|
||||||
|
|
||||||
local rootfs_tarball rootfs_out_dir
|
local rootfs_tarball rootfs_out_dir
|
||||||
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
||||||
rootfs_out_dir="$RK_PROJECT_OUTPUT/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}"
|
rootfs_out_dir="$RK_PROJECT_OUTPUT/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}"
|
||||||
|
|
||||||
|
if [ $(check_prebuilt_rootfs) == "y" ]; then
|
||||||
|
rootfs_tarball=$PREBUILT_ROOTFS_PATH
|
||||||
|
if [ -d $rootfs_out_dir ]; then
|
||||||
|
rm -rf $rootfs_out_dir
|
||||||
|
fi
|
||||||
|
mkdir -p $rootfs_out_dir
|
||||||
|
tar xf $rootfs_tarball -C $rootfs_out_dir
|
||||||
|
else
|
||||||
|
make rootfs -C ${SDK_SYSDRV_DIR}
|
||||||
|
|
||||||
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
||||||
mkdir -p $RK_PROJECT_OUTPUT
|
mkdir -p $RK_PROJECT_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
@ -714,6 +745,8 @@ function build_rootfs() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
||||||
|
fi
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1011,8 +1044,11 @@ function build_all() {
|
||||||
|
|
||||||
[[ $RK_ENABLE_RECOVERY = "y" ]] && build_recovery
|
[[ $RK_ENABLE_RECOVERY = "y" ]] && build_recovery
|
||||||
build_sysdrv
|
build_sysdrv
|
||||||
|
|
||||||
|
if [ $(check_prebuilt_rootfs) != "y" ]; then
|
||||||
build_media
|
build_media
|
||||||
build_app
|
build_app
|
||||||
|
fi
|
||||||
build_firmware
|
build_firmware
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
|
|
@ -1223,6 +1259,10 @@ function __PACKAGE_ROOTFS() {
|
||||||
local rootfs_tarball rootfs_out_dir
|
local rootfs_tarball rootfs_out_dir
|
||||||
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
|
||||||
|
|
||||||
|
if [ $(check_prebuilt_rootfs) == "y" ]; then
|
||||||
|
rootfs_tarball=$PREBUILT_ROOTFS_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f $rootfs_tarball ]; then
|
if [ ! -f $rootfs_tarball ]; then
|
||||||
msg_error "Build rootfs is not yet complete, packaging cannot proceed!"
|
msg_error "Build rootfs is not yet complete, packaging cannot proceed!"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user