LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-18-2017, 07:13 PM   #1
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
Realtek 8812au


I'm testing a bunch of usb WiFi adapters.
One of the adapters had an rtl8812au chip that wasn't supported by the kernel.
It seems to be pretty common in usb WiFi adapters rated for higher transfer speeds and many even claim linux support.
After some searching and some testing i got it to work, so i made a quick SlackBuild for it.

Code:
#!/bin/sh

# Slackware build script for rtl8812au

# Copyright 2017 Niklas 'Nille' Åkerström  <nille.kungen [at] gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=rtl8812au
BRANCH=${BRANCH:-master}   #for original source use 4.3.20 
BUILD=${BUILD:-1}
KERNELVERSION=${KERNELVERSION:-`uname -r`}
TAG=${TAG:-_Nille}

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/builds}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e # Exit on most errors

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf rtl8812au_rtl8821au

git clone git://github.com/Grawp/rtl8812au_rtl8821au.git
cd rtl8812au_rtl8821au
HEADISAT="$(cat .git/packed-refs | grep "refs/remotes/origin/${BRANCH}$" | cut -b1-7)"
set +e
find . -name ".git*" -exec rm -rf "{}" \;
set -e
chown -R root:root .

make

mkdir -p $PKG/lib/modules/${KERNELVERSION}/drivers/net/wireless
install -m 644 *.ko $PKG/lib/modules/${KERNELVERSION}/drivers/net/wireless/

mkdir -p $PKG/install
# Create the slack-desc file
cat << 'EOF' > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

         |-----handy-ruler------------------------------------------------------|
rtl8812au:
rtl8812au: RealTek RTL8812AU and RTL8821AU driver
rtl8812au:
rtl8812au: This driver package is built with an fork of RealTek driver v4.3.20
rtl8812au:
rtl8812au: https://github.com/Grawp/rtl8812au_rtl8821au
rtl8812au:
rtl8812au:
rtl8812au:
rtl8812au:
rtl8812au:
EOF

#create doinst.sh that runs depmod with kernelversion
cat << 'EOF' > $PKG/install/doinst.sh
if [ -x sbin/depmod ]; then
  chroot . /sbin/depmod -ae @KERNEL@ 1> /dev/null 2> /dev/null
fi
EOF

sed -i "s%@KERNEL@%${KERNELVERSION}%" $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$HEADISAT\_${KERNELVERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-tgz}
Maybe it saves someone else some time.
 
Old 05-18-2017, 07:47 PM   #2
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 917

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Good idea.

I've had one of these 8812au wifi adapters for about 5 years. After finding a repo that allowed me to make a module (even though I initially had to insert usb id entry myself), it's been working really well and I'm surprised that it's never made it into the mainline kernel. I guess there must be good reasons for that. The only real issue I've had is that the most up to date repo changes every so often. The first one I found went stale after a while (wouldn't build with kernel of that time) so I found another repo whose code worked and eventually another - I think I'm on my third repo at the moment. This SlackBuild introduces yet another. I wish there were a stable source that is updated reliably or, better, it would finally make it to mainline.

chris
 
Old 05-19-2017, 04:45 AM   #3
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Original Poster
Rep: Reputation: 201Reputation: 201Reputation: 201
The git repo used is the one used by Arch Linux so i expect it to be updated if needed,it's also forked of realtek v4.3.20.
I did find some forked from earlier releases but they didn't work with my "Comfast" 600Mbps 11AC adapter 0bda:a811, but this git repo works.
I did put some time into this adapter, first finding the last source release that i could find (v4.3.20) and then poking in the source myself until i found this git repo.

Last edited by Nille_kungen; 05-19-2017 at 04:48 AM.
 
Old 05-20-2017, 11:19 AM   #4
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Original Poster
Rep: Reputation: 201Reputation: 201Reputation: 201
Updated the script since kernelversion wasn't passed to make.
This is needed to be able to build the package for a new kernel before reboot.
Code:
#!/bin/sh

# Slackware build script for rtl8812au

# Copyright 2017 Niklas 'Nille' Åkerström  <nille.kungen [at] gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=rtl8812au
BRANCH=${BRANCH:-master}   #for original source use 4.3.20 
BUILD=${BUILD:-1}
KERNELVERSION=${KERNELVERSION:-`uname -r`}
TAG=${TAG:-_Nille}

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/builds}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e # Exit on most errors

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf rtl8812au_rtl8821au

git clone git://github.com/Grawp/rtl8812au_rtl8821au.git
cd rtl8812au_rtl8821au
HEADISAT="$(cat .git/packed-refs | grep "refs/remotes/origin/${BRANCH}$" | cut -b1-7)"
set +e
find . -name ".git*" -exec rm -rf "{}" \;
set -e
chown -R root:root .

make KVER=${KERNELVERSION}

mkdir -p $PKG/lib/modules/${KERNELVERSION}/drivers/net/wireless
install -m 644 *.ko $PKG/lib/modules/${KERNELVERSION}/drivers/net/wireless/

mkdir -p $PKG/install
# Create the slack-desc file
cat << 'EOF' > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

         |-----handy-ruler------------------------------------------------------|
rtl8812au:
rtl8812au: RealTek RTL8812AU and RTL8821AU driver
rtl8812au:
rtl8812au: This driver package is built with an fork of RealTek driver v4.3.20
rtl8812au:
rtl8812au: https://github.com/Grawp/rtl8812au_rtl8821au
rtl8812au:
rtl8812au:
rtl8812au:
rtl8812au:
rtl8812au:
EOF

#create doinst.sh that runs depmod with kernelversion
cat << 'EOF' > $PKG/install/doinst.sh
if [ -x sbin/depmod ]; then
  chroot . /sbin/depmod -ae @KERNEL@ 1> /dev/null 2> /dev/null
fi
EOF

sed -i "s%@KERNEL@%${KERNELVERSION}%" $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$HEADISAT\_${KERNELVERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-tgz}
 
Old 05-20-2017, 07:35 PM   #5
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 917

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by Nille_kungen View Post
Updated the script since kernelversion wasn't passed to make.
This is needed to be able to build the package for a new kernel before reboot.
Code:
...
The issue of having to make a new package before rebooting with a new kernel is the reason I've not used a SlackBuild for this module (also nvidia module). Instead I hand them over to dkms (I have my own build of it but it's also available at SBo) which detects a new kernel at boot time and builds any out of date modules that it knows about.

chris
 
1 members found this post helpful.
Old 09-22-2017, 06:41 PM   #6
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 917

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Further to the earlier comment about the most up to date upstream changing from time to time, I see Arch Linux has now changed theirs to:
https://github.com/zebulon2/rtl8812au-driver-5.2.9
which I've been using for about 15mins so far. No problems yet.

chris
 
Old 09-22-2017, 08:39 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
I spent yesterday on a 8814au build, eventually settling on zebulon2 - I too found it looked like the most current. Has patch for 4.11 which was missing from other repos.
Not Slack in my case, just adding corroboration.
 
Old 09-24-2017, 05:03 PM   #8
kudsu
Member
 
Registered: Apr 2017
Location: from LA
Distribution: Slackware and anything
Posts: 50

Rep: Reputation: Disabled
Cool Equipment

Looks like a lot of. Nice equipment. What do you want to do? I was skypeing with a buddy overseas and while he was doing that he was actually broadcasting voice and music to other people. I find this amazing but I am not going to resurrect a old dead box to do it? Laptop? Internet? Throw these things in a blender and I guarantee you will have something.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Getting Realtek 8188EU Wireless Adapters to work in Linux (and possibly other wireless Realtek chipsets!) LXer Syndicated Linux News 0 02-04-2017 10:06 PM
Another Realtek problem R3P71L3 Linux - Wireless Networking 4 05-30-2011 03:34 PM
Realtek RTL8029 mmarco8119 Linux - Hardware 5 10-13-2006 10:49 PM
realtek Sheltraw Linux - Networking 1 05-05-2004 02:27 PM
8139 realtek jakublgz Linux - Hardware 3 04-11-2003 04:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration