This commit is contained in:
2022-04-22 17:30:51 +01:00
parent 3ada4bba37
commit 01f327e7e0

136
san
View File

@@ -56,7 +56,8 @@ factory_reset()
# Firmware flash. # Firmware flash.
# #
ACRAMFS=/tmp/acramfs.bin ACRAMFS=/tmp/acramfs.bin
MMC_UP_DEV=/dev/mmc_Update MMC_ACTIVE_DEV=/dev/mmc_Active
MMC_UPDATE_DEV=/dev/mmc_Update
SWUP_DEV=/dev/swupdev SWUP_DEV=/dev/swupdev
SWUP_PROC=/proc/swupdev SWUP_PROC=/proc/swupdev
@@ -75,14 +76,22 @@ set_image_dir()
esac esac
} }
download_from_main_buildarea()
{
set_image_dir
ACRAMFS_URL="main/${IMAGE_DIR}/dist/image/acramfs/acramfs.bin"
download_firmware "${ACRAMFS_URL}"
}
download_firmware() download_firmware()
{ {
BRANCH_DIR="roku/main" ACRAMFS_URL="http://$SERVER_IP/roku/$1"
set_image_dir
ACRAMFS_URL="http://$SERVER_IP/${BRANCH_DIR}/${IMAGE_DIR}/dist/image/acramfs/acramfs.bin"
echo "Downloading ${ACRAMFS_URL}" echo "Downloading ${ACRAMFS_URL}"
wget -O ${ACRAMFS} ${ACRAMFS_URL} wget -O ${ACRAMFS} ${ACRAMFS_URL}
[ $? -eq 0 ] || exit if [ $? -ne 0 ]; then
echo "Download failed."
return 1
fi
} }
update_firmware() update_firmware()
@@ -92,8 +101,15 @@ update_firmware()
echo -n memlock >$SWUP_PROC echo -n memlock >$SWUP_PROC
echo -n writeswupmagic >$SWUP_PROC echo -n writeswupmagic >$SWUP_PROC
echo -n commit >$SWUP_PROC echo -n commit >$SWUP_PROC
elif [ -b $MMC_UP_DEV ]; then elif [ -b $MMC_UPDATE_DEV ]; then
dd if=${ACRAMFS} of=$MMC_UP_DEV bs=65536 if [ "$1" == "active" -o "$1" == "both" ]; then
echo "Flashing $MMC_ACTIVE_DEV"
[ -b "$MMC_ACTIVE_DEV" ] && dd if=${ACRAMFS} of=$MMC_ACTIVE_DEV bs=65536
fi
if [ "$1" == "update" -o "$1" == "both" ]; then
echo "Flashing $MMC_UPDATE_DEV"
dd if=${ACRAMFS} of=$MMC_UPDATE_DEV bs=65536
fi
else else
rm -f ${ACRAMFS} rm -f ${ACRAMFS}
echo 'Cannot update this platform' >&2 echo 'Cannot update this platform' >&2
@@ -101,25 +117,36 @@ update_firmware()
fi fi
} }
descr " rokuflash - " descr " rokuflash [active|both] [acramfs path] - empty flashes from build area"
rokuflash() rokuflash()
{ {
download_firmware if [ "$1" = "active" -o "$1" = "both" ]; then
update_firmware UPDATE_PARTITION="$1"
shift
else
UPDATE_PARTITION="update"
fi
if [ -z "$1" ]; then
download_from_main_buildarea
else
download_firmware $1
fi
[ $? -eq 0 ] && update_firmware $UPDATE_PARTITION
[ $? -eq 0 ] && fastboot_reset
} }
descr " rokuflashgold - " descr " rokuflashgold - "
rokuflashgold() rokuflashgold()
{ {
ACRAMFS_URL="http://$SERVER_IP/roku/golden/acramfs.${ROKU_PLATFORM}.bin" download_firmware "golden/acramfs.${ROKU_PLATFORM}.bin"
echo "Downloading ${ACRAMFS_URL}" [ $? -eq 0 ] && update_firmware "update"
wget -O ${ACRAMFS} ${ACRAMFS_URL} [ $? -eq 0 ] && fastboot_reset
update_firmware
} }
###############################################################################v ###############################################################################v
# 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
# #
@@ -142,7 +169,7 @@ setup_gdb()
cat > /nvram/launch_gdb.sh << EOF cat > /nvram/launch_gdb.sh << EOF
#!/bin/sh #!/bin/sh
cp -r /nvram/tools /tmp/tools2 cp -r /nvram/tools /tmp/tools2
#export APIB_GDBSERVER="/tmp/tools2/strac -f" #export APIB_GDBSERVER="/tmp/tools2/strace -f"
#export APIB_GDBSERVER="/tmp/tools2/gdbserver :5555" #export APIB_GDBSERVER="/tmp/tools2/gdbserver :5555"
export APP_GDBSERVER="/tmp/tools2/gdbserver :5555" export APP_GDBSERVER="/tmp/tools2/gdbserver :5555"
#no watch dog #no watch dog
@@ -167,6 +194,56 @@ disable_gdb()
mv /tmp/autostart /nvram/ mv /tmp/autostart /nvram/
} }
################################################################################
#
# Log
#
LOG_CONF="/nvram/logapi.conf"
descr " log_reset - reset log configuration"
log_reset()
{
[ -f $LOG_CONF ] && rm $LOG_CONF
}
descr " log_all - log everything"
log_all()
{
echo "+c *" >> $LOG_CONF
}
################################################################################
#
# Config
#
descr " config_reset - erase configuration"
config_reset()
{
su app -c "ConfigService -ro"
}
descr " config_list - "
config_list()
{
su app -c "ConfigService -lo"
}
config_enable()
{
su app -c "ConfigService -so $1=true"
}
config_disable()
{
su app -c "ConfigService -so $1=true"
}
descr " disable_failsafe - "
disable_failsafe()
{
config_enable "fw.apibroker.failsafe-disable"
}
################################################################################ ################################################################################
# #
# Fastboot related # Fastboot related
@@ -184,18 +261,13 @@ descr " disable_fastboot - "
disable_fastboot() disable_fastboot()
{ {
su app -c "ConfigService -so fw.fastboot.capture.snapshot=false" su app -c "ConfigService -so fw.fastboot.capture.snapshot=false"
fastboot_reset
} }
descr " config_reset - " descr " fastboot_reset - "
config_reset() fastboot_reset()
{ {
su app -c "ConfigService -ro" [ -e /dev/mapper/snapshotree ] && mkswap /dev/mapper/snapshotree
}
descr " config_list - "
config_list()
{
su app -c "ConfigService -lo"
} }
################################################################################ ################################################################################
@@ -216,12 +288,6 @@ set_office_network()
PSK="ahovwxy@.0" PSK="ahovwxy@.0"
} }
set_home_network()
{
SSID="vodafone399827"
PSK="v98AkhachA+1Vika33831294215495"
}
descr " setup_wifi - " descr " setup_wifi - "
setup_wifi() setup_wifi()
@@ -234,8 +300,6 @@ setup_wifi()
sleep 3 sleep 3
set_office_network set_office_network
wpa scan_result | grep $SSID wpa scan_result | grep $SSID
[ $? == 0 ] || set_home_network
wpa scan_result | grep $SSID
[ $? == 0 ] || return 2 [ $? == 0 ] || return 2
NETWORK=$(wpa add_network) NETWORK=$(wpa add_network)
@@ -252,6 +316,12 @@ setup_wifi()
ip a add $IP/22 dev $IFACE ip a add $IP/22 dev $IFACE
} }
descr " setup_network - "
setup_network()
{
/sbin/udhcpc -i eth0 -s /etc/udhcpc.sh
}
alias ll='ls -la' alias ll='ls -la'
################################################################################ ################################################################################