Posted: Thu Sep 02, 2021 3:41 Post subject: Which toolchain to use [EA8500]? [SOLVED]
I am wanting to cross compile some kernel modules for the EA8500 on Fedora 33. I really need to use my cell phone for Internet perhaps up to several times per day, on some days. I assumed I needed the toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_musl_eabi, but this is throwing errors. Any idea which toolchain I actually need?
Background story is, my rural electricity is so bad, for the past month anyway, I have had literally 4-6 power outages per day. Main computers, switchers and routers are all on UPSs. My last internet outage yesterday was 21 hours, after a 2 second power outage.
This experience also showed me all the devices that cannot get proper time, due to no internet access. This promoted to me set up an in-house NTP server (not on DD-WRT). Even with a whole house generator, the home automation goes to shit without proper time/clocks. That problem is now fixed.
I need to compile two modules: cdc_ether.ko and rndis_host.ko. I can build them fine, until I insert the (wrong?) toolchain.
Code:
$ make modules -j8
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
CC scripts/mod/devicetable-offsets.s
arm-linux-gcc: error: unrecognized command line option '-mno-sse'; did you mean '-fno-dse'?
arm-linux-gcc: error: unrecognized command line option '-mno-mmx'; did you mean '-gno-vms'?
arm-linux-gcc: error: unrecognized command line option '-mno-sse2'; did you mean '-fno-dse'?
arm-linux-gcc: error: unrecognized command line option '-mno-3dnow'
arm-linux-gcc: error: unrecognized command line option '-m64'
arm-linux-gcc: error: unrecognized command line option '-mno-sse'; did you mean '-fno-dse'?
arm-linux-gcc: error: unrecognized command line option '-mno-mmx'; did you mean '-gno-vms'?
arm-linux-gcc: error: unrecognized command line option '-mno-red-zone'; did you mean '-fno-regmove'?
arm-linux-gcc: error: unrecognized command line option '-mno-sse2'; did you mean '-fno-dse'?
arm-linux-gcc: error: unrecognized command line option '-mno-3dnow'
arm-linux-gcc: error: unrecognized command line option '-m64'
arm-linux-gcc: error: unrecognized command line option '-mno-red-zone'; did you mean '-fno-regmove'?
arm-linux-gcc: error: unrecognized command line option '-mcmodel=kernel'
make[2]: *** [scripts/Makefile.build:308: scripts/mod/empty.o] Error 1
make[2]: *** Waiting for unfinished jobs....
arm-linux-gcc: error: unrecognized command line option '-mcmodel=kernel'
make[2]: *** [scripts/Makefile.build:154: scripts/mod/devicetable-offsets.s] Error 1
make[1]: *** [scripts/Makefile.build:558: scripts/mod] Error 2
make: *** [Makefile:567: scripts] Error 2
I think this is not the correct toolchain. Which one should I be using for this router? Any help would be appreciated. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Forum member #248
Last edited by lexridge on Sat Sep 04, 2021 0:36; edited 1 time in total
Joined: 08 May 2018 Posts: 14242 Location: Texas, USA
Posted: Thu Sep 02, 2021 4:24 Post subject:
it used to be able to be determined via telnet / ssh by issuing a 'strings /lib/libstdc++.so.6 | grep toolchain'; but that file is not present these days, and any available file that might be readable does not give the info anymore. You'd probably have to back-track to a build from 2018... also, gcc version does matter and BS is currently using gcc 11.x. _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
it used to be able to be determined via telnet / ssh by issuing a 'strings /lib/libstdc++.so.6 | grep toolchain'; but that file is not present these days, and any available file that might be readable does not give the info anymore. You'd probably have to back-track to a build from 2018... also, gcc version does matter and BS is currently using gcc 11.x.
Actually, this worked and potentially reveals my problem:
Thanks for the tip! Looks like BS is using gcc v10 and c++v11? Weird.
The toolchain I downloaded from the DD-WRT wiki contains toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_musl_eabi. So this link probably needs to be updated. I will attempt to obtain the correct toolchain from the openwrt site.
Thanks again. Big help! _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Forum member #248
Last edited by lexridge on Thu Sep 02, 2021 11:34; edited 2 times in total
Those were made some time ago so there can be compatibility problems but worth a try.
You are not the first one to request those as other users wanted them also so google is your friend
These modules do insert without issues. I still want the ability to build my own for a few reasons. I may want to add other modules later and if the kernel would happen to be updated to 5.x, I would need to rebuild them anyway.
While they do insert just fine, I have not tried them yet with my cell phone. I will try to do this after work today.
Thanks @egc _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
The toolchains on the wiki / main website have not been updated and they probably won't be updated.
No surprise there. Kinda goes along with the infamous Router Database.
Okay, I do have a really dumb question that Google has not yet been able to answer. Is the QCA IPQ8064 processor a 64 bit CPU? I assume it is, but I need to be 100% sure. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
but it doesn't matter, because only relevant with more than 4GB RAM and besides it depends on the operating system itself, you can also run a 32bit OS on a 64bit CPU.
but it doesn't matter, because only relevant with more than 4GB RAM and besides it depends on the operating system itself, you can also run a 32bit OS on a 64bit CPU.
Thank you. I would think it would matter when cross-compiling kernel modules for this router. I don't think a 64 bit kernel module would be compatible with a 32 bit kernel.
The reason I was asking is because when running "make menuconfig" for the kernel, it defaulted to 64bit. I have now changed it to 32bit. However, unless I can find the proper toolchain, it's all for nothing.
EDIT: I have discovered that running #make menuconfig is not the way to do this. It adds x86 crap all throughout the .config file. Problem has been averted by manually editing the .config file. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Forum member #248
Last edited by lexridge on Fri Sep 03, 2021 4:02; edited 1 time in total
A few things learned: Do not run make menuconfig! This tends to totally fsck up your .config file. Best to edit it manually, even though it is advised you don't. Sigh.
Note: You cannot run make menuconfig anyway if you use the DDWRT kernel sources, which I eventually decided is probably best, and what I am now using. The original WIKI for this says you can use the official kernel sources, which I now believe will never work.
Finding the toolchain-arm_cortex-a15+neon-vfpv4_gcc-10.x is apparently like finding the Holy Grail. I have installed GCC v11 but that was not enough apparently. Getting the build environment set it is a bit of a bitch, but seems to get easier with every little thing tried so far. A few keys elements to note:
Get the ddwrt kernel source using this command:
Code:
svn co svn://svn.dd-wrt.com/DD-WRT/src/linux/universal/linux-4.9 -r 47117
I used -r 47117 as that is the version on my production router. Your -r [version] may vary.
I copied .config_ipq806x to .config, then edit to add CDCETHER=m and RNDISHOST=m
then ran:
Code:
make ARCH=arm CROSS_COMPILE=arm-none-eabi- -j10
Which doesnt work because the "arm-none-eabi" is not the correct toolchain. It DOES compile, but the resulting modules are not loadable with an "unknown symbol in module" error. This hints that the toolchain is not correct, as suspected. I will continue to try to find the correct combination of GCC and toolchains, but at the moment this is not looking good.
If by chance I DO get this working (which is admittedly slim), I will post a step-by-step procedure. However, if you are not running Fedora 33, it may differ for your Linux dist.
EDIT: It would be so much easier if BS would just include these missing modules for Atheros routers. Namely the EA8500. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Success!!!
My problem was I was NOT loading usbnet.ko first. This is a dependency and must be loaded first, and it is already present. No need to build it.
It was quite simple actually, and I ended up using the old toolchain in the WIKI after all. So, step by step:
1. It's up to you to make sure you have all the build tools installed. Not the scope of this.
2. Download the toolchain from the "How to Build Modules" It's quite large at 4.7GB, and you only need one of the many toolchains included, for this router [EA8500]. You may delete all others except for toolchain-arm_cortex-a9+vfpv3_gcc-8.2.0_musl_eabi.
https://download1.dd-wrt.com/dd-wrtv2/downloads/toolchains/toolchains.tar.xz
3. Create a ddwrt_build directory in your home directory in Linux (doubt it matters what dist) and decompress the toolchains into this folder.
4. Download the DD-WRT Kernel Source:
Code:
svn co svn://svn.dd-wrt.com/DD-WRT/src/linux/universal/linux-4.9 -r 47117
The number after the -r MUST match your currently installed version. I am still on r47117.
EDIT:This may not be entirely true. I now believe it does not matter if you leave out the -r [version]. I did a compare between 47117 and the latest version 47305 after building on both, and the files were exactly the same.
5. cd to your ddwrt_build directory and then the linux-4.9 folder.
Code:
cd ~/ddwrt_build/linux-4.9
Copy the .config_ipq806x to .config. You will need to use #ls -la to see it, as it's hidden.
Code:
cp .config_ipq806x .config
6. Edit the newly copied .config file: #vim .config and search for these lines: (use whatever editor you love)
- # CONFIG_USB_NET_CDCETHER is not set
change to:
CONFIG_USB_NET_CDCETHER=m
and this one
- # CONFIG_USB_NET_RNDIS_HOST is not set
change to:
CONFIG_USB_NET_RNDIS_HOST=m
6.5 Edit the file linux-4.9/drivers/net/wireless/Kconfig and comment out the following lines:
if RALINK_DEVICE
source "drivers/net/wireless/rt3352/rt2860v2_ap/Kconfig"
source "drivers/net/wireless/rt3352/rt2860v2_sta/Kconfig"
endif
if SOC_MT7620 || SOC_MT7621
source "drivers/net/wireless/rt7620/rt2860v2_ap/Kconfig"
source "drivers/net/wireless/rt7620/rt2860v2_sta/Kconfig"
source "drivers/net/wireless/rt5592/Kconfig"
source "drivers/net/wireless/rt7612/rlt_wifi/Kconfig"
source "drivers/net/wireless/rt7610/Kconfig"
endif
7. Set your path so the toolchain binaries can be found:
8. Now we are ready to build the kernel and the modules. Issue the command:
Code:
make ARCH=arm CROSS_COMPILE=arm-openwrt-linux- -j10
the -j will depend on how many CPU cores you have. If you have a 4 core CPU, use -j6. For that matter, if you are very patient, you don't need to use it. It just really speeds things up if you do.
9. If it completes successfully, you will find the newly built modules in:
drivers/net/usb/cdc_ether.ko
drivers/net/usb/rndis_host.ko
10. Copy to your router's jffs or /opt partition and try loading them:
There ya have it. Pretty simple huh? Please post your results here, if anyone tries this. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Forum member #248
Last edited by lexridge on Thu Sep 09, 2021 13:08; edited 5 times in total
Here are the modules I managed to build if anyone would like to test them. I built these for r47117 but they might work on later versions. Would be nice to know. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.
Joined: 08 May 2018 Posts: 14242 Location: Texas, USA
Posted: Sat Sep 04, 2021 1:04 Post subject:
You could also create a symbolic link for .config; isn't there a specific makefile for IPQ? Doesn't it point to the proper config file? If not, you could likely manipulate the makefile to use the right config file _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
You could also create a symbolic link for .config; isn't there a specific makefile for IPQ? Doesn't it point to the proper config file? If not, you could likely manipulate the makefile to use the right config file
Yes, true one could. I just thought to keep the original file intact and create a new one for editing. Either would be fine.
If there is a specific makefile for IPQ, I can not find it. _________________ Linksys EA8500 (Internet Gateway, AP/VAP) - DD-WRT r53562
Features in use: WDS-AP, Multiple VLANs, Samba, WireGuard, Entware: mqtt, mlocate
Wireless 5ghz only
Netgear R7800 (WDS-AP, WAP, VAP) - DD-WRT r55779
Features in use: multiple VLANs over single trunk port
Linksys EA8500 WDS Station x2 - DD-WRT r55799
Netgear R6400v2 WAP, VAP 2.4ghz only w/VLANs over single trunk port. DD-WRT r55779
OSes: Fedora 38, 9 RPis (2,3,4,5), 20 ESP8266s: Straight from Amiga to Linux in '94, never having owned a Windows PC.