mediatek: split base-files into subtargets
This splits some base-files across subtargets, as done previously on ath79 and ramips and also introduced for mt7629 subtarget here already. Most of the existing base-files content is specific to mt7623. While at it, apply the following fixes: - Remove lots of trailing whitespaces - Remove wildcard on unielec,u7623-02-emmc-512m - Remove inconsistent quotation marks in cases Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: John Crispin <john@phrozen.org>
This commit is contained in:
		
							
								
								
									
										29
									
								
								target/linux/mediatek/mt7622/base-files/etc/board.d/02_network
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								target/linux/mediatek/mt7622/base-files/etc/board.d/02_network
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | . /lib/functions.sh | ||||||
|  | . /lib/functions/uci-defaults.sh | ||||||
|  | . /lib/functions/system.sh | ||||||
|  |  | ||||||
|  | mediatek_setup_interfaces() | ||||||
|  | { | ||||||
|  | 	local board="$1" | ||||||
|  |  | ||||||
|  | 	case $board in | ||||||
|  | 	esac | ||||||
|  | } | ||||||
|  |  | ||||||
|  | mediatek_setup_macs() | ||||||
|  | { | ||||||
|  | 	local board="$1" | ||||||
|  |  | ||||||
|  | 	case $board in | ||||||
|  | 	esac | ||||||
|  | } | ||||||
|  |  | ||||||
|  | board_config_update | ||||||
|  | board=$(board_name) | ||||||
|  | mediatek_setup_interfaces $board | ||||||
|  | mediatek_setup_macs $board | ||||||
|  | board_config_flush | ||||||
|  |  | ||||||
|  | exit 0 | ||||||
							
								
								
									
										26
									
								
								target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | platform_do_upgrade() { | ||||||
|  | 	local board=$(board_name) | ||||||
|  |  | ||||||
|  | 	case "$board" in | ||||||
|  | 	*) | ||||||
|  | 		default_do_upgrade "$1" | ||||||
|  | 		;; | ||||||
|  | 	esac | ||||||
|  | } | ||||||
|  |  | ||||||
|  | PART_NAME=firmware | ||||||
|  |  | ||||||
|  | platform_check_image() { | ||||||
|  | 	local board=$(board_name) | ||||||
|  |  | ||||||
|  | 	[ "$#" -gt 1 ] && return 1 | ||||||
|  |  | ||||||
|  | 	case "$board" in | ||||||
|  | 	*) | ||||||
|  | 		echo "Sysupgrade is not supported on your board yet." | ||||||
|  | 		return 1 | ||||||
|  | 		;; | ||||||
|  | 	esac | ||||||
|  |  | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
| @@ -9,12 +9,12 @@ mediatek_setup_interfaces() | |||||||
| 	local board="$1" | 	local board="$1" | ||||||
| 
 | 
 | ||||||
| 	case $board in | 	case $board in | ||||||
| 	'mediatek,mt7623a-rfb-emmc') | 	mediatek,mt7623a-rfb-emmc) | ||||||
| 		ucidef_set_interface_lan "lan0 lan1 lan2 lan3" | 		ucidef_set_interface_lan "lan0 lan1 lan2 lan3" | ||||||
| 		ucidef_set_interface_wan eth1 | 		ucidef_set_interface_wan eth1 | ||||||
| 		;; | 		;; | ||||||
| 	'bananapi,bpi-r2'|\ | 	bananapi,bpi-r2|\ | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" | 		ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" | ||||||
| 		;; | 		;; | ||||||
| 	esac | 	esac | ||||||
| @@ -25,9 +25,8 @@ mediatek_setup_macs() | |||||||
| 	local board="$1" | 	local board="$1" | ||||||
| 
 | 
 | ||||||
| 	case $board in | 	case $board in | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		mac=$(cat /sys/class/net/wan/address) | 		ucidef_set_interface_macaddr "wan" "$(cat /sys/class/net/wan/address)" | ||||||
| 		ucidef_set_interface_macaddr "wan" $mac |  | ||||||
| 		;; | 		;; | ||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
| @@ -10,7 +10,7 @@ preinit_set_mac_address() { | |||||||
| 	. /lib/functions/system.sh | 	. /lib/functions/system.sh | ||||||
| 
 | 
 | ||||||
| 	case $(board_name) in | 	case $(board_name) in | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		if [ -b $RECOVERY_PART ]; then | 		if [ -b $RECOVERY_PART ]; then | ||||||
| 			insmod nls_cp437 | 			insmod nls_cp437 | ||||||
| 			insmod nls_iso8859-1 | 			insmod nls_iso8859-1 | ||||||
| @@ -1,7 +1,8 @@ | |||||||
| platform_do_upgrade() {                  | platform_do_upgrade() { | ||||||
| 	local board=$(board_name) | 	local board=$(board_name) | ||||||
|  | 
 | ||||||
| 	case "$board" in | 	case "$board" in | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		#Keep the persisten random mac address (if it exists) | 		#Keep the persisten random mac address (if it exists) | ||||||
| 		mkdir -p /tmp/recovery | 		mkdir -p /tmp/recovery | ||||||
| 		mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery | 		mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery | ||||||
| @@ -26,29 +27,28 @@ platform_do_upgrade() { | |||||||
| 
 | 
 | ||||||
| PART_NAME=firmware | PART_NAME=firmware | ||||||
| 
 | 
 | ||||||
| platform_check_image() {                                                          | platform_check_image() { | ||||||
| 	local board=$(board_name)                                                 | 	local board=$(board_name) | ||||||
| 	local magic="$(get_magic_long "$1")"                                      | 	local magic="$(get_magic_long "$1")" | ||||||
| 
 | 
 | ||||||
| 	[ "$#" -gt 1 ] && return 1                                                | 	[ "$#" -gt 1 ] && return 1 | ||||||
| 
 | 
 | ||||||
| 	case "$board" in                                                        | 	case "$board" in | ||||||
| 	bananapi,bpi-r2|\ | 	bananapi,bpi-r2|\ | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		[ "$magic" != "27051956" ] && {    | 		[ "$magic" != "27051956" ] && { | ||||||
| 			echo "Invalid image type." | 			echo "Invalid image type." | ||||||
| 			return 1                                      | 			return 1 | ||||||
| 		}                                                     | 		} | ||||||
| 		return 0                                              | 		return 0 | ||||||
| 		;;                                                    | 		;; | ||||||
| 
 | 	*) | ||||||
| 	*)                                                            |  | ||||||
| 		echo "Sysupgrade is not supported on your board yet." | 		echo "Sysupgrade is not supported on your board yet." | ||||||
| 		return 1                                              | 		return 1 | ||||||
| 		;;                                 | 		;; | ||||||
| 	esac                                       | 	esac | ||||||
| 
 | 
 | ||||||
| 	return 0                                                                                          | 	return 0 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| platform_copy_config_emmc() { | platform_copy_config_emmc() { | ||||||
| @@ -61,7 +61,7 @@ platform_copy_config_emmc() { | |||||||
| 
 | 
 | ||||||
| platform_copy_config() { | platform_copy_config() { | ||||||
| 	case "$(board_name)" in | 	case "$(board_name)" in | ||||||
| 	"unielec,u7623"*) | 	unielec,u7623-02-emmc-512m) | ||||||
| 		platform_copy_config_emmc | 		platform_copy_config_emmc | ||||||
| 		;; | 		;; | ||||||
| 	esac | 	esac | ||||||
		Reference in New Issue
	
	Block a user
	 Adrian Schmutzler
					Adrian Schmutzler