mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	Add tools for RUTX platform on 6.1 kernel
This commit is contained in:
		
							parent
							
								
									f9d849ae11
								
							
						
					
					
						commit
						34d19875d7
					
				
					 34 changed files with 4894 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
ath10kcal_die() {
 | 
			
		||||
	echo "ath10cal: " "$*"
 | 
			
		||||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ath10kcal_extract() {
 | 
			
		||||
	local part=$1
 | 
			
		||||
	local offset=$2
 | 
			
		||||
	local count=$3
 | 
			
		||||
	local mtd
 | 
			
		||||
 | 
			
		||||
	mtd=$(find_mtd_chardev $part)
 | 
			
		||||
	[ -n "$mtd" ] || \
 | 
			
		||||
		ath10kcal_die "no mtd device found for partition $part"
 | 
			
		||||
 | 
			
		||||
	dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
 | 
			
		||||
		ath10kcal_die "failed to extract calibration data from $mtd"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ensure_correct_art() {
 | 
			
		||||
	# NOTE(rytis): Hardcoded hashes for 64 KiB file, filled with zeroes (md5b0) and ones (md5b1).
 | 
			
		||||
	local md5b0="fcd6bcb56c1689fcef28b57c22475bad"
 | 
			
		||||
	local md5b1="ecb99e6ffea7be1e5419350f725da86b"
 | 
			
		||||
	local artdir="/dev/mtd12"
 | 
			
		||||
	local bindir="/usr/share/art/art_rutx.bin"
 | 
			
		||||
	local md5art="$(md5sum $artdir)"
 | 
			
		||||
	md5art="${md5art%% *}"
 | 
			
		||||
	local devicename="$(mnf_info -n)"
 | 
			
		||||
	devicename="${devicename:0:6}"
 | 
			
		||||
 | 
			
		||||
	if [ "$devicename" != "RUTX08" ] && [ "$devicename" != "RUTX09" ]; then
 | 
			
		||||
		if [ "$md5art" == "$md5b0" ] || [ "$md5art" == "$md5b1" ] && [ -e "$bindir" ]; then
 | 
			
		||||
			mtd write $bindir $artdir
 | 
			
		||||
		fi
 | 
			
		||||
	else
 | 
			
		||||
		if [ "$md5art" != "$md5b0" ] && [ "$md5art" != "$md5b1" ]; then
 | 
			
		||||
			mtd erase $artdir
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
 | 
			
		||||
 | 
			
		||||
. /lib/functions.sh
 | 
			
		||||
. /lib/functions/system.sh
 | 
			
		||||
 | 
			
		||||
board=$(board_name)
 | 
			
		||||
 | 
			
		||||
ensure_correct_art
 | 
			
		||||
 | 
			
		||||
case "$FIRMWARE" in
 | 
			
		||||
"ath10k/pre-cal-ahb-a000000.wifi.bin")
 | 
			
		||||
	case "$board" in
 | 
			
		||||
	teltonika,rutx)
 | 
			
		||||
		ath10kcal_extract "0:ART" 4096 12064
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	;;
 | 
			
		||||
"ath10k/pre-cal-ahb-a800000.wifi.bin")
 | 
			
		||||
	case "$board" in
 | 
			
		||||
	teltonika,rutx)
 | 
			
		||||
		ath10kcal_extract "0:ART" 20480 12064
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	;;
 | 
			
		||||
*)
 | 
			
		||||
	exit 1
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
#!/bin/ash
 | 
			
		||||
 | 
			
		||||
[ "$ACTION" == "add" ] || exit 0
 | 
			
		||||
 | 
			
		||||
PHYNBR=${DEVPATH##*/phy}
 | 
			
		||||
 | 
			
		||||
[ -n $PHYNBR ] || exit 0
 | 
			
		||||
 | 
			
		||||
. /lib/functions.sh
 | 
			
		||||
. /lib/functions/system.sh
 | 
			
		||||
 | 
			
		||||
board=$(board_name)
 | 
			
		||||
 | 
			
		||||
case "$board" in
 | 
			
		||||
	teltonika,rutx)
 | 
			
		||||
		mac_addr=$(mtd_get_mac_binary 0:CONFIG 0)
 | 
			
		||||
		if [ "$mac_addr" != "ff:ff:ff:ff:ff:ff" ]; then
 | 
			
		||||
			echo $(macaddr_add $mac_addr $(($PHYNBR + 2)) ) > /sys${DEVPATH}/macaddress
 | 
			
		||||
		fi
 | 
			
		||||
		;;
 | 
			
		||||
	*)
 | 
			
		||||
		;;
 | 
			
		||||
esac
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue