Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to build for custom kernel version & arch (v2) #123

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jlkDE
Copy link

@jlkDE jlkDE commented Feb 5, 2023

As stated the last time: I experience frequent kernel updates and rebuild the driver quite often.

With this patch it is possible to build for a newer (or any custom) kernel version as long as the sources are available by supplying you own version and/or arch via an environment variable like this:

sudo KVER=6.1.1-1-default ./install-driver.sh

If you do not supply anything (and the variable is unset in your env) nothing changes, so the default stays the same.

I have been building my driver like this since the end of last year and discovered no problems so far.
One thing I am not sure of: $KVER is also evaluated in the dkms-make.sh script, do I have to edit that one too? For me it works without this too.

This time hopefully without bashisms. :)

Superseeds #109

@morrownr
Copy link
Owner

morrownr commented Feb 5, 2023

sudo KVER=6.1.1-1-default ./install-driver.sh

Let's see if some error checking might help. Run:

sudo KVER=6.1.1.1-default ./install-driver.sh

Next

See what the following does:

sudo KVER=6.1.1-1-default sh install-driver.sh NoPrompt

Next

FYI: The recent updates to install-driver.sh add code to detect and uninstall prior installations so you really should not need to run remove-driver.sh anymore unless you really are going to permanently remove the driver. So try testing install-driver.sh without running remove-driver.sh.

Side note: When you finish with this project, would you be interested in helping me with another project? On my to-do list, I am considering adding driver compression to the install-driver.sh script as compression has been supported in the kernel since 5.4. That should be pretty straightforward. I also need to get to the bottom of how country codes work these days so I can add some code to do error checking in install-driver.sh. Let me know.

Nick

@jlkDE
Copy link
Author

jlkDE commented Feb 11, 2023

I will start with the latter ones: You are right, remove-driver.sh is not required anymore for my flow and I am always open to helping wherever I can, the only limitation is my knowledge and time, but you can ping me and I will try my best.

Now back to this request: From my point of view this works as intended: sudo KVER=6.1.10-1-default sh install-driver.sh NoPrompt installs the driver the same way as sudo KVER=6.1.10-1-default ./install-driver.sh does. :)

But now there is another thing I am noticing, but I am unsure if this is due to my distribution or this code... I will post the whole output

sudo KVER=6.1.10-1-default sh install-driver.sh NoPrompt
[sudo] password for root:
: ---------------------------
: install-driver.sh v20230126
: x86_64 (architecture)
: 12/12 (in-use/total processing units)
: 32813844 (total system memory)
: 6.1.10-1-default (kernel version)
: gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27]
: dkms-2.8.7
: SecureBoot disabled
Platform is in Setup Mode
: ---------------------------
rtl88x2bu/5.13.1, 6.1.10-1-default, x86_64: built
rtl88x2bu/5.13.1, 6.1.8-1-default, x86_64: installed
Removing a dkms installation: rtl88x2bu
Module rtl88x2bu 5.13.1 is not installed for kernel 6.1.10-1-default (x86_64). Skipping...
Module rtl88x2bu-5.13.1 for kernel 6.1.8-1-default (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.
Removing any linked weak-modules
getopt: unrecognized option '--no-initramfs'
Usage: ${0##*/} [options] {--add-modules|--remove-modules}
       ${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release}

--add-modules
        Add a list of modules read from standard input. Create
        symlinks in compatible kernel's weak-updates/ directory.
        The list of modules is read from standard input.

--remove-modules
        Remove compatibility symlinks from weak-updates/ directories
        for a list of modules.  The list of modules is read from
        standard input.

--add-kernel
        Add compatibility symlinks for all compatible modules to the
        specified or running kernel.

--remove-kernel
        Remove all compatibility symlinks for the specified or current
        kernel.

--verbose
        Print the commands executed.

-dry-run
        Do not create/remove any files.

88x2bu.ko.zst:
 - Uninstallation
   - Deleting from: /lib/modules/6.1.8-1-default/updates/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod...
Deleting module rtl88x2bu-5.13.1 completely from the DKMS tree.
Removing 88x2bu.conf from /etc/modprobe.d
Removing source files from /usr/src/rtl88x2bu-5.13.1
Installing 88x2bu.conf to /etc/modprobe.d
The dkms installation routines are in use.
Copying source files to /usr/src/rtl88x2bu-5.13.1
Creating symlink /var/lib/dkms/rtl88x2bu/5.13.1/source -> /usr/src/rtl88x2bu-5.13.1
The driver was added to dkms successfully.

Building module:
cleaning build area...
./dkms-make.sh...........
cleaning build area...
Compile time: 236.39 seconds
The driver was built by dkms successfully.

Building module:
cleaning build area...
./dkms-make.sh...........
cleaning build area...

88x2bu.ko.zst:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.1.8-1-default/updates/
Adding any weak-modules
getopt: unrecognized option '--no-initramfs'
Usage: ${0##*/} [options] {--add-modules|--remove-modules}
       ${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release}

--add-modules
        Add a list of modules read from standard input. Create
        symlinks in compatible kernel's weak-updates/ directory.
        The list of modules is read from standard input.

--remove-modules
        Remove compatibility symlinks from weak-updates/ directories
        for a list of modules.  The list of modules is read from
        standard input.

--add-kernel
        Add compatibility symlinks for all compatible modules to the
        specified or running kernel.

--remove-kernel
        Remove all compatibility symlinks for the specified or current
        kernel.

--verbose
        Print the commands executed.

-dry-run
        Do not create/remove any files.
depmod...
The driver was installed by dkms successfully.

So far I was unable to locate what causes this error and I am unsure if this is something that is caused by openSUSE.

@morrownr
Copy link
Owner

So far I was unable to locate what causes this error and I am unsure if this is something that is caused by openSUSE.

I can't say that I have seen this before. I may have to go wander through the dkms source to figure out what is going on.

As I get time this week, I will look at merging the changes into a separate local repo for testing.

@jlkDE
Copy link
Author

jlkDE commented Feb 24, 2023

I reverted my changes and the error persists, so it has nothing to do with this request - Either way it works fine for me with or without my patches, so I would consider them tested and stable since I have been following this routine just fine for months now.

@morrownr
Copy link
Owner

@jlkDE

I hate not having to time to work and include this issue but right now I am in the process of moving and it is a slow process as we are doing some remolding at the same time. Between that and other things, I'm getting behind on other things here. Maybe we can take a good look at this in April or May.

@morrownr

@jlkDE
Copy link
Author

jlkDE commented Mar 3, 2023

No problem, I will continue to use my patch and we will see.

@morrownr
Copy link
Owner

@jlkDE @ViRb3

I am sorry for being so slow to work your PR's. I've been very busy. I would like to handle both of your PR's together as I think both of you are trying to accomplish the same thing - allow for easier cross compiling.

I noticed the new force-pushed the main branch from c582087 to 3c4f722 7 hours ago that was posted thing morning. I have used both parts in a new driver release I am working on so as to test.

What would speed things along is if I could both of you to work together to both agree on what should be the solution. A short paragraph to add to the README that would address ## Cross Compiling would be great.

@ViRb3
Copy link

ViRb3 commented Jul 31, 2023

Hi there, no problem, but I already moved on to a MT7921AU adapter and gave away this one, so I have no plans to work on it further.

@morrownr
Copy link
Owner

@ViRb3

No problem. How is the new adapter doing?

@ViRb3
Copy link

ViRb3 commented Jul 31, 2023

It's been rock solid since kernel 6.1 on the Raspberry Pi OS, 500Mbit up and down with zero disconnects :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants