Building Wireless Drivers (with changes)

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
jesmith
Black ninja
Black ninja
Posts: 31
Joined: 16 Jan 2012, 18:48
Location: USA

Building Wireless Drivers (with changes)

Post#1 by jesmith » 06 Mar 2012, 22:07

Background: I'm working on migrating from Slax to Porteus. One of my requirements is to use a RT2860-based card as an Access Point. Back on Slax, I was using compat-wireless with a couple of patches to get this working. In particular, I need rt2x00 to be compiled with

Code: Select all

CONFIG_RT2X00_LIB_DEBUGFS=y
so that I can reset the card by doing this:

Code: Select all

echo 1 > /sys/kernel/debug/ieee80211/phy0/reset
and I need to apply this patch:

Code: Select all

https://dev.openwrt.org/browser/trunk/package/mac80211/patches/404-ath_regd_optional.patch
because another card I'm using thinks it is in China, and I'm... not in China.

So now that I'm in the land of a modern kernel, I don't think using compat-wireless is the way to go any more. Instead, I think I just want to grab the kernel sources, apply my changes, and rebuild the rt2x00pci.ko and friends.

I'm a little confused about how to do this, though. My porteus-1.1 reports that it is using kernel 3.1.8. But I see mention on these groups that it should be 3.2.something. What's up with that?

Can someone walk me through:
- what version of kernel sources I should get from kernel.org;
- where are the patches to apply for porteus;
- what are the steps to build a fresh copy of select kernel modules;

Thanks in advance!

-Joshua

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: Building Wireless Drivers (with changes)

Post#2 by Hamza » 06 Mar 2012, 22:42

Welcome on board :)
what version of kernel sources I should get from kernel.org
where are the patches to apply for porteus
32-bit kernel resource 64-bit kernel resource
what are the steps to build a fresh copy of select kernel modules
[HOWTO] - Compile and use custom Porteus kernel
I'm a little confused about how to do this, though. My porteus-1.1 reports that it is using kernel 3.1.8. But I see mention on these groups that it should be 3.2.something. What's up with that?
yeah, it's normal. The 32-bit edition stay on 3.1.8 until main developer find out a way to fix some issues between Porteus base system and Linux kernel 3.2.

Br0kenman should answer you with more details :)
NjVFQzY2Rg==

jesmith
Black ninja
Black ninja
Posts: 31
Joined: 16 Jan 2012, 18:48
Location: USA

Re: Building Wireless Drivers (with changes)

Post#3 by jesmith » 07 Mar 2012, 17:49

OK, I'm in the process of doing this. I note that the instructions are for 3.2.9, so I'm going ahead with that version. (Hope I don't regret that decision!)

So far, I've found one defect in the howto:

Code: Select all

cat aufs2-standalone.git/aufs2-base.patch >> /root/linux-3.2.9/aufs.patch
cat aufs2-standalone.git/aufs2-standalone.patch >> /root/linux-3.2.9/aufs.patch
cat aufs2-standalone.git/aufs2-kbuild.patch >> /root/linux-3.2.9/aufs.patch
Following the instructions, I have aufs3, not aufs2. I went ahead and substituted aufs3 in those commands. We'll see what happens...

Posted after 1 hour 31 minute 42 seconds:
No joy. Apparently the aufs2/3 thing is an issue. I'm getting:

Code: Select all

  CC      fs/aufs/module.o
In file included from fs/aufs/aufs.h:45:0,
                 from fs/aufs/module.c:25:
fs/aufs/file.h: In function ‚`au_vm_prfile_set‚':
fs/aufs/file.h:289:5: error: ‚`struct vm_area_struct‚' has no member named ‚`vm_prfile‚'
make[2]: *** [fs/aufs/module.o] Error 1
make[1]: *** [fs/aufs] Error 2
make: *** [fs] Error 2
I'm not that familiar with git. What do I need to do differently to get the version that will work?

Posted after 28 minutes 40 seconds:
I think I may have found the problem. There are two more patches in the aufs folder, which the howto didn't mention. One of these would appear to be necessary to fix the compilation issue I hit. So I think this is just another bug in the howto procedure.

Instead of:

Code: Select all

cat aufs2-standalone.git/aufs2-base.patch >> /root/linux-3.2.9/aufs.patch
cat aufs2-standalone.git/aufs2-standalone.patch >> /root/linux-3.2.9/aufs.patch
cat aufs2-standalone.git/aufs2-kbuild.patch >> /root/linux-3.2.9/aufs.patch
It should probably just say:

Code: Select all

cat aufs3-standalone.git/*.patch >> /root/linux-3.2.9/aufs.patch

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Building Wireless Drivers (with changes)

Post#4 by fanthom » 07 Mar 2012, 18:20

@jesmith

i have updated this HOWTO to 3.x kernel just yesterday after seeing your post and missed few things.
let me know if you find anything else what could be improved.

Thanks
Please add [Solved] to your thread title if the solution was found.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Building Wireless Drivers (with changes)

Post#5 by brokenman » 08 Mar 2012, 12:49

To be more precise, 32bit stayed with the 3.1.8 kernel because it broke (or appeared to break) the function that supports dual graphics systems. These machines are becoming more popular and i work on one. Without this working she overheats quickly and drains the battery in less than half an hour because both cards are activated and running at boot.

After compiling the latest kernel i saw no difference. Will have to investigate this further soon.
How do i become super user?
Wear your underpants on the outside and put on a cape.

jesmith
Black ninja
Black ninja
Posts: 31
Joined: 16 Jan 2012, 18:48
Location: USA

Re: Building Wireless Drivers (with changes)

Post#6 by jesmith » 09 Mar 2012, 17:10

The howto worked for me with that change.

Note that I was working on a diskless system, and I wanted to save my kernel to the flash drive, so I did this:

Code: Select all

cd /mnt/sdb1/
. /usr/lib/liblinuxlive
LOOP="$(mknod_next_loop_dev)"
dd if=/dev/zero of=lofs bs=2000000000 count=1
losetup $LOOP lofs
mkfs -t ext2 -m 1 $LOOP
mkdir /build
mount -t ext2 $LOOP /build
Then I substituted /build for /root in the HOWTO. I can then get access to the kernel sources on subsequent runs like so:

Code: Select all

mkdir /build
mount -o loop /mnt/sdb1/lofs /build
Also, you mention the need to rebuild drivers like the NVIDIA drivers at the top of the HOWTO, but don't include instructions. Here's what I did after the "reboot and enjoy" step, in case you want to augment the HOWTO or write another one...

0. Go to http://www.nvnews.net/vbulletin/showthread.php?t=122606 and find the latest driver, save it to /mnt/sdb1
1. Reboot to text mode (you can't build the NVIDIA drivers with X running)
2. Do this (assuming you did the /build thing I mentioned above):

Code: Select all

mkdir /build
mount -o loop /mnt/sdb1/lofs /build
sh /mnt/sdb1/NIVIDIA*.run --kernel-source-path=/build/linux-3.2.9/
cp -r /mnt/live/memory/changes/{usr,lib} /build/nvidia-295.20/
rm -r /build/nvidia-295.20/usr/lib/python2.6
dir2xzm /build/nvidia-295.20/ /build/nvidia-295.20.xzm
umount /build

Post Reply