More tools.

This commit is contained in:
2022-03-28 15:55:08 +01:00
parent 3dc93a52a1
commit 3ada4bba37

94
san
View File

@@ -2,7 +2,7 @@
set -o vi set -o vi
# set -x # set -x
SERVER_IP=192.168.0.63 SERVER_IP=192.168.0.64
DESCR="" DESCR=""
descr(){ descr(){
@@ -17,19 +17,28 @@ san_help()
printf "$DESCR\n" printf "$DESCR\n"
} }
UPDATE_SAN="wget -O /nvram/san http://$SERVER_IP/roku/san/san"
descr " update_san - update this script." descr " update_san - update this script."
descr " Manually: $UPDATE_SAN"
update_san() update_san()
{ {
tftp -r san -l /nvram/san -g $SERVER_IP eval $UPDATE_SAN
source /nvram/san source /nvram/san
} }
descr " upload - upload through tftp. e.g. upload /dev/ltcore" descr " upload - upload through tftp. e.g. upload /dev/ltcore"
upload() 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 - " descr " app_config - "
app_config() app_config()
{ {
@@ -102,7 +111,7 @@ rokuflash()
descr " rokuflashgold - " descr " rokuflashgold - "
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}" echo "Downloading ${ACRAMFS_URL}"
wget -O ${ACRAMFS} ${ACRAMFS_URL} wget -O ${ACRAMFS} ${ACRAMFS_URL}
update_firmware update_firmware
@@ -114,6 +123,8 @@ rokuflashgold()
# Ddd to the start of the script # Ddd to the start of the script
# export APP_GDBSERVER="/nvram/tools/gdbserver :5555"ebug Server # export APP_GDBSERVER="/nvram/tools/gdbserver :5555"ebug Server
# #
descr ""
descr " GDB"
descr " setup_gdb - " descr " setup_gdb - "
setup_gdb() setup_gdb()
{ {
@@ -121,56 +132,78 @@ setup_gdb()
cp -rL /tmp/tools /nvram/ cp -rL /tmp/tools /nvram/
#remount nvram with executable flag executable #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: #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 descr " enable_gdb - "
#add to the start of the script enable_gdb()
grep APP_GDBSERVER /nvram/autostart {
grep launch_gdb.sh /nvram/autostart > /dev/null
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "export APP_GDBSERVER=\"/nvram/tools/gdbserver :5555\"" >> /nvram/autostart echo "source /nvram/launch_gdb.sh" >> /nvram/autostart
fi 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 # Fastboot related
# #
descr ""
descr " FastBoot"
descr " enable_fastboot - " descr " enable_fastboot - "
enable_fastboot() enable_fastboot()
{ {
echo " su app -c "ConfigService -so fw.fastboot.capture.snapshot=true"
{
\"configi\" : {
\"fw.fastboot.capture.snapshot\": \"true\"
}
}" > /nvram/CSOverride.json
} }
descr " disable_fastboot - " descr " disable_fastboot - "
disable_fastboot() disable_fastboot()
{ {
echo " su app -c "ConfigService -so fw.fastboot.capture.snapshot=false"
{
\"configi\" : {
\"fw.fastboot.capture.snapshot\": \"false\"
}
}" > /nvram/CSOverride.json
} }
descr " remove_config - " descr " config_reset - "
remove_config() config_reset()
{ {
rm /nvram/CSOverride.json su app -c "ConfigService -ro"
}
descr " config_list - "
config_list()
{
su app -c "ConfigService -lo"
} }
################################################################################ ################################################################################
# #
# Wifi Setup # Wifi Setup
# #
descr ""
descr " WiFi"
IFACE=wlan0 IFACE=wlan0
wpa() wpa()
{ {
@@ -225,6 +258,17 @@ alias ll='ls -la'
# #
# Done # 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 san_help
# PROGNAME="${0##*/}" # PROGNAME="${0##*/}"