Login  Register

Re: [FIRMWARE] Itus Networks Shield Firmware Upgrade *WIP*

Posted by Grommish on May 25, 2019; 6:58pm
URL: https://itus.accessinnov.com/FIRMWARE-Itus-Networks-Shield-Firmware-Upgrade-WIP-tp1726p1750.html

For anyone who is decent with bash scripting, I'm trying to do the following, but it keeps returning empty in the init script.


CUR_FS=$(blkid /dev/mmcblk1p3 | awk -F= '{print $3}');
echo "[DEBUG] Shield is in ${SHIELD_MODE} Mode - Using /dev/${MNT_POINT} as ${CUR_FS}" > /dev/kmsg


When I run the command on the box in the shell itself, I get the following:


root@OpenWrt:/# $(blkid /dev/mmcblk1p3 | awk -F= '{print $3}');
/bin/ash: "f2fs": not found


"f2fs" is what it SHOULD report, so that's right (although any suggestions on stripping those double-quotes would be very helpful)

However, what appears in the kernel log:


[   34.828073] [DEBUG] Shield is in Gateway Mode - Using /dev/mmcblk1p3 as


Eventually, I'll be replacing the hardcoded mmcblk1p3 with another variable that's set by reading the GPIO settings.


GPIO=0
GPIO16=1
GPIO17=2

GPIO=16
echo $GPIO > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio$GPIO/direction
GPIO16=$(cat /sys/class/gpio/gpio${GPIO}/value)
echo $GPIO > /sys/class/gpio/unexport

GPIO=17
echo $GPIO > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio$GPIO/direction
GPIO17=$(cat /sys/class/gpio/gpio${GPIO}/value)
echo $GPIO > /sys/class/gpio/unexport

if [ $GPIO16 -eq 0 ]; then
   # Gateway Mode
   SHIELD_MODE="Gateway"
   MNT_POINT="mmcblk1p3"
else
   if [ $GPIO17 -eq 0 ]; then
      # Bridge Mode
      SHIELD_MODE="Bridge"
      MNT_POINT="mmcblk1p4"
   else
      # Router Mode
      SHIELD_MODE="Router"
      MNT_POINT="mmcblk1p2"
   fi
fi


This allows us to read the Front-switch state and load the config files as appropriate (and/or just load the appropriate mmcblk for the mode)

Getting there!  My next steps are to ensure the file system is correct (which is why I really need to get the awk command working), format the block if it isn't setup for f2fs, and copy a seed tgz package to the mount point to get things started.  This should let anyone who is coming from the stock Itus images to easily convert over.

Anyway, I know the couple people who are actually following this are away on travel or other things, but maybe they can spot the error I'm having.

Cheers!
Running Itus Shield v2 Firmware