Skip to content

Commit

Permalink
update rp ramdisk package
Browse files Browse the repository at this point in the history
  • Loading branch information
shuning.han authored and xingxg2022 committed Nov 1, 2024
1 parent a5bfbdf commit 4328faf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
34 changes: 34 additions & 0 deletions ramdisk/overlay/rp/etc/init.d/S60rpenv
Original file line number Diff line number Diff line change
@@ -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."
12 changes: 10 additions & 2 deletions scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4328faf

Please sign in to comment.