What's new

Compiling of cake for gnuton build.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

DJones

Very Senior Member
Hi @RMerlin

I’m trying to understand what indicates which model should cake be built into asuswrt-Merlin/gnuton.

I’ve been looking at why cake didn’t build into gnutons 388.7 release and have an open bug report on his git. As far as I can tell cake is set to be built as a module.


However I’m curious about these profiles. Are they indicative of certain models (and this one was just absent from the profile) or is cake supposed to be built into every model and 388.7 was just a bad build for the newer supported device rt-ax58u v2. I haven’t dived further into the code then this because I’m not certain what I’m looking for.

release/src-rt-5.04axhnd.675x/targets/arch/PURE181.arch

Code:
<PUBLISH>
@@ special demark for maketargets.  All + and - lines after this line will modify profile.
-BUILD_DM_HYBRID=y
-BUILD_DM_LEGACY98=y
+BUILD_DM_PURE181=y
-BUILD_QUICKSETUP=y
+BUILD_QUICKSETUP is not set

IMG_0025.jpeg

IMG_0029.jpeg

IMG_0028.jpeg

IMG_0027.jpeg
 
Last edited:
I’m trying to understand what indicates which model should cake be built into asuswrt-Merlin/gnuton.
Build profiles are all in release/src-rt/target.mak.
 
I see references to BRCM which I assume is Broadcom. But nothing really related to cake as a module unless it umbrellas under something else.

Code:
export RT-AX58U_V2 := $(HND-96756_BASE)
export RT-AX58U_V2 += BUILD_NAME="RT-AX58U_V2" NVSIZE="128" DHDAP=n HND_WL=y DPSTA=n LACP=n WTFAST=n REPEATER=y IPV6SUPP=y HTTPS=y \
         ARM=y AUTODICT=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y MEDIASRV=y MODEM=y USB_WAN_BACKUP=y PARENTAL2=y ACCEL_PPTPD=y PRINTER=y \
        WEBDAV=y SMARTSYNCBASE=y USB="USB" APP="network" PROXYSTA=y DNSMQ=y SHP=n BCMWL6=y BCMWL6A=y DISK_MONITOR=y BTN_WIFITOG=n \
        OPTIMIZE_XBOX=y ODMPID=y LED_BTN=n BCMSMP=y XHCI=y DUALWAN=y NEW_USER_LOW_RSSI=y OPENVPN=y TIMEMACHINE=y MDNS=y VPNC=y \
        JFFS2LOG=yNOTIFICATION_CENTER=y BWDPI=y DUMP_OOPS_MSG=n LINUX_MTD="64" DEBUGFS=y TEMPROOTFS=n SSH=y EMAIL=y FRS_FEEDBACK=y \
        SYSSTATE=y ROG=n STAINFO=y CLOUDCHECK=y NATNL_AICLOUD=y REBOOT_SCHEDULE=y MULTICASTIPTV=y QUAGGA=y WLCLMLOAD=n BCM_MUMIMO=y \
        LAN50="all" ATCOVER=y GETREALIP=y CFEZ=y TFAT=y NTFS="tuxera" HFS="tuxera" NEWSSID_REV2=y NEWSSID_REV4=y NEW_APP_ARM=y \
        VISUALIZATION=n BONDING=n BONDING_WAN=n NETOOL=y TRACEROUTE=y FORCE_AUTO_UPGRADE=y ALEXA=y IFTTT=y SW_HW_AUTH=y HD_SPINDOWN=y \
        ASPMD=n BCM_MEVENT=n BCMEVENTD=y BCM_APPEVENTD=n LETSENCRYPT=y VPN_FUSION=y JFFS_NVRAM=y NVRAM_ENCRYPT=y IPSEC=STRONGSWAN \
        IPSEC_SRVCLI_ONLY=SRV NATNL_AIHOME=y BCM_CEVENTD=y UTF8_SSID=y AMAS=y DWB=y DBLOG=y ETHOBD=y CFGSYNC_LOCSYNC=y CONNDIAG=y \
        NFCM=n DNSQUERY_INTERCEPT=n CRASHLOG=y WATCH_REINIT=n BW160M=y BRCM_HOSTAPD=y UUPLUGIN=n IPERF3=y FRS_LIVE_UPDATE=y ASUSCTRL=y \
        BCN_RPT=y BTM_11V=y INFO_EXAP=y AVBLCHAN=y SW_CTRL_ALLLED=y ASD=y AHS=y INTERNETCTRL=y GAME_MODE=n INSTANT_GUARD=y ACL96=y \
        GOOGLE_ASST=y COMFW=y WIREGUARD=y AMAS_ETHDETECT=y IPV6S46=y OCNVC=y
export RT-AX58U_V2 += TOR=y NTPD=y DNSPRIVACY=y DNSFILTER=y NTPD=y OPENSSL11=y NANO=y FORCE_AUTO_UPGRADE=n FRS_FEEDBACK=n
export RT-AX58U_V2 += UPNPIGD2=n VISUALIZATION=n IFTT=y LACP=n TUF_UI=n VPN_FUSION=n FRS_LIVE_UPDATE=n SNMPD=y
 
under release/src/router/rc/qos.c I’m seeing the same null pointers I was getting so maybe it’s not a case of cake not being installed.



Code:
#ifdef HND_ROUTER

int start_cake(void)
{
    unsigned int ibw, obw;
    FILE *f;
    char overheadstr[32];
    char ibwstr[32];
    char obwstr[32];
    char *mode;
    char nvnat[16];
    int nat;

    if((f = fopen("/etc/cake-qos.conf", "w")) == NULL) return -2;

    switch (nvram_get_int("qos_atm")) {
        case 0:
            mode = "";
            break;
        case 1:
            mode = "atm";
            break;
        case 2:
            mode = "ptm";
            break;
        default:
            mode = "";
    }

    ibw = strtoul(nvram_safe_get("qos_ibw"), NULL, 10);
    obw = strtoul(nvram_safe_get("qos_obw"), NULL, 10);

    if (ibw == 0)
        *ibwstr = '\0';
    else
        snprintf(ibwstr, sizeof(ibwstr), "bandwidth %dkbit", ibw);

    if (obw == 0)
        *obwstr = '\0';
    else
        snprintf(obwstr, sizeof(obwstr), "bandwidth %dkbit", obw);

    snprintf(overheadstr, sizeof(overheadstr), "overhead %d mpu %d", nvram_get_int("qos_overhead"), nvram_get_int("qos_mpu"));

    const char *wan_ifname = get_wan_ifname(wan_primary_ifunit());

    snprintf(nvnat, sizeof (nvnat), "wan%d_nat_x", wan_primary_ifunit());
    nat = nvram_get_int(nvnat);

    /* Config parameters */
    fprintf(f,
        "#!/bin/sh\n\n"
        "ULIF='%s'\n"
        "DLIF='%s'\n"
        "MIF='ifb4%s'\n"
        "ULBW='%s'\n"
        "DLBW='%s'\n"
        "OVERHEAD='%s'\n"
        "FRAMING='%s'\n"
        "ULPRIOQUEUE='diffserv3'\n"
        "DLPRIOQUEUE='besteffort'\n"
        "ULOPTIONS='%s dual-srchost'\n"
        "DLOPTIONS='%s wash dual-dsthost ingress'\n",

        wan_ifname,
        wan_ifname,
        wan_ifname,
        obwstr,
        ibwstr,
        overheadstr,
        mode,
        (nat ? "nat" : ""),
        (nat ? "nat" : "")
    );

    append_custom_config("cake-qos.conf",f);
    fclose(f);


    if((f = fopen(qosfn, "w")) == NULL) return -2;

    /* Stop/start rules */
    fprintf(f,
        "#!/bin/sh\n"
        "source /etc/cake-qos.conf\n\n"

        "case \"$1\" in\n"
        "start)\n"
        "# Upload\n"
        "\ttc qdisc add dev $ULIF root cake $ULPRIOQUEUE $ULBW $OVERHEAD $FRAMING $ULOPTIONS 2>/dev/null\n\n"

        "# Download\n"
        "\tip link add name $MIF type ifb 2>/dev/null\n"
        "\ttc qdisc add dev $DLIF handle ffff: ingress 2>/dev/null\n"
        "\ttc qdisc add dev $MIF root cake $DLPRIOQUEUE $DLBW $OVERHEAD $FRAMING $DLOPTIONS 2>/dev/null\n"
        "\tip link set $MIF up 2>/dev/null\n"
        "\ttc filter add dev $DLIF parent ffff: prio 10 matchall action mirred egress redirect dev $MIF 2>/dev/null\n\n"

        "\t;;\n"
        "stop)\n"
        "\ttc qdisc del dev $ULIF root 2>/dev/null\n"
        "\ttc qdisc del dev $DLIF ingress 2>/dev/null\n"
        "\ttc qdisc del dev $MIF root 2>/dev/null\n"
        "\tip link set $MIF down 2>/dev/null\n"
        "\tip link del dev $MIF 2>/dev/null\n"
        "\t;;\n"
        "*)\n"
        "esac\n");

    fclose(f);
    chmod("/etc/cake-qos.conf", 0755);
    chmod(qosfn, 0755);
    run_custom_script("qos-start", 120, "init", NULL);
    eval((char *)qosfn, "start");

    return 0;
}
#endif
Code:
@RT-AX58U-B260:/tmp/home/root# cat /tmp/qos
#!/bin/sh
source /etc/cake-qos.conf

case "$1" in
start)
# Upload
        tc qdisc add dev $ULIF root cake $ULPRIOQUEUE $ULBW $OVERHEAD $FRAMING $ULOPTIONS 2>/dev/null

# Download
        ip link add name $MIF type ifb 2>/dev/null
        tc qdisc add dev $DLIF handle ffff: ingress 2>/dev/null
        tc qdisc add dev $MIF root cake $DLPRIOQUEUE $DLBW $OVERHEAD $FRAMING $DLOPTIONS 2>/dev/null
        ip link set $MIF up 2>/dev/null
        tc filter add dev $DLIF parent ffff: prio 10 matchall action mirred egress redirect dev $MIF 2>/dev/null

        ;;
stop)
        tc qdisc del dev $ULIF root 2>/dev/null
        tc qdisc del dev $DLIF ingress 2>/dev/null
        tc qdisc del dev $MIF root 2>/dev/null
        ip link set $MIF down 2>/dev/null
        ip link del dev $MIF 2>/dev/null
        ;;
*)
esac
 
Last edited:
Something seems wrong with tc qdisc and I’m going to chalk it up to my initial concerns that hw acceleration runner would not turn off in 388.7.. will test 388.8 on gnuton tomorrow.

Code:
@RT-AX58U-B260:/tmp/home/root# tc qdisc
qdisc noqueue 0: dev lo root refcnt 2
qdisc noqueue 0: dev archer root refcnt 2
qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc ingress ffff: dev eth0 parent ffff:fff1 ----------------
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev spu_us_dummy root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev spu_ds_dummy root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth3 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc noqueue 0: dev br0 root refcnt 2
qdisc noqueue 0: dev wgs1 root refcnt 2
qdisc pfifo_fast 0: dev ifb4eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

@RT-AX58U-B260:/tmp/home/root# tc qdisc add dev eth0 root cake diffserv3 bandwidth 2355kbit overhead 18 mpu 64 atm nat dual-srchost
RTNETLINK answers: No such file or directory
 
I see references to BRCM which I assume is Broadcom. But nothing really related to cake as a module unless it umbrellas under something else.
I think I simply enable it in the kernel config for every HND platform rather than enable it on a model basis.

You should check the content of /proc/config.gz on the router to determine if CAKE is enabled or not in that kernel.

You are talking about Gnuton and RT-AX58U, so I take it you mean RT-AX58U V2. I don't know if that device uses the same CPU as the V1, if not then its kernel config file will need the Asuswrt-Merlin specific kernel options applied. Check the config files within kernel/linux-4.1/ that's specific to that model's CPU, and make sure it has the same changes as those I applied to config_base.6a.6750 for the V1 version of that router. See the commit log for that file to track down all the changes I've done over the original config file.
 
I think I simply enable it in the kernel config for every HND platform rather than enable it on a model basis.

You should check the content of /proc/config.gz on the router to determine if CAKE is enabled or not in that kernel.

You are talking about Gnuton and RT-AX58U, so I take it you mean RT-AX58U V2. I don't know if that device uses the same CPU as the V1, if not then its kernel config file will need the Asuswrt-Merlin specific kernel options applied. Check the config files within kernel/linux-4.1/ that's specific to that model's CPU, and make sure it has the same changes as those I applied to config_base.6a.6750 for the V1 version of that router. See the commit log for that file to track down all the changes I've done over the original config file.

I’ll give /proc/config.gz a look when I have some free time later today. But the rt-ax58u v2 uses a BCM6756 a 4 core compared to the v1 which is a 3 core cpu BCM6750. So it’s possible that the configuration may need to be changed.


 
Last edited:
Here’s the diff of both config_base.6a.67XX files what jumps out particularly is codel is not set on v2.

Code:
# CONFIG_NET_SCH_CODEL is not set

https://www.diffchecker.com/eyFX3IJn/
 
Last edited:
I just checked /proc/config.gz but it isn't in human readable format. edit: ahh it's compressed


Code:
# CONFIG_NET_SCH_CAKE is not set

which is true at the time of checking. I'm not sure if that changes automatically at build of the firmware or on the fly.

Edit2: it's not set. That answers that I guess.

Edit3: Also not set in his beta of 388.8
 
Last edited:
Yet to test the build, but Fixed 875b94d

Thank you @RMerlin for pointing me in the right direction.
 
Last edited:
For my own sanity is their anything that would prevent Hw acceleration archer/runner from being turned off even if
Code:
nvram set runner_disable_force=1
nvram commit

even tried

Code:
nvram set archer_disable_force=1
nvram commit

The one glaring problem to me has been archer won't turn off, even if cake is enabled. Cake should turn it off automatically I assume. Now I've looked through the code, but I can't see anything apparent.

Screenshot 2024-07-16 055936.png


This is a error I did get in system logs.
 
Last edited:
might need to add RTCONFIG_HND_ROUTER_AX_6756 to these ifs.

asuswrt-merlin.ng/release/src/router/rc/sysdeps/init-broadcom.c
Lines 12156 to 12166 in 875b94d
#if defined(RTCONFIG_HND_ROUTER_AX_675X)
/* apply archer instead of runner */
eval("fc", "config", "--hw-accel", "0");
#else
eval("runner", "disable");
#endif
else if (!bootup)
#if defined(RTCONFIG_HND_ROUTER_AX_675X)
/* apply archer instead of runner */
eval("fc", "config", "--hw-accel", "1");
eval("archerctl", "sysport_tm", "disable");
As far as I can tell init-broadcom.c is a template file.

release/src-rt-5.04axhnd.675x/router-sysdep.rt-ax58u_v2. Contains archerctl. The actual files might be compiled as a .o object file which is not human readable.

is likely the real location for the init-broadcom

release/src/router/rc/prebuild/RT-AX58U_V2/broadcom.o

Probably contains (or doesn’t) the if s calling on the main archerctl


Anyway to convert .o files back into human readable format? I can look at it as hex/binary, but might as well be Latin.
 
Anyway to convert .o files back into human readable format? I can look at it as hex/binary, but might as well be Latin.
Unless you understand ARM ASM code, there`s nothing for you to look at if you disassembled the code.

Code:
$ arm-linux-objdump -d broadcom.o | more

broadcom.o:     file format elf32-littlearm


Disassembly of section .text.config_eth_port_shaper:

00000000 <config_eth_port_shaper>:
   0:    e92d42f0     push    {r4, r5, r6, r7, r9, lr}
   4:    e24dd068     sub    sp, sp, #104    ; 0x68
   8:    e28d4004     add    r4, sp, #4
   c:    e28d5014     add    r5, sp, #20
  10:    e1a09000     mov    r9, r0
  14:    e1a06001     mov    r6, r1
  18:    e3a02010     mov    r2, #16
  1c:    e3a01000     mov    r1, #0
  20:    e1a00004     mov    r0, r4
  24:    e28d7024     add    r7, sp, #36    ; 0x24
  28:    ebfffffe     bl    0 <memset>
  2c:    e3a02010     mov    r2, #16
  30:    e3a01000     mov    r1, #0
  34:    e1a00005     mov    r0, r5
  38:    ebfffffe     bl    0 <memset>
  3c:    e3a02010     mov    r2, #16
  40:    e3a01000     mov    r1, #0
  44:    e1a00007     mov    r0, r7
  48:    ebfffffe     bl    0 <memset>
 
...

And even if you did, you can't change anything about it either.
 
Holy crap... I can't vouch for the accuracy because I can't be bothered to review it (my ASM coding days are long behind me), but ChatGPT can apparently rewrite ASM code into C Code :D
 
Unless you understand ARM ASM code, there`s nothing for you to look at if you disassembled the code.

Code:
$ arm-linux-objdump -d broadcom.o | more

broadcom.o:     file format elf32-littlearm


Disassembly of section .text.config_eth_port_shaper:

00000000 <config_eth_port_shaper>:
   0:    e92d42f0     push    {r4, r5, r6, r7, r9, lr}
   4:    e24dd068     sub    sp, sp, #104    ; 0x68
   8:    e28d4004     add    r4, sp, #4
   c:    e28d5014     add    r5, sp, #20
  10:    e1a09000     mov    r9, r0
  14:    e1a06001     mov    r6, r1
  18:    e3a02010     mov    r2, #16
  1c:    e3a01000     mov    r1, #0
  20:    e1a00004     mov    r0, r4
  24:    e28d7024     add    r7, sp, #36    ; 0x24
  28:    ebfffffe     bl    0 <memset>
  2c:    e3a02010     mov    r2, #16
  30:    e3a01000     mov    r1, #0
  34:    e1a00005     mov    r0, r5
  38:    ebfffffe     bl    0 <memset>
  3c:    e3a02010     mov    r2, #16
  40:    e3a01000     mov    r1, #0
  44:    e1a00007     mov    r0, r7
  48:    ebfffffe     bl    0 <memset>
 
...

And even if you did, you can't change anything about it either.

Fair enough. Thanks for the input. I’m hardly the expert on any of this; I can work my way through code well enough to try and understand maybe something is missing and differentiate the code between versions. But just aimlessly searching since I haven’t worked on this like you or gnuton have to know where things might be.

Anyways going to let gnuton do his thing, too many cooks so to speak.
 
Last edited:
You are still missing kernel config options(link), your diff is comparing the wrong files.
The ax58u v1 builds from "release/src-rt-5.02axhnd.675x"
The ax58u v2 builds from "release/src-rt-5.04axhnd.675x"

Good catch!
 
You are still missing kernel config options(link), your diff is comparing the wrong files.
The ax58u v1 builds from "release/src-rt-5.02axhnd.675x"
The ax58u v2 builds from "release/src-rt-5.04axhnd.675x"

Yeah I’m getting mixed up jumping between rmerlins repositories and gnutons my intent was to differentiate between v1 and v2 but of different hardware revisions. 5.04 of rmerlin of cpu 6750(v1) and gnuton 6756(v2)


Edit: the more I look the more confused I get shouldn’t look at this on my phone. Gnuton has builds for 5.02 and 5.04 for the rt-ax58u v2 which is likely why I did the diff that way, but rmerl only has 5.02 of the rt-ax58u v1
 
Last edited:
To compare only the 5.04 builds you would need to diff "config_base.6a.4912" vs "config_base.6a.6756"(rt-ax58u v2) as rmerlin only builds 5.04 for routers using "config_base.6a.4912" so the other "config_base.6a.*" lack rmerlin's config options.

Thanks, I’ve relayed this information to the bug report. Appreciate the better eyes on this. Lol
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top