Divested-WRT: No-nonsense hardened builds for Linksys WRT series

Courtesy of @anomeome :

This looks great. I've not had to install a package from source before. Are there instructions around somewhere? My googling is failing me.

There was a change to master quite a while back which I fixed up locally but never got around pushing to my repo, so:

/etc/init.d/fan_control
#!/bin/sh /etc/rc.common
# Copyright (C) 2016-2017 LEDE-Project.org

START=65
STOP=80
USE_PROCD=1
#PROCD_DEBUG=1

boot() {
. /lib/functions.sh

board=$(board_name)

case "$board" in
linksys,wrt1900ac-v1)
    rc_procd start_service
    ;;
esac
}

start_service() {
    procd_open_instance
    procd_set_param command /usr/sbin/fan_monitor -b -a
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}

and

/usr/sbin/fan_monitor
#!/bin/sh

# put in /usr/sbin/fan_monitor
# fan_monitor
# Utility script to monitor temperatures and run fan at 50%/75%/100%
# For Reference the original Belkin specs.

INTERVAL=20  # sleep time in seconds between temp check
FANLOW=127   # low fan speed, set to 0 for off
FANMID=191   # mid fan speed
FANHI=255    # high fan speed

# Set fan to 100% on >= these temperatures
#CPU_HI=80000    # Belkin default is 85
#DDR_HI=58000    # Belkin default is 65
#WIFI_HI=75000   # Belkin default is 105

# Set fan to 75% <= these, otherwise 100% 
CPU_MID=80000     # Belkin sets no default
DDR_MID=58000     # Belkin sets no default
WIFI_MID=75000    # Belkin sets no default

# Set fan to 50% <= these temperatures
CPU_LOW=72000     # Belkin default is 80
DDR_LOW=52000     # Belkin default is 60
WIFI_LOW=55000    # Belkin default is 100

cur_pwm=0
new_pwm="$FANHI"  # start fan at HI while coming up

fan_set() {
    local ppwm
    cur_pwm=$1

    if [ "$1" -eq $FANLOW ]; then
        ppwm="50%"
    elif [ "$1" -eq $FANMID ]; then
        ppwm="75%"
    else
        ppwm="100%"
    fi

    logger -t FAN_MONITOR "Setting Fan to $ppwm"
    echo "$1" > /sys/devices/platform/pwm_fan/hwmon/hwmon0/pwm1
}

# Crank fan on exit
trap "{ logger -t FAN_MONITOR Fan monitor exiting; fan_set $FANHI; logger -t FAN_MONITOR as a precaution; exit; }" SIGINT SIGTERM

# Main fan control loop
while :
do
    if [ "$new_pwm" -ne "$cur_pwm" ]
    then
        fan_set "$new_pwm"
    fi
    sleep $INTERVAL

    cpu=`cat /sys/class/hwmon/hwmon2/temp1_input`
    ddr=`cat /sys/class/hwmon/hwmon1/temp1_input`
    wifi=`cat /sys/class/hwmon/hwmon1/temp2_input`

    if [ "$cpu" -le $CPU_LOW -a "$ddr" -le $DDR_LOW -a "$wifi" -le $WIFI_LOW ]
    then
        new_pwm="$FANLOW"
    elif [ "$cpu" -le $CPU_MID -a "$ddr" -le $DDR_MID -a "$wifi" -le $WIFI_MID ]
    then
        new_pwm="$FANMID"
    else
        new_pwm="$FANHI"
    fi
done

check file attributes, comment out the current fan control (/etc/rc./local), enable and start

/etc/init.d/fan_control enable
/etc/init.d/fan_control start

will push that to my repo real soon now, unless sloth gets the better of me.

3 Likes

Excellent! That quieted things down nicely! Thanks a lot.

Just checked in on that thread today and saw the great news! (haven't flashed it yet but hoping it's finally fixed fingers crossed)

+1 for integrating the fix into the divested builds

1 Like

@slh has an excellent response on why that isn't a good idea.

1 Like

Looks like this is the only known option for 3200ACM/32X users at the moment to upgrade to 21.02 without connectivity issues, since functionality is broken past 19.07 builds where maintenance has stopped completely; kind of stuck between a rock and a hard place unfortunately. While not ideal, not sure what other options we have for these two devices other than ditch them for something newer (kind of leaning towards that since mwlwifi is abandoned but want to squeeze some more use out of it) or stick with the old builds indefinitely.

1 Like

Was it 19.02 or 19.07?

yup 19.07, typo

Dear Divested-WRT people, where can I find the patch to enble multi CPU on DSA? Thanks!

FWIW. Not yet ready for prime time?

Ok, it was just to try

I am only getting about 350-400Mb on my WAN port. Any ideas? My asymetric internetspeed is around 750-800Mb.

Linksys WRT1900ACS with latest version - SNAPSHOT r18088+9-9bd9e04b6f
Nothing much default settings and application enabled.
Enables:

  • Cake
  • Enabled irqbalance

@steinmb
What are your speeds with cake off?

Thank you for getting back to me:

Without Cake my download speed went up to 460-610Mbit. Testet multiple times with speedtest-cli from both my Macbook Pro and Raspberry pi 4. Result are about identical.

Example:

Testing download speed................................................................................
Download: 446.86 Mbit/s
Testing upload speed................................................................................................
Upload: 16.11 Mbit/s

Perhaps this is as expected?

Rather than port things meant for a different architecture, I am in touch with mvneta and mv86xxx drivers maintainers to enable balancing the load across both cpu cores but their time is understandably limited.

nitroshift

2 Likes

If everyone would like to test upcoming lts with vanilla openwrt - to see any regression or bugs.

The easy way - Ansuel's PR #4748, or here.

Additional patch - package/kernel/mwlwifi/patches/002-mwlwifi-pcie-fix.patch

--- mwlwifi-2020-02-06-a2fd00bb.orig/hif/pcie/pcie.c
+++ mwlwifi-2020-02-06-a2fd00bb/hif/pcie/pcie.c
@@ -1292,10 +1292,14 @@
        const char filename[] = "/tmp/BF_MIMO_Ctrl_Field_Output.txt";
        char str_buf[256];
        char *buf = &str_buf[0];
+#ifdef set_fs
        mm_segment_t oldfs;
+#endif

+#ifdef set_fs
        oldfs = get_fs();
        set_fs(KERNEL_DS);
+#endif

        buf += sprintf(buf, "\nMAC: %pM\n", bf_mimo_ctrl->rec_mac);
        buf += sprintf(buf, "SU_0_MU_1: %d\n", bf_mimo_ctrl->type);
@@ -1315,7 +1319,9 @@
                          filename, (unsigned int)fp_data);
        }

+#ifdef set_fs
        set_fs(oldfs);
+#endif
 }

 static void pcie_process_account(struct ieee80211_hw *hw)
@@ -1641,5 +1647,7 @@
 MODULE_VERSION(PCIE_DRV_VERSION);
 MODULE_AUTHOR("Marvell Semiconductor, Inc.");
 MODULE_LICENSE("GPL v2");
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0))
 MODULE_SUPPORTED_DEVICE(PCIE_DEV_NAME);
+#endif
 MODULE_DEVICE_TABLE(pci, pcie_id_tbl);

Hi there,

There's been good progress on solving (finding a workaround) for the WRT32* Wi-Fi issue in the thread I posted about earlier.

There's now a patch available, that should also work for master.

Can we get this tested/added for Divested as well? I am more than happy to test is needed.

Alternatively, if someone can point me into the direction of how to compile only the patched package for the current version of Divested, I can try that as well.

Edit: Seems we might be seeing the fix upstream soon as well. :ok_hand:

Edit2: Should be pushed to master now.

1 Like

I am thinking of switching to the latest build of Divested for my 3200ACM

Currently, I am running insomnia build with openWRT 19.07.

Just a quick question does Divested support ESATA? I tried David503 builds in the past but I could not get ESATA to work on that for some reason, which warranted me to switch to insomnia, as it is a critical feature for me.

awesome news!