replace sudo's in genTrace.sh with suggested commands

This commit is contained in:
bbracker 2022-03-06 14:24:50 -08:00
parent 91f327e109
commit e57b5208dc

View file

@ -13,32 +13,36 @@ Would you like to proceed? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Create Output Directory
echo "Elevating permissions to create $traceFile, $interruptsFile"
sudo mkdir -p $tvDir
sudo chown cad $tvDir
sudo touch $traceFile
sudo touch $interruptsFile
sudo chmod a+rw $traceFile
sudo chmod a+rw $interruptsFile
if [ ! -d "$tvDir" ]; then
echo "Error: linux testvector directory $tvDir not found!">&2
echo "Please create it. For example:">&2
echo " sudo mkdir -p $tvDir">&2
exit 1
fi
test -w $RISCV/linux-testvectors
if [ ! $? -eq 0 ]; then
echo "Error: insuffcient write privileges for linux testvector directory $tvDir !">&2
echo "Please chmod it. For example:">&2
echo " sudo chmod -R a+rw $tvDir">&2
exit 1
fi
# Compile Devicetree from Source
dtc -I dts -O dtb ../devicetree/wally-virt.dts > ../devicetree/wally-virt.dtb
touch $traceFile
touch $interruptsFile
# QEMU Simulation
echo "Launching QEMU in replay mode!"
(qemu-system-riscv64 \
-M virt -dtb ../devicetree/wally-virt.dtb \
-M virt -dtb $imageDir/wally-virt.dtb \
-nographic \
-bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio \
-singlestep -rtc clock=vm -icount shift=0,align=off,sleep=on,rr=replay,rrfile=$recordFile \
-d nochain,cpu,in_asm,int \
2>&1 >/dev/null | ./parseQEMUtoGDB.py | ./parseGDBtoTrace.py $interruptsFile | ./remove_dup.awk > $traceFile)
# Cleanup
echo "Elevating permissions to restrict write access to $traceFile, $interruptsFile"
sudo chown cad $traceFile
sudo chown cad $interruptsFile
sudo chmod o-w $traceFile
sudo chmod o-w $interruptsFile
echo "genTrace.sh completed!"
echo "You may want to restrict write access to $tvDir now and give cad ownership of it."
echo "Run the following:"
echo " sudo chown -R cad:cad $tvDir"
echo " sudo chmod -R go-w $tvDir"
fi