[PATCH 1/2] octeon: rename erlite to ubnt,erlite

Stijn Segers foss at volatilesystems.org
Fri Jan 8 13:45:59 EST 2021


Hi Roman,

Op vrijdag 8 januari 2021 om 19:31 schreef Roman Kuzmitskii 
<damex.pp at icloud.com>:
> there is no good way to differentiate between devices in runtime if 
> they
>   use the same platform.
> 
> custom dts would be a better solution in case of edgerouter lite since
>   upstream (kernel) already have one for e100 (edgerouter lite).
> 
> could we reuse it?


I have no idea if it's possible, but I was thinking about an additional 
DTS that overrides the 'compatible' property. Haven't yet found if this 
is possible at all though, overriding that value.

Stijn

> 
>> On Jan 8, 2021, at 10:11 PM, Stijn Segers <foss at volatilesystems.org> 
>> wrote:
>> 
>> Hi,
>> 
>> Op vrijdag 8 januari 2021 om 13u29 schreef Adrian Schmutzler 
>> <mail at adrianschmutzler.de>:
>>> Hi,
>>>> -----Original Message-----
>>>> From: openwrt-devel 
>>>> [mailto:openwrt-devel-bounces at lists.openwrt.org]
>>>> On Behalf Of Stijn Segers
>>>> Sent: Freitag, 8. Januar 2021 11:28
>>>> To: openwrt-devel at lists.openwrt.org
>>>> Subject: [PATCH 1/2] octeon: rename erlite to ubnt,erlite
>>>> Prefix EdgeRouter Lite board_name value with vendor abbreviation 
>>>> UBNT, as
>>>> other Ubiquiti devices do, and use full name "Ubiquiti EdgeRouter 
>>>> Lite" as
>>>> model value.
>>> If we touch this, please use ubnt,edgerouter-lite to match the 
>>> devices in other targets.
>> 
>> Will do.
>> 
>>> I always wanted to do this but never did it because I don't have 
>>> the device to test and breaking sysupgrade was not an option for me 
>>> here.
>>> However, with BOARD_NAME in place I'm not sure whether sysupgrade 
>>> would still break if you also add SUPPORTED_DEVICES properly.
>> 
>> I'll add SUPPORTED_DEVICES to the v2 just to be on the safe side.
>> 
>>> Additional comments below.
>>>> Signed-off-by: Stijn Segers <foss at volatilesystems.org>
>>>> ---
>>>>  .../octeon/base-files/lib/preinit/01_sysinfo     | 10 ++++++++--
>>>>  .../octeon/base-files/lib/preinit/79_move_config |  2 +-
>>>>  .../octeon/base-files/lib/upgrade/platform.sh    | 16 
>>>> ++++++++--------
>>>>  3 files changed, 17 insertions(+), 11 deletions(-)
>>>> diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
>>>> b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
>>>> index d66618b0cf..497116b2c7 100644
>>>> --- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
>>>> +++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
>>>> @@ -6,7 +6,8 @@ do_sysinfo_octeon() {
>>>>  	case "$machine" in
>>>>  	"UBNT_E100"*)
>>>> -		name="erlite"
>>>> +		name="ubnt,erlite"
>>>> +		model="Ubiquiti EdgeRouter Lite"
>>>>  		;;
>>>>  	"UBNT_E200"*)
>>>> @@ -34,7 +35,12 @@ do_sysinfo_octeon() {
>>>>  	[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
>>>>  	echo "$name" > /tmp/sysinfo/board_name
>>>> -	echo "$machine" > /tmp/sysinfo/model
>>>> +	if [ -z "$model" ]
>>>> +	then
>>>> +		echo "$machine" > /tmp/sysinfo/model
>>>> +	else
>>>> +		echo "$model" > /tmp/sysinfo/model
>>>> +	fi
>>> What's the purpose of this change? If it just "adds a friendly 
>>> name" it should probably be separate, as the rest is about changing 
>>> the board_name.
>> 
>> I'll split this out into a separate patch. This is cosmetic indeed, 
>> so /tmp/sysinfo/model (and LuCI) don't display the architecture as 
>> 'model'. The EdgeRouter 4 e.g. does not suffer from this because it 
>> uses an external DTS that sets the model value.
>> 
>> I could do the same for the other machine matches, but it looks like 
>> the UBNT_E[0-9][0-9]0 values are crude indicators of what device 
>> OpenWrt is running on...
>> 
>> A quick online search gave this:
>> - UBNT E100: EdgeRouter Lite (ERLite-3), but also EdgeRouter PoE 
>> (ERPoe-5) e.g.
>> - UBNT E200: EdgeRouter (ER-8) & EdgeRouter Pro (ERPro-8)
>> - UBNT E220: UniFi Security Gateway Pro 4 (USG Pro-4), but also 
>> EdgeRouter
>> 
>> So what's the best way to deduplicate this? A custom DTS per device 
>> that overrides upstream board_name and model, but inherits the 
>> remainder of the DTS?
>> 
>> Thanks
>> 
>> Stijn
>> 
>>> Best
>>> Adrian
>>>>  }
>>>>  boot_hook_add preinit_main do_sysinfo_octeon diff --git
>>>> a/target/linux/octeon/base-files/lib/preinit/79_move_config
>>>> b/target/linux/octeon/base-files/lib/preinit/79_move_config
>>>> index 5a84e6f18a..fb917ec39e 100644
>>>> --- a/target/linux/octeon/base-files/lib/preinit/79_move_config
>>>> +++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
>>>> @@ -15,7 +15,7 @@ octeon_move_config() {
>>>>  	. /lib/functions.sh
>>>>  	case "$(board_name)" in
>>>> -		erlite)
>>>> +		ubnt,erlite)
>>>>  			move_config "/dev/sda1"
>>>>  			;;
>>>>  		itus,shield-router)
>>>> diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh
>>>> b/target/linux/octeon/base-files/lib/upgrade/platform.sh
>>>> index ad5baef4a1..5e5f33b719 100755
>>>> --- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
>>>> +++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
>>>> @@ -19,11 +19,6 @@ platform_get_rootfs() {
>>>>  platform_copy_config() {
>>>>  	case "$(board_name)" in
>>>> -	erlite)
>>>> -		mount -t vfat /dev/sda1 /mnt
>>>> -		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
>>>> -		umount /mnt
>>>> -		;;
>>>>  	itus,shield-router)
>>>>  		mount -t vfat /dev/mmcblk1p1 /mnt
>>>>  		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
>>>> @@ -34,6 +29,11 @@ platform_copy_config() {
>>>>  		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
>>>>  		umount /mnt
>>>>  		;;
>>>> +	ubnt,erlite)
>>>> +		mount -t vfat /dev/sda1 /mnt
>>>> +		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
>>>> +		umount /mnt
>>>> +		;;
>>>>  	esac
>>>>  }
>>>> @@ -87,7 +87,7 @@ platform_do_upgrade() {
>>>>  	ubnt,edgerouter-4)
>>>>  		kernel=mmcblk0p1
>>>>  		;;
>>>> -	erlite)
>>>> +	ubnt,erlite)
>>>>  		kernel=sda1
>>>>  		;;
>>>>  	itus,shield-router)
>>>> @@ -112,9 +112,9 @@ platform_check_image() {
>>>>  	case "$board" in
>>>>  	er | \
>>>> -	erlite | \
>>>>  	itus,shield-router | \
>>>> -	ubnt,edgerouter-4)
>>>> +	ubnt,edgerouter-4 | \
>>>> +	ubnt,erlite)
>>>>  		local kernel_length=$(tar xf $tar_file $board_dir/kernel -O |
>>>> wc -c 2> /dev/null)
>>>>  		local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc
>>>> -c 2> /dev/null)
>>>>  		[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
>>>> --
>>>> 2.20.1
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel at lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>> 
>> 
>> 
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 




More information about the openwrt-devel mailing list