Skip to content

Instantly share code, notes, and snippets.

@chunyang
Last active December 21, 2015 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chunyang/6274925 to your computer and use it in GitHub Desktop.
Save chunyang/6274925 to your computer and use it in GitHub Desktop.
Was not able to build the broadcom-wl module without using patch linked to by cyberic. https://aur.archlinux.org/packages/broadcom-wl/
# These are the errors I get when not using the patch:
==> Making package: broadcom-wl 5.100.82.112-12 (Mon Aug 19 15:08:35 PDT 2013)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found hybrid-portsrc_x86_64-v5_100_82_112.tar.gz
-> Found modprobe.d
-> Found license.patch
-> Found user-ioctl.patch
-> Found linux-recent.patch
==> Validating source files with sha1sums...
hybrid-portsrc_x86_64-v5_100_82_112.tar.gz ... Passed
modprobe.d ... Passed
license.patch ... Passed
user-ioctl.patch ... Passed
linux-recent.patch ... Passed
==> Extracting sources...
-> Extracting hybrid-portsrc_x86_64-v5_100_82_112.tar.gz with bsdtar
==> Removing existing pkg/ directory...
==> Starting build()...
patching file Makefile
patching file src/wl/sys/wl_cfg80211.c
patching file src/wl/sys/wl_iw.h
patching file src/wl/sys/wl_linux.c
(Stripping trailing CRs from patch; use --binary to disable.)
patching file src/wl/sys/wl_cfg80211.c
Hunk #1 succeeded at 1457 (offset -9 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 1578 (offset -1 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file src/wl/sys/wl_cfg80211.c
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 2073 with fuzz 1.
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 244 (offset 4 lines).
make: Entering directory `/usr/src/linux-3.10.7-1-ARCH'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
LD /home/cyang/src/broadcom-wl/src/built-in.o
CC [M] /home/cyang/src/broadcom-wl/src/src/shared/linux_osl.o
CC [M] /home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.o
CC [M] /home/cyang/src/broadcom-wl/src/src/wl/sys/wl_iw.o
CC [M] /home/cyang/src/broadcom-wl/src/src/wl/sys/wl_cfg80211.o
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c: In function ‘wl_tkip_printstats’:
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:2967:7: warning: passing argument 1 of ‘wl->tkipmodops->print_stats’ from incompatible pointer type [enabled by default]
wl->tkip_bcast_data[idx]);
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:2967:7: note: expected ‘struct seq_file *’ but argument is of type ‘char *’
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:2970:4: warning: passing argument 1 of ‘wl->tkipmodops->print_stats’ from incompatible pointer type [enabled by default]
wl->tkipmodops->print_stats(debug_buf, wl->tkip_ucast_data);
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:2970:4: note: expected ‘struct seq_file *’ but argument is of type ‘char *’
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c: In function ‘wl_reg_proc_entry’:
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:3177:2: error: implicit declaration of function ‘create_proc_entry’ [-Werror=implicit-function-declaration]
if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:3177:22: warning: assignment makes pointer from integer without a cast [enabled by default]
if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:3182:16: error: dereferencing pointer to incomplete type
wl->proc_entry->read_proc = wl_proc_read;
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:3183:16: error: dereferencing pointer to incomplete type
wl->proc_entry->write_proc = wl_proc_write;
^
/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.c:3184:16: error: dereferencing pointer to incomplete type
wl->proc_entry->data = wl;
^
cc1: some warnings being treated as errors
make[1]: *** [/home/cyang/src/broadcom-wl/src/src/wl/sys/wl_linux.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [_module_/home/cyang/src/broadcom-wl/src] Error 2
make: Leaving directory `/usr/src/linux-3.10.7-1-ARCH'
==> ERROR: A failure occurred in build().
Aborting...
# Contributor: Austin ( doorknob60 [at] gmail [dot] com )
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
pkgname=broadcom-wl
pkgver=5.100.82.112
pkgrel=13
pkgdesc='Broadcom 802.11abgn hybrid Linux networking device driver'
url='http://www.broadcom.com/support/802.11/linux_sta.php'
arch=('i686' 'x86_64')
license=('custom')
depends=('linux')
makedepends=('linux-headers')
[[ $CARCH = x86_64 ]] && ARCH=x86_64 || ARCH=x86_32
source=("http://www.broadcom.com/docs/linux_sta/hybrid-portsrc_${ARCH}-v${pkgver//./_}.tar.gz"
'modprobe.d'
'license.patch'
'user-ioctl.patch'
'linux-recent.patch'
'wl-linux.patch')
sha1sums=('5bd78c20324e6a4aa9f3fafdc6f0155e884d5131'
'89bf92286ede30dd85304c6c4e42e89cfdc0f60a'
'ea7b67982ddc0f56fd3becb9914fd4458fe7d373'
'a41f11ffc18dbb126176259e02dd93b6ade04a10'
'64f99cde29168e7bd8508af30702c68f907556d9'
'ca263b0f9f29647e4de2996bddc7c85ff0617a38')
[[ $CARCH = x86_64 ]] && sha1sums[0]='5bd78c20324e6a4aa9f3fafdc6f0155e884d5131'
backup=('etc/modprobe.d/broadcom-wl.conf')
install=install
_extramodules=extramodules-3.10-ARCH
_kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
build() {
cd "${srcdir}"
patch -p1 -i linux-recent.patch
patch -p1 -i user-ioctl.patch
patch -p1 -i license.patch
patch -p1 -i wl-linux.patch
make -C /usr/lib/modules/"${_kernver}"/build M=`pwd`
}
package() {
cd "${srcdir}"
install -D -m 755 wl.ko "${pkgdir}/usr/lib/modules/${_extramodules}/wl.ko"
gzip "${pkgdir}/usr/lib/modules/${_extramodules}/wl.ko"
install -D -m 644 lib/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -D -m 644 modprobe.d "${pkgdir}"/etc/modprobe.d/broadcom-wl.conf
}
diff -Naur old/src/wl/sys/wl_linux.c new/src/wl/sys/wl_linux.c
--- old/src/wl/sys/wl_linux.c 2013-08-19 15:11:36.931943013 -0700
+++ new/src/wl/sys/wl_linux.c 2013-08-19 15:17:53.126571659 -0700
@@ -2957,7 +2957,12 @@
wl_tkip_printstats(wl_info_t *wl, bool group_key)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ struct seq_file sfile;
+ struct seq_file *debug_buf = &sfile;
+#else
char debug_buf[512];
+#endif
int idx;
if (wl->tkipmodops) {
if (group_key) {
@@ -2970,7 +2975,11 @@
wl->tkipmodops->print_stats(debug_buf, wl->tkip_ucast_data);
else
return;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ printk("%s: TKIP stats from module: %s\n", debug_buf->buf, group_key?"Bcast":"Ucast");
+#else
printk("%s: TKIP stats from module: %s\n", debug_buf, group_key?"Bcast":"Ucast");
+#endif
}
#endif
}
@@ -3115,17 +3124,24 @@
return 0;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
+#else
+static ssize_t
+wl_proc_read (struct file *filp, char __user *buffer, size_t length, loff_t *data)
+#endif
{
wl_info_t * wl = (wl_info_t *)data;
int bcmerror, to_user;
int len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
if (offset > 0) {
*eof = 1;
return 0;
}
+#endif
if (!length) {
WL_ERROR(("%s: Not enough return buf space\n", __FUNCTION__));
@@ -3138,8 +3154,13 @@
return len;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
wl_proc_write(struct file *filp, const char __user *buff, unsigned long length, void *data)
+#else
+static ssize_t
+wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t *data)
+#endif
{
wl_info_t * wl = (wl_info_t *)data;
int from_user = 0;
@@ -3169,18 +3190,33 @@
return length;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+static const struct file_operations wl_fops = {
+ .owner = THIS_MODULE,
+ .read = wl_proc_read,
+ .write = wl_proc_write,
+};
+#endif
+
static int
wl_reg_proc_entry(wl_info_t *wl)
{
char tmp[32];
sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
+#else
+ if ((wl->proc_entry = proc_create(tmp, 0644, NULL, &wl_fops)) == NULL) {
+ WL_ERROR(("%s: proc_create %s failed\n", __FUNCTION__, tmp));
+#endif
ASSERT(0);
return -1;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
wl->proc_entry->read_proc = wl_proc_read;
wl->proc_entry->write_proc = wl_proc_write;
wl->proc_entry->data = wl;
+#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment