Merge pull request #128 from prodeveloper0/features/prebuilt-rootfs
feat: support building with user prebuilt rootfs
This commit is contained in:
commit
bdf11eb003
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,5 +4,6 @@
|
||||||
RK-RELEASE-NOTES-V1.4.1.txt
|
RK-RELEASE-NOTES-V1.4.1.txt
|
||||||
IMAGE/
|
IMAGE/
|
||||||
output/
|
output/
|
||||||
|
prebuilt_rootfs.tar.gz
|
||||||
project/app/wifi_app/wpa_supplicant.conf
|
project/app/wifi_app/wpa_supplicant.conf
|
||||||
config/
|
config/
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
UBUNTU_DIR=${SDK_SYSDRV_DIR}/tools/board/ubuntu
|
UBUNTU_DIR=${SDK_SYSDRV_DIR}/tools/board/ubuntu
|
||||||
|
|
||||||
if [ $(getconf _NPROCESSORS_ONLN) -eq 1 ]; then
|
if [ $(getconf _NPROCESSORS_ONLN) -eq 1 ]; then
|
||||||
|
|
@ -106,6 +107,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
|
||||||
|
|
@ -650,26 +659,41 @@ function build_sysdrv() {
|
||||||
echo "============Start building sysdrv============"
|
echo "============Start building sysdrv============"
|
||||||
|
|
||||||
mkdir -p ${RK_PROJECT_OUTPUT_IMAGE}
|
mkdir -p ${RK_PROJECT_OUTPUT_IMAGE}
|
||||||
make -C ${SDK_SYSDRV_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 ! [ -d $RK_PROJECT_OUTPUT ]; then
|
if [ $(check_prebuilt_rootfs) == "y" ]; then
|
||||||
mkdir -p $RK_PROJECT_OUTPUT
|
make -C ${SDK_SYSDRV_DIR} uboot
|
||||||
fi
|
make -C ${SDK_SYSDRV_DIR} kernel
|
||||||
|
make -C ${SDK_SYSDRV_DIR} env
|
||||||
|
|
||||||
if [ -f $rootfs_tarball ]; then
|
rootfs_tarball=$PREBUILT_ROOTFS_PATH
|
||||||
if [ -d $rootfs_out_dir ]; then
|
if [ -d $rootfs_out_dir ]; then
|
||||||
rm -rf $rootfs_out_dir
|
rm -rf $rootfs_out_dir
|
||||||
fi
|
fi
|
||||||
tar xf $rootfs_tarball -C $RK_PROJECT_OUTPUT
|
mkdir -p $rootfs_out_dir
|
||||||
|
tar xf $rootfs_tarball -C $rootfs_out_dir
|
||||||
else
|
else
|
||||||
msg_error "Not found rootfs tarball: $rootfs_tarball"
|
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
||||||
exit 1
|
mkdir -p $RK_PROJECT_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -C ${SDK_SYSDRV_DIR}
|
||||||
|
|
||||||
|
if [ -f $rootfs_tarball ]; then
|
||||||
|
if [ -d $rootfs_out_dir ]; then
|
||||||
|
rm -rf $rootfs_out_dir
|
||||||
|
fi
|
||||||
|
tar xf $rootfs_tarball -C $RK_PROJECT_OUTPUT
|
||||||
|
else
|
||||||
|
msg_error "Not found rootfs tarball: $rootfs_tarball"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
||||||
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}."
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -694,27 +718,37 @@ 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 ! [ -d $RK_PROJECT_OUTPUT ]; then
|
if [ $(check_prebuilt_rootfs) == "y" ]; then
|
||||||
mkdir -p $RK_PROJECT_OUTPUT
|
rootfs_tarball=$PREBUILT_ROOTFS_PATH
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f $rootfs_tarball ]; then
|
|
||||||
if [ -d $rootfs_out_dir ]; then
|
if [ -d $rootfs_out_dir ]; then
|
||||||
rm -rf $rootfs_out_dir
|
rm -rf $rootfs_out_dir
|
||||||
fi
|
fi
|
||||||
tar xf $rootfs_tarball -C $RK_PROJECT_OUTPUT
|
mkdir -p $rootfs_out_dir
|
||||||
|
tar xf $rootfs_tarball -C $rootfs_out_dir
|
||||||
else
|
else
|
||||||
msg_error "Not found rootfs tarball: $rootfs_tarball"
|
make rootfs -C ${SDK_SYSDRV_DIR}
|
||||||
exit 1
|
|
||||||
|
if ! [ -d $RK_PROJECT_OUTPUT ]; then
|
||||||
|
mkdir -p $RK_PROJECT_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $rootfs_tarball ]; then
|
||||||
|
if [ -d $rootfs_out_dir ]; then
|
||||||
|
rm -rf $rootfs_out_dir
|
||||||
|
fi
|
||||||
|
tar xf $rootfs_tarball -C $RK_PROJECT_OUTPUT
|
||||||
|
else
|
||||||
|
msg_error "Not found rootfs tarball: $rootfs_tarball"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_info "If you need to add custom files, please upload them to <Luckfox Sdk>/output/out/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}."
|
||||||
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}."
|
|
||||||
finish_build
|
finish_build
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1012,8 +1046,11 @@ function build_all() {
|
||||||
|
|
||||||
[[ $RK_ENABLE_RECOVERY = "y" ]] && build_recovery
|
[[ $RK_ENABLE_RECOVERY = "y" ]] && build_recovery
|
||||||
build_sysdrv
|
build_sysdrv
|
||||||
build_media
|
|
||||||
build_app
|
if [ $(check_prebuilt_rootfs) != "y" ]; then
|
||||||
|
build_media
|
||||||
|
build_app
|
||||||
|
fi
|
||||||
build_firmware
|
build_firmware
|
||||||
|
|
||||||
finish_build
|
finish_build
|
||||||
|
|
@ -1227,6 +1264,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