Building Linux kernel

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team

User avatar
ono
Atariator
Atariator
Posts: 20
Joined: Sun Aug 18, 2019 11:22 am
Location: Switzerland
Contact:

Re: Building Linux kernel

Post by ono »

kolla wrote:I updated the Dockerfile a few days ago to reflect updates with MiSTer, so now it build 4.19 kernel using gcc 6.2.1, just like the "official" kernel. I have a few specific reasons for building kernel myself (IPv6 mostly), and this Dockerfile does all I want. As usual, feel free to fork and improve :) (...)
Your Dockerfile just saved my day (definitely an evening). :cheers:

TL;DR

Today arrived TP-Link T2U nano AC600 dual band dongle, before I was running some ancient and bulky 54Mbps WiFi dongle. I bought T2U Nano reading that it is likely using rtl8821a and looking at MiSTer_defconfig CONFIG_RTL8821AU=y driver was there. Unfortunately when I swapped it wlan0 was missing. So I did lsusb and new dongle was listed, but driver was apparently not picking it up. I freaked out a bit first, but then I found Dockerfile of yours and some parch request at https://github.com/aircrack-ng/rtl8812a ... -495289004. I patched one line, run build and now it works great.

Just sharing if anyone is interested in running this dongle too as it seems to be pretty popular, small and cheap.

Code: Select all

diff --git a/drivers/net/wireless/realtek/rtl8821AU/os_dep/linux/usb_intf.c b/drivers/net/wireless/realtek/rtl8821AU/os_dep/linux/usb_intf.c
index d06f76daa..c228b7426 100644
--- a/drivers/net/wireless/realtek/rtl8821AU/os_dep/linux/usb_intf.c
+++ b/drivers/net/wireless/realtek/rtl8821AU/os_dep/linux/usb_intf.c
@@ -325,6 +325,7 @@ static struct usb_device_id rtw_usb_id_tbl[] ={
 	{USB_DEVICE(0x7392, 0xA811),.driver_info = RTL8821}, /* Edimax - Edimax */
 	{USB_DEVICE(0x7392, 0xA812),.driver_info = RTL8821}, /* Edimax - EW-7811UTC */
 	{USB_DEVICE(0x7392, 0xA813),.driver_info = RTL8821}, /* Edimax - EW-7811UAC */
+	{USB_DEVICE(0x2357, 0x011E),.driver_info = RTL8821}, /* TP-Link - Archer T2U Nano */
 #endif
 
 #ifdef CONFIG_RTL8192E
Grown up playing/learning to program Atari 130XE. FM synth and tech nerd. | github.com/nanoant
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Building Linux kernel

Post by Sorgelig »

You can add pull request to MiSTer Linux repo, so it will be included into next Linux release.
User avatar
ono
Atariator
Atariator
Posts: 20
Joined: Sun Aug 18, 2019 11:22 am
Location: Switzerland
Contact:

Re: Building Linux kernel

Post by ono »

Sorgelig wrote:You can add pull request to MiSTer Linux repo, so it will be included into next Linux release.
PR sent. Thank you!
Grown up playing/learning to program Atari 130XE. FM synth and tech nerd. | github.com/nanoant
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Building Linux kernel

Post by Sorgelig »

Btw, as most Chinese manufacturers they put whatever chip they find in their junk yard. So besides the name, need to mention HW revision as well. I have TPLink Archer T2U - and it uses MT7610 chip.
User avatar
ono
Atariator
Atariator
Posts: 20
Joined: Sun Aug 18, 2019 11:22 am
Location: Switzerland
Contact:

Re: Building Linux kernel

Post by ono »

Sorgelig wrote:Btw, as most Chinese manufacturers they put whatever chip they find in their junk yard. So besides the name, need to mention HW revision as well. I have TPLink Archer T2U - and it uses MT7610 chip.
I really enjoyed way you describe the "Way of Chinese" companies :lol:
But nah, that thing is called TPLink Archer T2U Nano and it is Realtek chip despite same "T2U" in the name. I don't know where they take these meaningless names from though. See: https://wikidevi.com/wiki/TP-LINK_Archer_T2U_Nano
And just to be clear, this was cheapest and smallest Dual Band Dongle I could find in Swiss shops (as there's not too much choice here) and it uses apparently chip that current MiSTer kernel had driver for. Everything below 16 Francs were only Single Band 2.4GHz.
Regards, Adam.
Grown up playing/learning to program Atari 130XE. FM synth and tech nerd. | github.com/nanoant
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Building Linux kernel

Post by Sorgelig »

Ah, yeah, it's smaller than mine.
Still many WiFi dongles use different chipsets inside the same product name. Dongles may look completely same. Only different is revisions like A1, B2, ...
kolla
Captain Atari
Captain Atari
Posts: 341
Joined: Thu Sep 17, 2015 11:39 pm
Contact:

Re: Building Linux kernel

Post by kolla »

ono wrote: Your Dockerfile just saved my day (definitely an evening). :cheers:
Glad to see that it has been useful for not just me :)
-- kolla
blacklistedcard
Atariator
Atariator
Posts: 22
Joined: Thu Dec 20, 2018 1:06 am

Re: Building Linux kernel

Post by blacklistedcard »

kolla wrote:
ono wrote: Your Dockerfile just saved my day (definitely an evening). :cheers:
Glad to see that it has been useful for not just me :)
I'm using it also. Thanks. It saves a lot of time getting a build environment up and running. I'm not sure what the governor is set to on the image. Going to check a few things.
blacklistedcard
Atariator
Atariator
Posts: 22
Joined: Thu Dec 20, 2018 1:06 am

Re: Building Linux kernel

Post by blacklistedcard »

kolla wrote:
ono wrote: Your Dockerfile just saved my day (definitely an evening). :cheers:
Glad to see that it has been useful for not just me :)
Kolla, I'm using your docker solution. I updated mine to use the gcc 8.3. There were two warnings but it compiled.
The Mister boot fine.....

Step 4/10 : ENV ARCH arm
---> Using cache
---> 2e6472b91adb
Step 5/10 : ENV CROSS_COMPILE /root/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
---> Using cache
---> 7b405e2454ed
Step 6/10 : RUN (apt-get update; apt-get -y upgrade; apt-get -y install build-essential bc liblz4-tool device-tree-compiler wget libncurses5-dev libncursesw5-dev bison flex libssl-dev) >/dev/null 2>&1
---> Using cache
---> 62fc7fe4f7d3
Step 7/10 : RUN wget -q -O - https://developer.arm.com/-/media/Files ... ihf.tar.xz | tar xJf -
---> Using cache
---> eb10e8935684
Step 8/10 : RUN wget -q -O - https://codeload.github.com/MiSTer-deve ... .19-MiSTer | tar xzf -
---> Using cache
---> e70c57b30465
Step 9/10 : RUN make -C Linux-Kernel_MiSTer-socfpga-4.19-MiSTer --quiet clean mrproper MiSTer_defconfig zImage modules dtbs
---> Using cache
---> c343ba2e46fe
Step 10/10 : CMD test -f /mnt/MiSTer_config && cp -v /mnt/MiSTer_config Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/.config ; make -C Linux-Kernel_MiSTer-socfpga-4.19-MiSTer --quiet menuconfig zImage modules dtbs ; cat Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/arch/arm/boot/zImage Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/arch/arm/boot/dts/socfpga_cyclone5_de10_nano.dtb > zImage_dtb ; cp -v zImage_dtb /mnt/zImage_dtb ; cp -v Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/.config /mnt/MiSTer_config
---> Using cache
---> d3d35ba89f94
Successfully built d3d35ba89f94

# docker run -v $(pwd):/mnt -ti mister_kernel
'/mnt/MiSTer_config' -> 'Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/.config'
'zImage_dtb' -> '/mnt/zImage_dtb'
'Linux-Kernel_MiSTer-socfpga-4.19-MiSTer/.config' -> '/mnt/MiSTer_config'

-8784175 Sep 23 20:20 zImage_dtb
You do not have the required permissions to view the files attached to this post.
kolla
Captain Atari
Captain Atari
Posts: 341
Joined: Thu Sep 17, 2015 11:39 pm
Contact:

Re: Building Linux kernel

Post by kolla »

Cool, I just set it to use the same gcc version that Sorgelig has been using :)
-- kolla
User avatar
witchmaster
Captain Atari
Captain Atari
Posts: 150
Joined: Wed Jun 15, 2011 10:50 am

Re: Building Linux kernel

Post by witchmaster »

Hi! Is there any limitations to building and using a kernel based on the "socfpga-4.19-MiSTer" branch? Is "socfpga-4.5" still the "official" branch?

EDIT: Never mind, 4.19 is the official branch it seems, didn't read the thread properly enough.
blacklistedcard
Atariator
Atariator
Posts: 22
Joined: Thu Dec 20, 2018 1:06 am

Re: Building Linux kernel

Post by blacklistedcard »

I updated to gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf. There are a ton of warnings but it still spit out a kernel. I tested the kernel, everything seems to work fine.

https://github.com/DwaineGarden/Linux-K ... STer_build
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Building Linux kernel

Post by Sorgelig »

blacklistedcard wrote:I updated to gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf. There are a ton of warnings but it still spit out a kernel. I tested the kernel, everything seems to work fine.
there is absolutely no point to upgrade the gcc! Kernel code is tuned for some range of gcc versions and when you go to newer version, kernel may break on it.
Locked

Return to “MiSTer”