From 3ada4bba37dd14103ed1aeeb3e113328b5b107e2 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Mon, 28 Mar 2022 15:55:08 +0100 Subject: [PATCH] More tools. --- san | 94 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/san b/san index 3fdfeab..3fb98da 100644 --- a/san +++ b/san @@ -2,7 +2,7 @@ set -o vi # set -x -SERVER_IP=192.168.0.63 +SERVER_IP=192.168.0.64 DESCR="" descr(){ @@ -17,19 +17,28 @@ san_help() printf "$DESCR\n" } +UPDATE_SAN="wget -O /nvram/san http://$SERVER_IP/roku/san/san" descr " update_san - update this script." +descr " Manually: $UPDATE_SAN" update_san() { - tftp -r san -l /nvram/san -g $SERVER_IP + eval $UPDATE_SAN source /nvram/san } descr " upload - upload through tftp. e.g. upload /dev/ltcore" upload() { - tftp -r $(basename $1) -l $1 -g $SERVER_IP + [ -e $1 ] && tftp -r $(basename $1) -l $1 -p $SERVER_IP } +descr " upload_core - upload /dev/ltcore" +upload_core() +{ + upload /dev/ltcore +} + + descr " app_config - " app_config() { @@ -102,7 +111,7 @@ rokuflash() descr " rokuflashgold - " rokuflashgold() { - ACRAMFS_URL="http://$SERVER_IP/acramfs.${ROKU_PLATFORM}.bin" + ACRAMFS_URL="http://$SERVER_IP/roku/golden/acramfs.${ROKU_PLATFORM}.bin" echo "Downloading ${ACRAMFS_URL}" wget -O ${ACRAMFS} ${ACRAMFS_URL} update_firmware @@ -114,6 +123,8 @@ rokuflashgold() # Ddd to the start of the script # export APP_GDBSERVER="/nvram/tools/gdbserver :5555"ebug Server # +descr "" +descr " GDB" descr " setup_gdb - " setup_gdb() { @@ -121,56 +132,78 @@ setup_gdb() cp -rL /tmp/tools /nvram/ #remount nvram with executable flag executable - mount /nvram -o remount,exec + # mount /nvram -o remount,exec #make nvram to preserve the exec flag after reboot: - mkdir /nvram/debug_overlay + # kdir /nvram/debug_overlay + + # Create debug script, where we copy gdb back to tmp and run it from there. + # This is to allow fastboot to umount /nvram + cat > /nvram/launch_gdb.sh << EOF +#!/bin/sh +cp -r /nvram/tools /tmp/tools2 +#export APIB_GDBSERVER="/tmp/tools2/strac -f" +#export APIB_GDBSERVER="/tmp/tools2/gdbserver :5555" +export APP_GDBSERVER="/tmp/tools2/gdbserver :5555" +#no watch dog +export appargs="-nowd" +EOF +} - #enable gdbserver to /etc/autostart script - #add to the start of the script - grep APP_GDBSERVER /nvram/autostart +descr " enable_gdb - " +enable_gdb() +{ + grep launch_gdb.sh /nvram/autostart > /dev/null if [ $? != 0 ]; then - echo "export APP_GDBSERVER=\"/nvram/tools/gdbserver :5555\"" >> /nvram/autostart + echo "source /nvram/launch_gdb.sh" >> /nvram/autostart fi } +descr " disable_gdb - " +disable_gdb() +{ + [ -f /nvram/autostart ] && cat /nvram/autostart | sed '/launch_gdb/d' > /tmp/autostart + rm /nvram/autostart + mv /tmp/autostart /nvram/ +} + ################################################################################ # # Fastboot related # +descr "" +descr " FastBoot" descr " enable_fastboot - " enable_fastboot() { - echo " - { - \"configi\" : { - \"fw.fastboot.capture.snapshot\": \"true\" - } - }" > /nvram/CSOverride.json + su app -c "ConfigService -so fw.fastboot.capture.snapshot=true" } descr " disable_fastboot - " disable_fastboot() { - echo " - { - \"configi\" : { - \"fw.fastboot.capture.snapshot\": \"false\" - } - }" > /nvram/CSOverride.json + su app -c "ConfigService -so fw.fastboot.capture.snapshot=false" } -descr " remove_config - " -remove_config() +descr " config_reset - " +config_reset() { - rm /nvram/CSOverride.json + su app -c "ConfigService -ro" +} + +descr " config_list - " +config_list() +{ + su app -c "ConfigService -lo" } ################################################################################ # # Wifi Setup # +descr "" +descr " WiFi" IFACE=wlan0 wpa() { @@ -225,6 +258,17 @@ alias ll='ls -la' # # Done # +grep /nvram/san /nvram/autostart > /dev/null +if [ $? != 0 ]; then + cat > /nvram/autostart << EOF +#!/bin/sh +/sbin/udhcpc -i eth0 -s /etc/udhcpc.sh +ifconfig +noreset +source /nvram/san +EOF +fi + san_help # PROGNAME="${0##*/}"