Message ID | 20191213111146.1492-1-freifunk@adrianschmutzler.de |
---|---|
State | Accepted |
Delegated to: | Adrian Schmutzler |
Headers | show |
Series | [OpenWrt-Devel,RFT,v2] mediatek: split base-files into subtargets | expand |
On 13/12/2019 12:11, Adrian Schmutzler wrote: > This splits some base-files across subtargets, as done previously > on ath79 and ramips and also introduced for mt7629 subtarget here > already. > > 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> I'll be doing some cleanups to the target next week and will look at the plaform_check issue > > --- > > Changes in v2: > - rebase > > Note that the "left-over" platform_check_image for mt7622 looks odd. > I kept the original logic for now. > --- > .../mt7622/base-files/etc/board.d/02_network | 29 ++++++++++++++ > .../mt7622/base-files/lib/upgrade/platform.sh | 25 ++++++++++++ > .../base-files/etc/board.d/02_network | 8 ++-- > .../base-files/lib/preinit/07_set_iface_mac | 2 +- > .../base-files/lib/preinit/79_move_config | 0 > .../base-files/lib/upgrade/platform.sh | 38 +++++++++---------- > 6 files changed, 78 insertions(+), 24 deletions(-) > create mode 100755 target/linux/mediatek/mt7622/base-files/etc/board.d/02_network > create mode 100755 target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh > rename target/linux/mediatek/{ => mt7623}/base-files/etc/board.d/02_network (85%) > rename target/linux/mediatek/{ => mt7623}/base-files/lib/preinit/07_set_iface_mac (97%) > rename target/linux/mediatek/{ => mt7623}/base-files/lib/preinit/79_move_config (100%) > rename target/linux/mediatek/{ => mt7623}/base-files/lib/upgrade/platform.sh (50%) > > diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network > new file mode 100755 > index 0000000000..d719a35dec > --- /dev/null > +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network > @@ -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 > diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh > new file mode 100755 > index 0000000000..396c814ab7 > --- /dev/null > +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh > @@ -0,0 +1,25 @@ > +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 > +} > diff --git a/target/linux/mediatek/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network > similarity index 85% > rename from target/linux/mediatek/base-files/etc/board.d/02_network > rename to target/linux/mediatek/mt7623/base-files/etc/board.d/02_network > index faa2434241..3b71ffe3aa 100755 > --- a/target/linux/mediatek/base-files/etc/board.d/02_network > +++ b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network > @@ -9,12 +9,12 @@ mediatek_setup_interfaces() > local board="$1" > > case $board in > - 'mediatek,mt7623a-rfb-emmc') > + mediatek,mt7623a-rfb-emmc) > ucidef_set_interface_lan "lan0 lan1 lan2 lan3" > ucidef_set_interface_wan eth1 > ;; > - 'bananapi,bpi-r2'|\ > - "unielec,u7623"*) > + bananapi,bpi-r2|\ > + unielec,u7623-02-emmc-512m) > ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" > ;; > esac > @@ -25,7 +25,7 @@ mediatek_setup_macs() > local board="$1" > > case $board in > - "unielec,u7623"*) > + unielec,u7623-02-emmc-512m) > mac=$(cat /sys/class/net/wan/address) > ucidef_set_interface_macaddr "wan" $mac > ;; > diff --git a/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac > similarity index 97% > rename from target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac > rename to target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac > index 3d04000738..7a73a2d84d 100644 > --- a/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac > +++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac > @@ -10,7 +10,7 @@ preinit_set_mac_address() { > . /lib/functions/system.sh > > case $(board_name) in > - "unielec,u7623"*) > + unielec,u7623-02-emmc-512m) > if [ -b $RECOVERY_PART ]; then > insmod nls_cp437 > insmod nls_iso8859-1 > diff --git a/target/linux/mediatek/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config > similarity index 100% > rename from target/linux/mediatek/base-files/lib/preinit/79_move_config > rename to target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config > diff --git a/target/linux/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh > similarity index 50% > rename from target/linux/mediatek/base-files/lib/upgrade/platform.sh > rename to target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh > index 9c99ee1c18..39dcb8e831 100755 > --- a/target/linux/mediatek/base-files/lib/upgrade/platform.sh > +++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh > @@ -1,7 +1,7 @@ > -platform_do_upgrade() { > +platform_do_upgrade() { > local board=$(board_name) > case "$board" in > - "unielec,u7623"*) > + unielec,u7623-02-emmc-512m) > #Keep the persisten random mac address (if it exists) > mkdir -p /tmp/recovery > mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery > @@ -26,29 +26,29 @@ platform_do_upgrade() { > > PART_NAME=firmware > > -platform_check_image() { > - local board=$(board_name) > - local magic="$(get_magic_long "$1")" > +platform_check_image() { > + local board=$(board_name) > + local magic="$(get_magic_long "$1")" > > - [ "$#" -gt 1 ] && return 1 > + [ "$#" -gt 1 ] && return 1 > > - case "$board" in > + case "$board" in > bananapi,bpi-r2|\ > - "unielec,u7623"*) > - [ "$magic" != "27051956" ] && { > + unielec,u7623-02-emmc-512m) > + [ "$magic" != "27051956" ] && { > echo "Invalid image type." > - return 1 > - } > - return 0 > - ;; > + return 1 > + } > + return 0 > + ;; > > - *) > + *) > echo "Sysupgrade is not supported on your board yet." > - return 1 > - ;; > - esac > + return 1 > + ;; > + esac > > - return 0 > + return 0 > } > > platform_copy_config_emmc() { > @@ -61,7 +61,7 @@ platform_copy_config_emmc() { > > platform_copy_config() { > case "$(board_name)" in > - "unielec,u7623"*) > + unielec,u7623-02-emmc-512m) > platform_copy_config_emmc > ;; > esac >
Hi John, > -----Original Message----- > From: John Crispin [mailto:john@phrozen.org] > Sent: Freitag, 13. Dezember 2019 14:07 > To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; openwrt- > devel@lists.openwrt.org > Subject: Re: [OpenWrt-Devel] [RFT PATCH v2] mediatek: split base-files into > subtargets > > On 13/12/2019 12:11, Adrian Schmutzler wrote: > > This splits some base-files across subtargets, as done previously > > on ath79 and ramips and also introduced for mt7629 subtarget here > > already. > > > > 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> > I'll be doing some cleanups to the target next week and will look at the > plaform_check issue Sounds to me like it will be easiest if you push this patch together with the others then? Best Adrian
diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..d719a35dec --- /dev/null +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -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 diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..396c814ab7 --- /dev/null +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -0,0 +1,25 @@ +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 +} diff --git a/target/linux/mediatek/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network similarity index 85% rename from target/linux/mediatek/base-files/etc/board.d/02_network rename to target/linux/mediatek/mt7623/base-files/etc/board.d/02_network index faa2434241..3b71ffe3aa 100755 --- a/target/linux/mediatek/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network @@ -9,12 +9,12 @@ mediatek_setup_interfaces() local board="$1" case $board in - 'mediatek,mt7623a-rfb-emmc') + mediatek,mt7623a-rfb-emmc) ucidef_set_interface_lan "lan0 lan1 lan2 lan3" ucidef_set_interface_wan eth1 ;; - 'bananapi,bpi-r2'|\ - "unielec,u7623"*) + bananapi,bpi-r2|\ + unielec,u7623-02-emmc-512m) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" ;; esac @@ -25,7 +25,7 @@ mediatek_setup_macs() local board="$1" case $board in - "unielec,u7623"*) + unielec,u7623-02-emmc-512m) mac=$(cat /sys/class/net/wan/address) ucidef_set_interface_macaddr "wan" $mac ;; diff --git a/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac similarity index 97% rename from target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac rename to target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac index 3d04000738..7a73a2d84d 100644 --- a/target/linux/mediatek/base-files/lib/preinit/07_set_iface_mac +++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac @@ -10,7 +10,7 @@ preinit_set_mac_address() { . /lib/functions/system.sh case $(board_name) in - "unielec,u7623"*) + unielec,u7623-02-emmc-512m) if [ -b $RECOVERY_PART ]; then insmod nls_cp437 insmod nls_iso8859-1 diff --git a/target/linux/mediatek/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config similarity index 100% rename from target/linux/mediatek/base-files/lib/preinit/79_move_config rename to target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config diff --git a/target/linux/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh similarity index 50% rename from target/linux/mediatek/base-files/lib/upgrade/platform.sh rename to target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh index 9c99ee1c18..39dcb8e831 100755 --- a/target/linux/mediatek/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh @@ -1,7 +1,7 @@ -platform_do_upgrade() { +platform_do_upgrade() { local board=$(board_name) case "$board" in - "unielec,u7623"*) + unielec,u7623-02-emmc-512m) #Keep the persisten random mac address (if it exists) mkdir -p /tmp/recovery mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery @@ -26,29 +26,29 @@ platform_do_upgrade() { PART_NAME=firmware -platform_check_image() { - local board=$(board_name) - local magic="$(get_magic_long "$1")" +platform_check_image() { + local board=$(board_name) + local magic="$(get_magic_long "$1")" - [ "$#" -gt 1 ] && return 1 + [ "$#" -gt 1 ] && return 1 - case "$board" in + case "$board" in bananapi,bpi-r2|\ - "unielec,u7623"*) - [ "$magic" != "27051956" ] && { + unielec,u7623-02-emmc-512m) + [ "$magic" != "27051956" ] && { echo "Invalid image type." - return 1 - } - return 0 - ;; + return 1 + } + return 0 + ;; - *) + *) echo "Sysupgrade is not supported on your board yet." - return 1 - ;; - esac + return 1 + ;; + esac - return 0 + return 0 } platform_copy_config_emmc() { @@ -61,7 +61,7 @@ platform_copy_config_emmc() { platform_copy_config() { case "$(board_name)" in - "unielec,u7623"*) + unielec,u7623-02-emmc-512m) platform_copy_config_emmc ;; esac
This splits some base-files across subtargets, as done previously on ath79 and ramips and also introduced for mt7629 subtarget here already. 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> --- Changes in v2: - rebase Note that the "left-over" platform_check_image for mt7622 looks odd. I kept the original logic for now. --- .../mt7622/base-files/etc/board.d/02_network | 29 ++++++++++++++ .../mt7622/base-files/lib/upgrade/platform.sh | 25 ++++++++++++ .../base-files/etc/board.d/02_network | 8 ++-- .../base-files/lib/preinit/07_set_iface_mac | 2 +- .../base-files/lib/preinit/79_move_config | 0 .../base-files/lib/upgrade/platform.sh | 38 +++++++++---------- 6 files changed, 78 insertions(+), 24 deletions(-) create mode 100755 target/linux/mediatek/mt7622/base-files/etc/board.d/02_network create mode 100755 target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh rename target/linux/mediatek/{ => mt7623}/base-files/etc/board.d/02_network (85%) rename target/linux/mediatek/{ => mt7623}/base-files/lib/preinit/07_set_iface_mac (97%) rename target/linux/mediatek/{ => mt7623}/base-files/lib/preinit/79_move_config (100%) rename target/linux/mediatek/{ => mt7623}/base-files/lib/upgrade/platform.sh (50%)