【RV1103】Luckfox Pico 构建系统分析

文章目录

  • 实际命令
    • 编译uboot的实际命令
    • 编译kernel的实际命令
  • SDK 使用说明
    • 介绍
    • 选择参考的板级配置
    • 一键自动编译
    • 编译U-Boot
    • 编译kernel
    • 编译rootfs
    • 编译media
    • 编译参考应用
    • 固件打包
    • SDK目录结构说明:
    • 镜像存放目录说明
  • 板子选型
  • 文件系统是怎么构建的?
    • 编译全部
    • 打包
      • 打包文件系统
      • 打包OEM

这板子是基于busybox构建的文件系统,全部重新编译仅需要6分钟。

实际命令

编译uboot的实际命令

cd /home/liefyuan/rv1103/luckfox-pico-main/sysdrv/source/uboot/u-boot
make rv1106_defconfig rk-sfc.config
./make.sh --spl-new CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf- 
cp -fv ./*_idblock_v*.img idblock.img 
cp -fv ./*_download_v*.bin download.bin 
  • 进入uboot源码目录

输出文件:

uboot out image: uboot.img idblock.img download.bin 

编译kernel的实际命令

cd /home/liefyuan/rv1103/luckfox-pico-main/sysdrv/source/kernel
make ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf- luckfox_rv1106_linux_defconfig 
make ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf- BOOT_ITS=boot.its rv1103g-luckfox-pico-plus.img -j9

输出文件:

kernel out image: boot.img

SDK 使用说明

介绍

**配置项**                    | **说明**
--------------------------------------------------------------------
RK_ARCH                       | arm或arm64: 定义编译32位或64位程序
RK_CHIP                       | 不可修改: 不同的芯片对应不同的SDK
RK_TOOLCHAIN_CROSS            | 不可修改: 定义交叉工具链

RK_BOOT_MEDIUM                | emmc或spi_nor或spi_nand或slc_nand: 定义板子存储类型

RK_UBOOT_DEFCONFIG            | U-Boot defconfig文件名
RK_UBOOT_DEFCONFIG_FRAGMENT   | U-Boot config文件名(可选) 对RK_UBOOT_DEFCONFIG定义的defconfig进行覆盖
RK_UBOOT_RKBIN_INI_OVERLAY    | U-Boot 编译打包rkbin文件ini文件(可选)对U-Boot的defconfig中定义的CONFIG_LOADER_INI进行覆盖

RK_KERNEL_DEFCONFIG           | 内核defconfig文件名
RK_KERNEL_DEFCONFIG_FRAGMENT  | 内核defconfig文件名(可选)对RK_KERNEL_DEFCONFIG定义的defconfig进行覆盖

RK_KERNEL_DTS                 | 内核dts文件名

RK_MISC                       | 如果打开recovery功能,系统启动时读取标志选择进recovery系统或应用系统(没有recovery时,可以去掉)

RK_CAMERA_SENSOR_IQFILES      | Camera Sensor的IQ配置文件: 多个IQ文件用空格隔开,例如RK_CAMERA_SENSOR_IQFILES="iqfile_1 iqfile_2"
RK_CAMERA_SENSOR_CAC_BIN      | Camera Module Lens 的去紫边(CAC)标定文件夹:多个bin文件可以用空格隔开,例如RK_CAMERA_SENSOR_CAC_BIN=“dir_1 dir_2”

RK_PARTITION_CMD_IN_ENV       | 配置分区表(重要),分区表格式:<partdef>[,<partdef>]<partdef>格式:<size>[@<offset>](part-name)
RK_PARTITION_FS_TYPE_CFG      | 配置分区文件系统类型以及挂载点(重要)格式说明:分区名称@分区挂载点@分区文件系统类型

RK_SQUASHFS_COMP              | 配置squashfs镜像压缩算法(可选)支持:lz4/lzo/lzma/xz/gzip (default xz)
RK_UBIFS_COMP                 | 配置ubifs镜像压缩算法(可选)支持:lzo/zlib (default lzo)

RK_APP_TYPE                   | 配置编译参考的应用(可选)运行./build.sh info 可以查看支持的参考应用
RK_APP_IPCWEB_BACKEND         | 配置是否编译web应用(可选)y:使能

RK_ENABLE_RECOVERY            | 配置是否使能recovery功能(可选)y:使能
RK_ENABLE_FASTBOOT            | 配置是否快速启动功能(可选)y:使能(需要配合U-Boot和内核修改)
RK_ENABLE_GDB                 | 配置是否编译gdb(可选)y:使能
RK_ENABLE_ADBD                | 配置是否支持adb功能(可选)y:使能(注:需要内核打开对应USB配置)
RK_ENABLE_WIFI                | 配置是否支持wifi功能(可选)y:使能
RK_ENABLE_MOTOR               | 配置是否支持马达功能(可选)y:使能
RK_ENABLE_EUDEV               | 配置是否支持eudev(外设热拔插)功能(可选)y:使能
RK_ENABLE_ROCKCHIP_TEST       | 配置是否支持ddr/cpu/reboot/flash压测功能(可选)y:使能

RK_BOOTARGS_CMA_SIZE          | 配置内核CMA大小,例如RK_BOOTARGS_CMA_SIZE=24M (可选)

RK_POST_BUILD_SCRIPT          | 配置的脚本将会在打包rootfs.img前执行(脚本放在BoardConfig对应目录下)
RK_PRE_BUILD_OEM_SCRIPT       | 配置的脚本将会在打包oem.img前执行(脚本放在BoardConfig对应目录下)
RK_BUILD_APP_TO_OEM_PARTITION | 配置是否将应用安装到oem分区(可选)y:使能
RK_ENABLE_RNDIS               | 配置是否打开rndis功能(可选)y:使能
RK_META_PARAM                 | 配置meta分区参数(可选,用于电池IPC类产品)
RK_POST_OVERLAY               | 配置资源文件覆盖到文件系统的目录(例如,在对应BoardConfig.mk目录下创建overlay/user_overlay_files,则RK_POST_OVERLAY=user_overlay_files)

选择参考的板级配置

./build.sh lunch

You're building on Linux
Lunch menu...pick a combo:

BoardConfig-*.mk naming rules:
BoardConfig-"启动介质"-"电源方案"-"硬件版本"-"应用场景".mk
BoardConfig-"boot medium"-"power solution"-"hardware version"-"applicaton".mk

----------------------------------------------------------------
0. BoardConfig-EMMC-ALL-2xRK806-HW_V10-IPC_MULTI_SENSOR.mk
                             boot medium(启动介质): EMMC
                          power solution(电源方案): 2xRK806
                        hardware version(硬件版本): HW_V10
                              applicaton(应用场景): IPC_MULTI_SENSOR
----------------------------------------------------------------

----------------------------------------------------------------
1. BoardConfig-SPI_NAND-ALL-RK806-HW_V10-IPC_SINGLE_SENSOR.mk
                             boot medium(启动介质): SPI_NAND
                          power solution(电源方案): RK806
                        hardware version(硬件版本): HW_V10
                              applicaton(应用场景): IPC_SINGLE_SENSOR
----------------------------------------------------------------

Which would you like? [0]:

输入对应的序号选择对应的参考板级。

一键自动编译

./build.sh lunch   # 选择参考板级
./build.sh         # 一键自动编译

编译U-Boot

./build.sh clean uboot
./build.sh uboot

生成镜像文件:

output/image/MiniLoaderAll.bin
output/image/uboot.img

编译kernel

./build.sh clean kernel
./build.sh kernel

生成镜像文件:output/image/boot.img

编译rootfs

./build.sh clean rootfs
./build.sh rootfs

编译后使用./build.sh firmware命令打包成:rootfs.img
生成镜像文件:output/image/rootfs.img

编译media

./build.sh clean media
./build.sh media

生成文件的存放目录:output/out/media_out

编译参考应用

./build.sh clean app
./build.sh app

生成文件的存放目录:output/out/app_out
注:app依赖media

固件打包

./build.sh firmware

生成文件的存放目录:output/image

SDK目录结构说明:

├── build.sh -> project/build.sh ---- SDK编译脚本
├── media --------------------------- 多媒体编解码、ISP等算法相关(可独立SDK编译)
├── sysdrv -------------------------- U-Boot、kernel、rootfs目录(可独立SDK编译)
├── project ------------------------- 参考应用、编译配置以及脚本目录
├── output -------------------------- SDK编译后镜像文件存放目录
├── docs ---------------------------- SDK文档目录
└── tools --------------------------- 烧录镜像打包工具以及烧录工具

镜像存放目录说明

编译完的文件存放在output目录下

output/
├── image
│   ├── download.bin ---------------- 烧录工具升级通讯的设备端程序,只会下载到板子内存
│   ├── env.img --------------------- 包含分区表和启动参数
│   ├── uboot.img ------------------- uboot镜像
│   ├── idblock.img ----------------- loader镜像
│   ├── boot.img -------------------- kernel镜像
│   ├── rootfs.img ------------------ kernel镜像
│   └── userdata.img ---------------- userdata镜像
└── out
    ├── app_out --------------------- 参考应用编译后的文件
    ├── media_out ------------------- media相关编译后的文件
    ├── rootfs_xxx ------------------ 文件系统打包目录
    ├── S20linkmount ---------------- 分区挂载脚本
    ├── sysdrv_out ------------------ sysdrv编译后的文件
    └── userdata -------------------- userdata

板子选型

./build lunch

lunch 不是午餐的意思吗?为啥都喜欢用这个来用做选择板型的单词?

文件系统是怎么构建的?

busybox的源码地址是:sdk/sysdrv/tools/board/busybox

  • 单独编译文件系统:./build.sh rootfs
  • 单独清空文件系统:./build.sh clean rootfs

构建文件系统的指令:

function build_rootfs(){
	check_config RK_BOOT_MEDIUM || return 0

	make rootfs -C ${SDK_SYSDRV_DIR}
	# make rootfs -C sdk/sysdrv/

	finish_build
}

清空文件系统的指令:

make rootfs_clean -C ${SDK_SYSDRV_DIR}
rm -rf $RK_PROJECT_PACKAGE_ROOTFS_DIR
  • SDK_SYSDRV_DIRsdk/sysdrv
  • RK_PROJECT_PACKAGE_ROOTFS_DIRsdk/output/out/rootfs_uclibc_rv1103

编译全部

function build_all(){
	echo "============================================"
	echo "TARGET_ARCH=$RK_ARCH"
	echo "TARGET_UBOOT_CONFIG=$RK_UBOOT_DEFCONFIG $RK_UBOOT_DEFCONFIG_FRAGMENT"
	echo "TARGET_SPL_CONFIG=$RK_SPL_DEFCONFIG"
	echo "TARGET_KERNEL_CONFIG=$RK_KERNEL_DEFCONFIG $RK_KERNEL_DEFCONFIG_FRAGMENT"
	echo "TARGET_KERNEL_DTS=$RK_KERNEL_DTS"
	echo "TARGET_RECOVERY_CONFIG=$RK_CFG_RECOVERY"
	echo "TARGET_RAMBOOT_CONFIG=$RK_CFG_RAMBOOT"
	echo "============================================"

	[[ $RK_ENABLE_RECOVERY = "y" ]] && build_recovery
	build_sysdrv
	build_media
	build_app
	build_firmware

	finish_build
}
function build_recovery(){
	check_config RK_ENABLE_RECOVERY || return 0

	local kernel_image
	local kernel_dtb_file="$RK_PROJECT_PATH_RAMDISK/${RK_KERNEL_DTS/%.dts/.dtb}"
	local ota_script="$OTA_SCRIPT_PATH/RK_OTA_update.sh"
	local erase_misc_script="$RK_PROJECT_PATH_RAMDISK_TINY_ROOTFS/usr/bin/RK_OTA_erase_misc.sh"
	local ramdisk_file="rootfs.cpio"

	# make busybox and kernel
	mkdir -p $RK_PROJECT_PATH_RAMDISK_TINY_ROOTFS $RK_PROJECT_PATH_RAMDISK
	make busybox_clean -C ${SDK_SYSDRV_DIR}
	make -C ${SDK_SYSDRV_DIR} \
		OUTPUT_SYSDRV_RAMDISK_TINY_ROOTFS_DIR=$RK_PROJECT_PATH_RAMDISK_TINY_ROOTFS \
		OUTPUT_SYSDRV_RAMDISK_DIR=$RK_PROJECT_PATH_RAMDISK \
		busybox kernel
	make busybox_clean -C ${SDK_SYSDRV_DIR}

	# copy tools
	mkdir -p $RK_PROJECT_PATH_PC_TOOLS
	if [ ! -f $RK_PROJECT_PATH_PC_TOOLS/mk-fitimage.sh \
		-o ! -f $RK_PROJECT_PATH_PC_TOOLS/mkimage ];then
		build_tool
	fi
	cp -fa $PROJECT_TOP_DIR/scripts/RkLunch-recovery.sh $RK_PROJECT_PATH_RAMDISK_TINY_ROOTFS/usr/bin/RkLunch.sh
	cp -fa $PROJECT_TOP_DIR/scripts/boot4recovery.its $RK_PROJECT_PATH_RAMDISK

	mkdir -p $(dirname $RK_PROJECT_FILE_RECOVERY_LUNCH_SCRIPT)
	cat > $RK_PROJECT_FILE_RECOVERY_LUNCH_SCRIPT <<EOF
#!/bin/sh
case \$1 in
	start)
		sh /usr/bin/RkLunch.sh
		;;
	stop)
		sh /usr/bin/RkLunch-stop.sh
		;;
	*)
		exit 1
		;;
esac
EOF
	chmod a+x $RK_PROJECT_FILE_RECOVERY_LUNCH_SCRIPT

	mkdir -p $(dirname $erase_misc_script)
	echo "#!/bin/sh" > $erase_misc_script
	echo "set -e" >> $erase_misc_script
	echo "COMMON_DIR=\`dirname \$(realpath \$0)\`" >> $erase_misc_script
	echo "TOP_DIR=\$(realpath \$COMMON_DIR/../..)" >> $erase_misc_script
	echo "cd \$TOP_DIR" >> $erase_misc_script
	echo "echo \"Erase misc partition\"" >> $erase_misc_script

	case $RK_BOOT_MEDIUM in
		emmc|spi_nor)
			echo "dd if=/dev/zero of=/dev/block/by-name/misc bs=32 count=1 seek=512" >> $erase_misc_script
			echo "if [ \$? -ne 0 ];then" >> $erase_misc_script
			echo "	echo \"Error: Erase misc partition failed.\"" >> $erase_misc_script
			echo "	exit 2" >> $erase_misc_script
			echo "fi" >> $erase_misc_script
			;;
		spi_nand|slc_nand)
			echo "flash_eraseall /dev/block/by-name/misc" >> $erase_misc_script
			echo "if [ \$? -ne 0 ];then" >> $erase_misc_script
			echo "	echo \"Error: Erase misc partition failed.\"" >> $erase_misc_script
			echo "	exit 2" >> $erase_misc_script
			echo "fi" >> $erase_misc_script
			;;
		*)
			echo "Not support storage medium type: $RK_BOOT_MEDIUM"
			finish_build
			exit 1
			;;
	esac

	chmod a+x $erase_misc_script

	case "$RK_ARCH" in
		arm)
			kernel_image="$RK_PROJECT_PATH_RAMDISK/zImage"
			;;
		arm64)
			kernel_image="$RK_PROJECT_PATH_RAMDISK/Image"
			;;
		*)
			echo "No such kernel image. ($RK_ARCH)"
			;;
	esac

	# package rootfs in cpio
	(cd $RK_PROJECT_PATH_RAMDISK/tiny_rootfs; find . | cpio --quiet -o -H newc > $RK_PROJECT_PATH_RAMDISK/$ramdisk_file )
	gzip -9 -c $RK_PROJECT_PATH_RAMDISK/$ramdisk_file > $RK_PROJECT_PATH_RAMDISK/${ramdisk_file}.gz

	# build recovery for fastboot
	if [ "$RK_ENABLE_FASTBOOT" = "y" ]; then
		ramdisk_file="recovery_erofs.img"
		case "$RK_ARCH" in
			arm)
				kernel_image="$RK_PROJECT_PATH_RAMDISK/Image.gz"
				;;
			*)
				echo "No such kernel image for fastboot. ($RK_ARCH)"
				exit 1
				;;
		esac
		cp -fa $PROJECT_TOP_DIR/scripts/$RK_CHIP-boot-tb.its $RK_PROJECT_PATH_RAMDISK/boot4recovery.its

		# package rootfs in erofs for fastboot if necessary
		$RK_PROJECT_TOOLS_MKFS_EROFS $RK_PROJECT_PATH_RAMDISK/tiny_rootfs $RK_PROJECT_PATH_RAMDISK/$ramdisk_file
		cat $RK_PROJECT_PATH_RAMDISK/$ramdisk_file | gzip -n -f -9 > $RK_PROJECT_PATH_RAMDISK/${ramdisk_file}.gz
	fi

	# package recovery.img
	mkdir -p $RK_PROJECT_OUTPUT_IMAGE
	$RK_PROJECT_PATH_PC_TOOLS/mk-fitimage.sh $RK_PROJECT_PATH_RAMDISK/boot4recovery.its $RK_PROJECT_PATH_RAMDISK/${ramdisk_file}.gz $kernel_image $kernel_dtb_file $RK_PROJECT_PATH_RAMDISK/resource.img $RK_PROJECT_OUTPUT_IMAGE/recovery.img $RK_ARCH

	# strip debug symbol
	__RELEASE_FILESYSTEM_FILES $RK_PROJECT_PATH_RAMDISK_TINY_ROOTFS

	mkdir -p $(dirname $ota_script)
	echo "#!/bin/sh" > $ota_script
	echo "set -e" >> $ota_script
	echo "COMMON_DIR=\`dirname \$(realpath \$0)\`" >> $ota_script
	echo "TOP_DIR=\$(realpath \$COMMON_DIR/../..)" >> $ota_script
	echo "cd \$TOP_DIR" >> $ota_script
	echo "echo \"Start to write partitions\"" >> $ota_script

	case $RK_BOOT_MEDIUM in
		emmc|spi_nor)
			echo "for image in \$(ls /dev/block/by-name)" >> $ota_script
			echo "do" >> $ota_script
			echo "	if [ -f \$COMMON_DIR/\${image}.img ];then" >> $ota_script
			echo "		echo \"Writing \$image...\"" >> $ota_script
			echo "		dd if=\$COMMON_DIR/\${image}.img of=/dev/block/by-name/\$image" >> $ota_script
			echo "		if [ \$? -ne 0 ];then" >> $ota_script
			echo "			echo \"Error: \$image write failed.\"" >> $ota_script
			echo "			exit 1" >> $ota_script
			echo "		fi" >> $ota_script
			echo "	fi" >> $ota_script
			echo "done" >> $ota_script
			echo "echo \"Erase misc partition\"" >> $ota_script
			echo "dd if=/dev/zero of=/dev/block/by-name/misc bs=32 count=1 seek=512" >> $ota_script
			echo "if [ \$? -ne 0 ];then" >> $ota_script
			echo "	echo \"Error: Erase misc partition failed.\"" >> $ota_script
			echo "	exit 2" >> $ota_script
			echo "fi" >> $ota_script
			;;
		spi_nand|slc_nand)
			echo "for image in \$(ls /dev/block/by-name)" >> $ota_script
			echo "do" >> $ota_script
			echo "	if [ -f \$COMMON_DIR/\${image}.img ];then" >> $ota_script
			echo "		echo \"Writing \$image...\"" >> $ota_script
			echo "		mtd_path=\$(realpath /dev/block/by-name/\${image})" >> $ota_script
			echo "		flash_eraseall \$mtd_path" >> $ota_script
			echo "		nandwrite -p \$mtd_path \$COMMON_DIR/\${image}.img" >> $ota_script
			echo "		if [ \$? -ne 0 ];then" >> $ota_script
			echo "			echo \"Error: \$image write failed.\"" >> $ota_script
			echo "			exit 1" >> $ota_script
			echo "		fi" >> $ota_script
			echo "	fi" >> $ota_script
			echo "done" >> $ota_script
			echo "echo \"Erase misc partition\"" >> $ota_script
			echo "flash_eraseall /dev/block/by-name/misc" >> $ota_script
			echo "if [ \$? -ne 0 ];then" >> $ota_script
			echo "	echo \"Error: Erase misc partition failed.\"" >> $ota_script
			echo "	exit 2" >> $ota_script
			echo "fi" >> $ota_script
			;;
		*)
			echo "Not support storage medium type: $RK_BOOT_MEDIUM"
			finish_build
			exit 1
			;;
	esac

	chmod a+x $ota_script

	finish_build
}

打包

function build_firmware(){
	check_config RK_PARTITION_CMD_IN_ENV || return 0

	build_env
	build_meta

	mkdir -p ${RK_PROJECT_OUTPUT_IMAGE}

	if [ "$RK_ENABLE_RECOVERY" = "y" -a -f $PROJECT_TOP_DIR/scripts/${RK_MISC:=recovery-misc.img} ];then
		cp -fv $PROJECT_TOP_DIR/scripts/$RK_MISC ${RK_PROJECT_OUTPUT_IMAGE}/misc.img
	fi

	__PACKAGE_ROOTFS
	__PACKAGE_OEM

	__BUILD_ENABLE_COREDUMP_SCRIPT

	__RUN_PRE_BUILD_OEM_SCRIPT

	if [ "$RK_BUILD_APP_TO_OEM_PARTITION" = "y" ];then
		rm -rf $RK_PROJECT_PACKAGE_ROOTFS_DIR/oem/*
		build_mkimg $GLOBAL_OEM_NAME $RK_PROJECT_PACKAGE_OEM_DIR
	else
		mkdir -p $RK_PROJECT_PACKAGE_ROOTFS_DIR/oem
		__COPY_FILES $RK_PROJECT_PACKAGE_OEM_DIR $RK_PROJECT_PACKAGE_ROOTFS_DIR/oem
		rm -rf $RK_PROJECT_PACKAGE_OEM_DIR
	fi

	__RUN_POST_BUILD_SCRIPT
	post_overlay

	if [ -n "$GLOBAL_INITRAMFS_BOOT_NAME" ]; then
		build_mkimg boot $RK_PROJECT_PACKAGE_ROOTFS_DIR
	fi

	if [ "$RK_ENABLE_FASTBOOT" = "y" ]; then
		build_mkimg boot $RK_PROJECT_PACKAGE_ROOTFS_DIR
	else
		build_mkimg $GLOBAL_ROOT_FILESYSTEM_NAME $RK_PROJECT_PACKAGE_ROOTFS_DIR
	fi

	# package a empty userdata parition image
	mkdir -p $RK_PROJECT_PACKAGE_USERDATA_DIR
	build_mkimg userdata $RK_PROJECT_PACKAGE_USERDATA_DIR

	build_tftp_sd_update

	[ "$RK_ENABLE_RECOVERY" = "y" -o "$RK_ENABLE_OTA" = "y" ] && build_ota
	build_updateimg

	finish_build
}

打包文件系统

function __PACKAGE_ROOTFS()
{
	local rootfs_tarball _target_dir _install_dir
	rootfs_tarball="$RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar"
	if [ -f $rootfs_tarball ]; then
		tar xf $rootfs_tarball -C $RK_PROJECT_OUTPUT
	else
		msg_error "Not found rootfs tarball: $rootfs_tarball"
		exit 1
	fi

	build_get_sdk_version

	cat > $RK_PROJECT_PACKAGE_ROOTFS_DIR/bin/sdkinfo <<EOF
#!/bin/sh
echo Build Time:  `date "+%Y-%m-%d-%T"`
echo SDK Version: ${GLOBAL_SDK_VERSION}
EOF
	chmod a+x $RK_PROJECT_PACKAGE_ROOTFS_DIR/bin/sdkinfo

	__COPY_FILES $RK_PROJECT_PATH_APP/root $RK_PROJECT_PACKAGE_ROOTFS_DIR
	__COPY_FILES $RK_PROJECT_PATH_MEDIA/root $RK_PROJECT_PACKAGE_ROOTFS_DIR

	if [ -d "$RK_PROJECT_PACKAGE_ROOTFS_DIR/usr/share/iqfiles" ];then
		(cd $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc; ln -sf ../usr/share/iqfiles ./)
	fi

	if [ -f $RK_PROJECT_FILE_ROOTFS_SCRIPT ];then
		chmod a+x $RK_PROJECT_FILE_ROOTFS_SCRIPT
		cp -f $RK_PROJECT_FILE_ROOTFS_SCRIPT $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/init.d
	fi
}

打包OEM


function __PACKAGE_OEM()
{
	mkdir -p $RK_PROJECT_PACKAGE_OEM_DIR
	__PACKAGE_RESOURCES $RK_PROJECT_PACKAGE_OEM_DIR
	if [ -d "$RK_PROJECT_PACKAGE_OEM_DIR/usr/share/iqfiles" ];then
		(cd $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc; ln -sf ../oem/usr/share/iqfiles ./)
	fi

	mkdir -p $(dirname $RK_PROJECT_FILE_OEM_SCRIPT)
	cat > $RK_PROJECT_FILE_OEM_SCRIPT <<EOF
#!/bin/sh
[ -f /etc/profile.d/RkEnv.sh ] && source /etc/profile.d/RkEnv.sh
case \$1 in
	start)
		sh /oem/usr/bin/RkLunch.sh
		;;
	stop)
		sh /oem/usr/bin/RkLunch-stop.sh
		;;
	*)
		exit 1
		;;
esac
EOF

	chmod a+x $RK_PROJECT_FILE_OEM_SCRIPT
	cp -f $RK_PROJECT_FILE_OEM_SCRIPT $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/init.d
}

你可能感兴趣的:(嵌入式linux,嵌入式Linux驱动,驱动开发)