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

broadcom-wl-dkms: Doesn't compile with kernel >= 5.9 #101040

Closed
bagnaram opened this issue Oct 18, 2020 · 7 comments
Closed

broadcom-wl-dkms: Doesn't compile with kernel >= 5.9 #101040

bagnaram opened this issue Oct 18, 2020 · 7 comments
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: kernel

Comments

@bagnaram
Copy link
Contributor

Describe the bug
In kernel versions before 5.9 there was a macro called "segment_eq". This macro was only used to implement "uaccess_kernel" and removed with 5.9.0. Now broadcom-wl-dkms fails to build as it can't find it.

See: for patch https://bugs.archlinux.org/task/68030

To Reproduce
Steps to reproduce the behavior:

  1. Enable broadcom-sta
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];

Screenshots

/build/broadcom-sta/src/wl/sys/wl_linux.c:1667:6: error: implicit declaration of function 'segment_eq' [-Werror=implicit-function-declaration]

Notify maintainers

Metadata

- system: `"x86_64-linux"`
 - host os: `Linux 5.8.7, NixOS, 21.03.git.d44dbf3549a (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.6`
 - channels(root): `"nixos-21.03pre246543.24c9b05ac53"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@mannp
Copy link

mannp commented Nov 8, 2020

The same issue for me, did you find a fix as it is very quiet in here otherwise.

@bagnaram
Copy link
Contributor Author

bagnaram commented Nov 11, 2020

I have a fix for it @mannp : Create the file linux-5.9.patch and apply to the broadcom-sta package

diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index c8c168d..39706ae 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -1647,9 +1647,13 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                goto done2;
        }

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+       if (uaccess_kernel())
+               buf = ioc.buf;
+#else
        if (segment_eq(get_fs(), KERNEL_DS))
                buf = ioc.buf;
-
+#endif
        else if (ioc.buf) {
                if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
                        bcmerror = BCME_NORESOURCE;

@mannp
Copy link

mannp commented Nov 11, 2020

Hi @bagnaram thanks for the reply and the solution 👍

I am not sure if 5.9 is a cutting edge kernel on nix, as am not really looking to patch things to get a working distro.

As I cannot currently get 5.8 to build either I may try your patch to at least get a working installation.

Cheers.

@bbigras
Copy link
Contributor

bbigras commented Nov 27, 2020

Any progress on this?

@siraben
Copy link
Member

siraben commented Dec 4, 2020

I ran into this issue today when trying to set kernelPackages = pkgs.linuxPackages_latest; in my configuration.nix.

Edit: I was able to fix the build by using @bagnaram's patch and putting this in my configuration.

  linuxPackages_patched = pkgs.linuxPackages_latest.extend (self: super: {
    broadcom_sta = super.broadcom_sta.overrideAttrs (oA: {
      patches = [ ./broadcom-sta-5.9.patch ] ++ oA.patches;
    });
  });

@SebastienWae
Copy link
Contributor

For some reason @bagnaram's patch was on the wrong lines for me.

diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 0d05100..7a972b9 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -1643,8 +1643,13 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 		goto done2;
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+if (uaccess_kernel())
+  buf = ioc.buf;
+#else
 	if (segment_eq(get_fs(), KERNEL_DS))
 		buf = ioc.buf;
+#endif
 
 	else if (ioc.buf) {
 		if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {

@stale
Copy link

stale bot commented Jun 9, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: kernel
Projects
None yet
Development

No branches or pull requests

7 participants