Folks-

As noted earlier, I found myself unable to flash OpenWRT on to new Ubiquiti PicoStation 2HP radios. After working on it for about a week, I have found a solution, at least for my own purposes.

I'm not familiar enough with the OpenWRT standards to suggest a specific patch, but I'll share the hack I'm using on my own (adulterated) version of the Robin firmware.

As Jo-Philipp Wich pointed out on January 1:

Hi.

Ubiquiti tightened the regulatory enforcement. They now ship with a
regdomain entry in the boarddate which is not recognized by OpenWrt's
HAL, therfore the wifi is rejected.

It can be fixed by changing the byte at offset 0x277 in mtd6 to 0x00 or
any other valid regdomain id.

Possible fixes are difficult. One obvious solution is to make the HAL
recognize Ubnt's new IDs, but that is going to be difficult since its
closed source. The other workaround I can think of is to runtime-patch
the in-memory copy of the radio-data in the board setup code.

~ Jow


Here's how I did it is this; first, I put the following script in /etc/ and called it regdoman-script.sh:

*Code:*

#!/bin/sh
# By Bill Moffitt - this script puts a zero in the 632nd byte of the appropriate device
#
date >>/etc/firstbootlog
echo "Starting regdomain-script.sh" >>/etc/firstbootlog
partn=`grep boardconfig /proc/mtd |awk '{print $1}' |cut -d: -f1`
byte=$(hexdump -b /dev/$partn |grep 0000270 |awk '{print $9}')
echo "Going to work on partition $partn where regdomain is $byte"
if [ $byte == "000" ]; then
   echo "success" >/tmp/regdomain_success
   exit
fi
if [ $partn -a ! $byte == "000" ]; then
echo "Setting up regdomain on partition /dev/$partn" >>/etc/firstbootlog dd if=/dev/$partn of=/tmp/mtdfile bs=1 count=631 && echo "got the first 631 bytes" >>/etc/firstbootlog dd if=/dev/zero bs=1 count=1 >>/tmp/mtdfile && echo "put in the zero" >>/etc/firstbootlog dd if=/dev/$partn bs=1 skip=632 >>/tmp/mtdfile && echo "got the rest of the file" >>/etc/firstbootlog
   mtd erase $partn && echo "erased the partition" >>/etc/firstbootlog
dd if=/tmp/mtdfile of=/dev/$partn 2>>/etc/firstbootlog && echo "Finished flashing partition $partn" >>/etc/firstbootlog
   wait
   sync && echo "Sync succeeded" >>/etc/firstbootlog
   byte=$(hexdump -b /dev/$partn |grep 0000270 |awk '{print $9}')
   if [ $byte -eq "000" ]; then
      echo "regdomain is zero" >>/etc/firstbootlog
      sync &&
      rm /tmp/mtdfile
      date >>/etc/firstbootlog
      echo "done with regdomain" >>/etc/firstbootlog
      echo "success" >/tmp/regdomain_success
   else
echo "FAIL writing the file back to /dev/$partn - regdomain remains $byte"
   fi
else
   echo "Could not find partition" >>/etc/firstbootlog
fi



Next, I edited /etc/init.d/rcS. Just before it "kicks off" the rc.d scripts, I inserted the following code:

*Code:*

   if [ -e /etc/regdomain-script.sh ]; then
      logger "applying regdomain patch"
      /etc/regdomain-script.sh
      wait
      if [ -e /tmp/regdomain_success ]; then
         rm /etc/regdomain-script.sh
echo "regdomain-script.sh seems to have worked" >>/etc/firstbootlog
      else
echo "regdomain-script.sh seems to have failed" >>/etc/firstbootlog
      fi
   fi



The upshot of this is that, on the device's first boot, it looks for the correct /dev/mtd file, checks to see if it has the "bogus" byte that Ubiquiti has placed in there, and, if it does, it changes that byte. It leaves a little log file in /etc/firstbootlog (so you can tell what happened) and, if the regdomain-script.sh has succeeded, it deletes the script so it won't execute every time the device starts up.

Please let me know if you have any questions.

Thanks to Jo-Philipp and several others for help in debugging this.

-Bill
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to