Skip to content

Commit

Permalink
script: add build_rv_ramdisk_ci for Jenkins.
Browse files Browse the repository at this point in the history
User can use build_rv_ramdisk ap/rp/tp/mini to build cpio, but CI
should use build_rv_ramdisk_ci to check file.

Signed-off-by: dong.yang <[email protected]>
  • Loading branch information
p7salon authored and xingxg2022 committed Nov 5, 2024
1 parent 4328faf commit 765703f
Showing 1 changed file with 91 additions and 1 deletion.
92 changes: 91 additions & 1 deletion scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,10 @@ RAMDISK_CPU_TYPES=(
ap
rp
tp
mini
)

function build_rv_ramdisk()
function build_rv_ramdisk_ci()
{
for i in ${RAMDISK_CPU_TYPES[@]}
do
Expand Down Expand Up @@ -1016,6 +1017,7 @@ function build_rv_ramdisk()
cp $TPUV7_RUNTIME_DIR/cdmlib/overlay/tp/* $RV_RAMDISK_DIR/build/tp/rootfs/tpu/
fi
fi

if [ "ap" == $RAMDISK_CPU_TYPE ]; then
if [ -f $TPUV7_AP_DAEMON ]; then
echo "copy cdmlib overlay ap all to rootfs/"
Expand All @@ -1027,6 +1029,7 @@ 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/"
Expand All @@ -1044,6 +1047,93 @@ function build_rv_ramdisk()
popd
}

function clean_rv_ramdisk_ci()
{
for i in ${RAMDISK_CPU_TYPES[@]}
do
if [ "$i" == "$1" ]; then
local RAMDISK_CPU_TYPE=$1
fi
done
if [ -z "$RAMDISK_CPU_TYPE" ]; then
echo please specify a ramdisk type:
for i in ${RAMDISK_CPU_TYPES[@]}
do
echo -e "\t $i"
done
return
fi
rm -rf $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE
rm -rf $RV_FIRMWARE_INSTALL_DIR/$RAMDISK_CPU_TYPE\_rootfs.cpio
}

function build_rv_ramdisk()
{
for i in ${RAMDISK_CPU_TYPES[@]}
do
if [ "$i" == "$1" ]; then
local RAMDISK_CPU_TYPE=$1
fi
done
if [ -z "$RAMDISK_CPU_TYPE" ]; then
echo please specify a ramdisk type:
for i in ${RAMDISK_CPU_TYPES[@]}
do
echo -e "\t $i"
done
return
fi
echo build ramdisk for $RAMDISK_CPU_TYPE

rm -rf $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE
mkdir -p $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs
cp -rf $RV_RAMDISK_DIR/rootfs_202405/* $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs

if [ "mini" == $RAMDISK_CPU_TYPE ]; then
echo "mini ramdisk don't copy overlay files"
else
cp -rf $RV_RAMDISK_DIR/overlay/$RAMDISK_CPU_TYPE/* $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs
fi

if [ "tp" == $RAMDISK_CPU_TYPE ]; then
# copy tp daemon
if [ -f $TPUV7_TP_DAEMON ]; then
cp $TPUV7_TP_DAEMON $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs/
else
echo "no ap daemon found"
fi
# copy other non-generated files
if [ -d $TPUV7_RUNTIME_DIR/cdmlib/overlay/tp ]; then
echo "copy cdmlib overlay tp all to rootfs/tpu"
cp $TPUV7_RUNTIME_DIR/cdmlib/overlay/tp/* $RV_RAMDISK_DIR/build/tp/rootfs/tpu/
fi
fi
if [ "ap" == $RAMDISK_CPU_TYPE ]; then
if [ -f $TPUV7_AP_DAEMON ]; then
echo "copy cdmlib overlay ap all to rootfs/"
cp $TPUV7_AP_DAEMON $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs/
cp $TPUV7_RUNTIME_DIR/build/asic/cdmlib/ap/tools/debug_console_clnt/debug_console_clnt $RV_RAMDISK_DIR/build/ap/rootfs/
cp $TPUV7_RUNTIME_DIR/build/asic/cdmlib/ap/tools/dump_memory/dump $RV_RAMDISK_DIR/build/ap/rootfs/
else
echo "no ap daemon found"
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"
fi
fi

pushd $RV_RAMDISK_DIR/build/$RAMDISK_CPU_TYPE/rootfs
find . | cpio -o -H newc > ../$RAMDISK_CPU_TYPE\_rootfs.cpio
cp ../$RAMDISK_CPU_TYPE\_rootfs.cpio $RV_FIRMWARE_INSTALL_DIR

popd
}

function clean_rv_ramdisk()
{
for i in ${RAMDISK_CPU_TYPES[@]}
Expand Down

0 comments on commit 765703f

Please sign in to comment.