diff --git a/ramdisk/overlay/rp/etc/init.d/S60rpenv b/ramdisk/overlay/rp/etc/init.d/S60rpenv new file mode 100644 index 00000000..fbe195b2 --- /dev/null +++ b/ramdisk/overlay/rp/etc/init.d/S60rpenv @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Script to load modules and start rp_daemon +# + +# Set environment variables +export LD_LIBRARY_PATH=/lib:/lib64:/usr/lib:/opt/lib +export PATH=$PATH:/opt/bin + +# Function to load a module with a delay +load_module() { + echo "Loading module \$1..." + insmod \$1 + # Wait for 5 seconds + sleep 5 +} + +echo "Starting module loading process..." + +# Load modules with pauses in between +load_module /opt/ko/rp_daemon.ko +load_module /opt/ko/soph_base.ko +load_module /opt/ko/soph_vpss.ko +load_module /opt/ko/soph_vc_drv.ko + +# Trigger mdev to populate /dev based on loaded modules +echo "Triggering mdev..." +mdev -s + +# Start the rp_daemon process +echo "Starting rp_daemon..." +rp_daemon + +echo "All processes started successfully." diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index b2fa25e2..387f0e8a 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -35,7 +35,7 @@ CHIP=${CHIP} KERNEL_VARIANT=${KERNEL_VARIANT:-normal} # normal, mininum, debug CHIP_NUM=${CHIP_NUM:-single} # single, multi VENDOR=${VENDOR:-sophgo} - +TPUV7_RP_DAEMON=${1:-""} # receive import path # absolute path RV_TOP_DIR=${TOP_DIR:-$(get_rv_top)} @@ -1027,7 +1027,15 @@ function build_rv_ramdisk() return 1 fi fi - + if [ "rp" == $RAMDISK_CPU_TYPE ]; then + if [ -d $TPUV7_RP_DAEMON ]; then + echo "copy rp ramdisk all to rootfs/" + cp -r $TPUV7_RP_DAEMON/* $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs/ + else + echo "no rp daemon found" + return 1 + fi + fi pushd $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs find . | cpio -o -H newc > ../$RAMDISK_CPU_TYPE\_rootfs.cpio