mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-10-31 14:04:26 -04:00 
			
		
		
		
	Mikrotik devices will be found in both generic and nand subtargets. The file mikrotik-caldata.sh, currently used in generic, contains a few lines of code that would need to be duplicated for nand support. Instead of duplicating it, move it to target base-files, as size impact is small and the maintenance gain should outweigh it. This is changed separately to make life easier for the people currently working on Mikrotik NAND support. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
		
			
				
	
	
		
			22 lines
		
	
	
		
			647 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			647 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| # Copyright (C) 2019 Robert Marko <robimarko@gmail.com>
 | |
| # Copyright (C) 2019 Roger Pueyo Centelles <roger.pueyo@guifi.net>
 | |
| #
 | |
| # Helper function to extract MAC addresses and calibration data for MikroTik
 | |
| #
 | |
| 
 | |
| mikrotik_caldata_extract() {
 | |
| 	local part=$1
 | |
| 	local offset=$(($2))
 | |
| 	local count=$(($3))
 | |
| 	local mtd
 | |
| 	local erdfile="/lib/firmware/erd.bin"
 | |
| 
 | |
| 	mtd=$(find_mtd_chardev $part)
 | |
| 	[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
 | |
| 
 | |
| 	rbextract -e $mtd $erdfile
 | |
| 
 | |
| 	dd if=$erdfile of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
 | |
| 		caldata_die "failed to extract calibration data from $mtd"
 | |
| }
 |