RkLunch.sh是个脚本,来自哪里
书接上回:rv1126-rv1109-瑞芯微的 IPC 程序_旋风旋风的博客-CSDN博客
修改之后
屏蔽了两行之后,就没有开机自启rklunch了:
# [ -f /oem/RkLunch.sh ] && source /oem/RkLunch.sh
就是运行source /oem/RkLunch.sh
这里就跑了RkLunch.sh脚本
#!/bin/sh
check_linker()
{
[ ! -L "$2" ] && ln -sf $1 $2
}
network_init()
{
ethaddr1=`ifconfig -a | grep "eth.*HWaddr" | awk '{print $5}'`
if [ -f /data/ethaddr.txt ]; then
ethaddr2=`cat /data/ethaddr.txt`
if [ $ethaddr1 == $ethaddr2 ]; then
echo "eth HWaddr cfg ok"
else
ifconfig eth0 down
ifconfig eth0 hw ether $ethaddr2
fi
else
echo $ethaddr1 > /data/ethaddr.txt
fi
ifconfig eth0 up && udhcpc -i eth0
}
post_chk()
{
#TODO: ensure /userdata mount done
cnt=0
while [ $cnt -lt 30 ];
do
cnt=$(( cnt + 1 ))
if mount | grep -w userdata; then
break
fi
sleep .1
done
network_init &
check_linker /userdata /oem/usr/www/userdata
check_linker /media/usb0 /oem/usr/www/usb0
check_linker /mnt/sdcard /oem/usr/www/sdcard
# if /data/rkipc not exist, cp /usr/share
rkipc_ini=/userdata/rkipc.ini
default_rkipc_ini=/tmp/rkipc-factory-config.ini
if [ ! -f "/oem/usr/share/rkipc.ini" ]; then
media-ctl -p | grep os04a10
if [ $? -eq 0 ] ;then
ln -s -f /oem/usr/share/rkipc-os04a10.ini $default_rkipc_ini
fi
media-ctl -p | grep imx335
if [ $? -eq 0 ] ;then
ln -s -f /oem/usr/share/rkipc-imx335.ini $default_rkipc_ini
fi
media-ctl -p | grep imx415
if [ $? -eq 0 ] ;then
ln -s -f /oem/usr/share/rkipc-imx415.ini $default_rkipc_ini
fi
fi
tmp_md5=/tmp/.rkipc-ini.md5sum
data_md5=/userdata/.rkipc-default.md5sum
md5sum $default_rkipc_ini > $tmp_md5
chk_rkipc=`cat $tmp_md5|awk '{print $1}'`
rm $tmp_md5
if [ ! -f $data_md5 ];then
md5sum $default_rkipc_ini > $data_md5
fi
grep -w $chk_rkipc $data_md5
if [ $? -ne 0 ] ;then
rm -f $rkipc_ini
echo "$chk_rkipc" > $data_md5
fi
if [ ! -f "$default_rkipc_ini" ];then
echo "Error: not found rkipc.ini !!!"
exit -1
fi
if [ ! -f "$rkipc_ini" ]; then
cp $default_rkipc_ini $rkipc_ini -f
fi
if [ ! -f "/userdata/image.bmp" ]; then
cp -fa /oem/usr/share/image.bmp /userdata/
fi
if [ -d "/oem/usr/share/iqfiles" ];then
rkipc -a /oem/usr/share/iqfiles &
else
rkipc &
fi
}
post_chk &
很简单的一个脚本,于是我剖析一下脚本,究竟是做了啥
这里是关键! rkipc &
./oem/usr/bin/rkipc
运行了这个可执行文件进入摄像头预览demo:rkipc
\rk\rv1126_rv1109\buildroot\package\rockchip\rkipc\Config.in
config BR2_PACKAGE_RKIPC
bool "rockchip rkipc"
select BR2_PACKAGE_CAMERA_ENGINE_RKAIQ
select BR2_PACKAGE_WPA_SUPPLICANT
select BR2_PACKAGE_FREETYPE
help
rockchip rkipc
choice
prompt "Platform type"
default BR2_PACKAGE_RKIPC_RK3588
help
Select a platform type.
config BR2_PACKAGE_RKIPC_RK3588
bool "Compile for rk3588 ipc"
select BR2_PACKAGE_ROCKIT
depends on BR2_PACKAGE_RKIPC
config BR2_PACKAGE_RKIPC_RK3588_MULTI_IPC
bool "Compile for rk3588 multi ipc"
select BR2_PACKAGE_ROCKIT
depends on BR2_PACKAGE_RKIPC
config BR2_PACKAGE_RKIPC_RV1126
bool "Compile for rv1126 ipc"
select BR2_PACKAGE_RKMEDIA
depends on BR2_PACKAGE_RKIPC
config BR2_PACKAGE_RKIPC_RV1126_BATTERY_IPC
bool "Compile for rv1126 battery ipc"
select BR2_PACKAGE_ROCKIT
select BR2_PACKAGE_VENDOR_STORAGE
depends on BR2_PACKAGE_RKIPC
endchoice
\rk\rv1126_rv1109\buildroot\package\rockchip\rkipc\rkipc.mk
RKIPC_SITE = $(TOPDIR)/../app/rkipc
RKIPC_SITE_METHOD = local
RKIPC_DEPENDENCIES = camera-engine-rkaiq wpa_supplicant freetype common_algorithm
ifeq ($(BR2_PACKAGE_RKIPC_RK3588), y)
RKIPC_CONF_OPTS += -DCOMPILE_FOR_RK3588=ON
endif
ifeq ($(BR2_PACKAGE_RKIPC_RK3588_MULTI_IPC), y)
RKIPC_CONF_OPTS += -DCOMPILE_FOR_RK3588_MULTI_IPC=ON
endif
ifeq ($(BR2_PACKAGE_RKIPC_RV1126), y)
RKIPC_DEPENDENCIES += rkmedia rkfsmk
RKIPC_CONF_OPTS += -DCOMPILE_FOR_RV1126_RKMEDIA=ON
endif
ifeq ($(BR2_PACKAGE_RKIPC_RV1126_BATTERY_IPC), y)
RKIPC_DEPENDENCIES += rockit rktoolkit
RKIPC_CONF_OPTS += -DCOMPILE_FOR_RV1126_BATTERY_IPC=ON
endif
$(eval $(cmake-package))
编译相关的东西
主要代码在./app/rkipc
这里就一个app了,后续大家有兴趣自己跟了,我到此为止了.我只是剖析一下开机自启的流程和原理,app代码部分就分析了