[HOWTO] Broadcom wifi under Porteus

As you probably know, Broadcom wifi chipsets are the most problematic in the linux world.
Starting with the Porteus-1.2 release we are going to provide 4 drivers which should cover all broadcom wifi cards.


The broadcom-sta driver will be placed in 000-kernel.xzm along with the b43, b43-legacy and bcma drivers. The last three are blacklisted by default as broadcom-sta supports the majority of wifi NIC's. Unfortunately older chipsets are not working properly with broadcom-sta so b43, b43-legacy and bcma must come to the rescue.
Here is an example of a wifi card that is not working with the broadcom-sta driver:

lspci -knn
0c:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11b/g WLAN [14e4:4311] (rev 01)
Subsystem: Dell Wireless 1390 WLAN Mini-Card [1028:0007]
Kernel modules: wl, ssb



 
dmesg
[    5.878844] wl: module license 'unspecified' taints kernel.
[    5.878849] Disabling lock debugging due to kernel taint
[    5.892862] wl 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    5.892872] wl 0000:0c:00.0: setting latency timer to 64
[    5.895866] eth%d: 5.100.82.112 driver failed with code 21



Here is an example of a card that is working correctly with broadcom-sta:

 
lspci -knn
0c:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01)
Subsystem: Dell Wireless 1395 WLAN Mini-Card [1028:000b]
Kernel driver in use: wl
Kernel modules: wl, ssb

 

dmesg
[    6.916353] wl: module license 'unspecified' taints kernel.
[    6.916357] Disabling lock debugging due to kernel taint
[    6.928402] wl 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    6.928416] wl 0000:0c:00.0: setting latency timer to 64
[    6.990065] lib80211_crypt: registered algorithm 'TKIP'
[    6.990369] eth1: Broadcom BCM4315 802.11 Hybrid Wireless Controller 5.100.82.112



As you can see "Dell Wireless 1390" is unlucky while "Dell Wireless 1395" works just fine.

What to do if your NIC is not working with the broadcom-sta driver?
The solution is quite simple as Porteus comes with other drivers which should do the job. The only thing which must be done is to blacklist 'wl' driver (our broadcom-sta) and unblacklist the rest.  To do this, create a file (plain text) at /mnt/sdXY/porteus/rootcopy/etc/modprobe.d/b43_blacklist.conf with following content:

    blacklist wl


This file will override the original one from 000-kernel.xzm and the b43 (or b43-legacy, or bcma) driver will take priority over 'wl'.
By default Porteus-1.2 ships only with open-source firmware for the b43 driver which supports a limited number of chipsets. You can still extract non-free firmware for b43 driver with the help of b43-fwcutter as described in this HOWTO:
link

here is sample dmesg output when broadcom chipset is served by the b43 driver:

dmesg | grep b43
[    8.070964] b43-pci-bridge 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    8.070975] b43-pci-bridge 0000:0c:00.0: setting latency timer to 64
[    8.326540] b43-phy0: Broadcom 4311 WLAN found (core revision 10)
[    8.444650] Registered led device: b43-phy0::tx
[    8.444670] Registered led device: b43-phy0::rx
[    8.444691] Registered led device: b43-phy0::radio
[   11.554040] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)



Hopefully all broadcom problems will finally be gone in Porteus-1.2.

[HOWTO] Connect faster while using NetworkManager

Here are two tips how to connect faster while using NetworkManager.
Credits goes to the ArchWiki team.
link

Disabling IPv6

Slow connection or reconnection to the network may be due to superfluous IPv6 queries in NetworkManager. If there is no IPv6 support on the local network, connecting to a network may take longer than normal while Network Manager tries to establish an IPv6 connection that eventually times out. The solution is to disable IPv6 within NetworkManager which will make network connection faster. This has to be done once for every network you connect to.

Right-click on the network status icon.
Click on "Edit Connections".
Go to the "Wired" or "Wireless" tab, as appropriate.
Select the name of the network.
Click on "Edit".
Go to the "IPv6 Settings" tab.
In the "Method" dropdown, choose "Ignore".
Click on "Save".

Speed up DHCP by disabling ARP probing in dhcpcd

dhcpcd contains an implementation of a recommendation of the DHCP standard (RFC2131 section 2.2) to check via ARP if the assigned IP address is really not taken. This seems mostly useless in home networks, so you can save about 5 seconds on every connect by adding the following line to /etc/dhcpcd.conf:

noarp

This is equivalent to passing --noarp to dhcpcd, and disables the described ARP probing, speeding up connections to networks with DHCP.

[SCRIPT] Module creator for Smartlink modems

 

NOTE:  This script is written for Porteus V1.0

Cut + paste main code below and save as 'slmodem.pbuild'

Make it executable: chmod +x slmodem.pbuild

Run the script: ./slmodem.pbuild

 


#!/bin/bash
#
# slmodemd package for Smartlink Modems
# Download both packages (slmodem and ungrab-winmodem) with wget, ncomment if internet
# connection is not present put a "#" before wget commands
#
#wget http://linmodems.technion.ac.il/packages/smartlink/slmodem-2.9.11-20110321.tar.gz
#sleep 2
#wget http://linmodems.technion.ac.il/packages/smartlink/ungrab-winmodem-20090716.tar.gz
#sleep 2
PKG=slmodem-2.9.11-20110321
TMP=/tmp/slmodem$$
PKG2=ungrab-winmodem-20090716
TMP2=/tmp/ungrab-winmodem$$

#set -e

tar -zxvf $PKG*
tar -zxvf $PKG2*
# copy rc.slmodemd fromm script/slackware packages and make changes to work in porteus
cd $PKG/scripts/slackware/
sed -i '8 s|/dev/slusb0|/dev/slamr0|g' rc.slmodemd
sed -i '8 a /sbin/depmod -a' rc.slmodemd
sed -i '9 a sleep 3' rc.slmodemd
sed -i '13 a if !  -e $SLMODEMD_DEVICE  &> /dev/null; then \' rc.slmodemd
sed -i '14 a {\' rc.slmodemd
sed -i '15 a \\t mkdir -p /dev' rc.slmodemd
sed -i '16 a \\t mknod -m 600 /dev/slamr0 c 242 0 ; mknod -m 600 /dev/slamr1 c 242 1 ;' rc.slmodemd
sed -i '17 a \\t mknod -m 600 /dev/slamr2 c 242 2 ; mknod -m 600 /dev/slamr3 c 242 3 ;' rc.slmodemd
sed -i '18 a \\t echo -n' rc.slmodemd
sed -i '19 a \\t mknod -m 600 /dev/slusb0 c 243 0 ; mknod -m 600 /dev/slusb1 c 243 1 ;' rc.slmodemd
sed -i '20 a \\t mknod -m 600 /dev/slusb2 c 243 2 ; mknod -m 600 /dev/slusb3 c 243 3 ;' rc.slmodemd
sed -i '21 a \\t echo -n ||' rc.slmodemd
sed -i '22 a \\t {' rc.slmodemd
sed -i '23 a \\t echo "failed."' rc.slmodemd
sed -i '24 a \\t exit -1' rc.slmodemd
sed -i '25 a \\t }' rc.slmodemd
sed -i '26 a }' rc.slmodemd
sed -i '27 a fi' rc.slmodemd
sed -i '28 a\' rc.slmodemd
sed -i '28 a \\t cat /proc/modules | grep 'ungrab_winmodem' >/dev/null ||' rc.slmodemd
sed -i '29 a \\t {' rc.slmodemd
sed -i '30 a \\t echo -n "Ungrabbing winmodem from kernel ... "' rc.slmodemd
sed -i '31 a \\t modprobe ungrab-winmodem && echo "done." ||' rc.slmodemd
sed -i '32 a \\t {' rc.slmodemd
sed -i '33 a \\t echo "failed."' rc.slmodemd
sed -i '34 a \\t exit -1' rc.slmodemd
sed -i '35 a \\t }' rc.slmodemd
sed -i '36 a \\t }' rc.slmodemd
sed -i '37 a \\t cat /proc/modules | grep 'slamr' >/dev/null ||' rc.slmodemd
sed -i '38 a \\t {' rc.slmodemd
sed -i '39 a \\t echo -n "Loading SmartLink Modem driver into kernel ... "' rc.slmodemd
sed -i '40 a \\t modprobe slamr && echo "done." ||' rc.slmodemd
sed -i '41 a \\t {' rc.slmodemd
sed -i '42 a \\t echo "failed."' rc.slmodemd
sed -i '43 a \\t exit -1' rc.slmodemd
sed -i '44 a \\t }' rc.slmodemd
sed -i '45 a \\t }' rc.slmodemd
# end of long sed expression
mkdir -p $TMP/etc/rc.d/
cp rc.slmodemd $TMP/etc/rc.d/
chmod +x $TMP/etc/rc.d/rc.slmodemd
cd ..
cd ..
# return to base directory
sleep 3

make KERNEL_DIR=/lib/modules/`uname -r`/build
make all
make install DESTDIR=$TMP
sleep 3
cd ..

# take care of ungrab-winmodem
cd $PKG2
make
make install
mkdir -p $TMP/lib/modules/`uname -r`/extra
cp -ra /lib/modules/`uname -r`/extra/ungrab-winmodem.ko $TMP/lib/modules/`uname -r`/extra
sleep 5
rm -Rf $TMP2

# delete slamr.ko and ungrab-winmodem.ko
rm -rf /lib/modules/`uname -r`/extra/slamr.ko
rm -rf /lib/modules/`uname -r`/extra/ungrab-winmodem.ko

# copy build script
cd ..
mkdir -p $TMP/usr/src/pbuilds/
cp $0 $TMP/usr/src/pbuilds/
find $TMP -type d | xargs chmod -v 755
find $TMP | grep .gz | xargs gunzip
find $TMP | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded

dir2xzm $TMP $PKG.xzm
rm -Rf $TMP
rm -Rf $PKG
rm -Rf $PKG2
chmod 755 $PKG.xzm

[SCRIPT] Make module for Agere Pinball modems agrsm06pci

Note:  This script is for Porteus V 1.0.

You'll need to download the source file for the driver (agrsm06pci).  As of 06/15/2011, it could be found here.

Cut + paste main code below and save as: agrsm06pci.pbuild

Make it executable: chmod +x agrsm06pci.pbuild

Run the script: ./agrsm06pci.pbuild

Note:  It should be run in the same directory as the tar.gz source file.

#!/bin/sh

# porteus build script for agrsm06pci

CWD=$PWD

ARCH=$(uname -m)
ARCH=${ARCH:-i486}

TMP=/tmp/packages
PKG=$TMP/_pkg_

#get ready when slax's gonna change the module's extension
#just like slackware did since version 13

pkgext=xzm
#SLAXMAJOR=$(awk '{print $2}' /etc/slax-version | cut -d'.' -f1)
#don't know yet what it's gonna be
#if [ $SLAXMAJOR -ge 7 ]; then
# pkgext=lzm
#fi

#archive expected in format agrsm06pci-*.tar.gz
if [ $(ls agrsm06pci-*.tar.gz 2>/dev/null | wc -l) -ne 1 ]; then
echo "couldn't find the source archive"
exit 1
fi
archive=$(ls agrsm06pci-*.tar.gz)

src=$(tar tf $archive| head -n1 | tr -d \/)

VERSION=$(echo ${archive%.tar.gz} | sed 's?^agrsm06pci-??' | \
sed 's?-[a-z]\{3,\}$??' | sed 's?-?_?g')

LIB=""
case "$ARCH" in
i386) CFLAGS="-O3 -march=i386 -mcpu=i686";;
i486) CFLAGS="-O3 -march=i486 -mtune=i686";;
i686) CFLAGS="-O3 -march=i686 -mtune=i686";;
athlon-xp) CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer";;
x86_64) CFLAGS="-O3"; LIB=64;;
esac

#should we include the architexture in the name?
#MODNAME=agrsm06pci-${VERSION}-$ARCH.$pkgext
MODNAME=agrsm06pci-$VERSION.$pkgext

description()
{
cat < /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null

}

generatelist()
{
(cd $PKG
LIST=$PKG/usr/src/slaxbuilds/agrsm06pci/pkglist.txt
rm -f $LIST
find * | while read f
do
if [ -d "$f" ]; then
echo "${f}/" >> $LIST
fi
if [ -L "$f" ]; then
echo "$f -> $(readlink -n $f)" >> $LIST
elif [ ! -d "$f" ]; then
echo "$f" >> $LIST
fi
done
)
}

if [ -e $TMP ]; then
rm -Rf $TMP/*
fi
mkdir -p $TMP

cd $TMP

tar zxvf $CWD/$archive || exit 1

cd $src || exit 1

# permissions || exit 1

#make module || exit 1
make || exit 1

clear

mkdir -p $PKG
#make install || exit 1
./agrinst || exit 1

mkdir -p $PKG/usr/lib/AgereSoftModem
cp AgereMdmDaemon $PKG/usr/lib/AgereSoftModem/
mkdir -p $PKG/lib/modules/`uname -r`/kernel/drivers/char/
cp /lib/modules/`uname -r`/kernel/drivers/char/agr* $PKG/lib/modules/`uname -r`/kernel/drivers/char/
mkdir -p $PKG/etc/rc.d/
cp agr_softmodem $PKG/etc/rc.d/rc.agr_softmodem
chmod +x $PKG/etc/rc.d/rc.agr_softmodem
depmod -a

strip

#normally this is not necessary
(cd $PKG/usr
if [ -d share/man ]; then
mv share/man .
fi
)
(cd $PKG/usr
if [ -d share/doc ]; then
mv share/doc .
fi
)

#we might want to copy README* LICENCE etc to $PKG/usr/doc/agrsm06pci-$VERSION
mkdir -p $PKG/usr/doc/agrsm06pci-$VERSION
cp README* LICENSE $PKG/usr/doc/agrsm06pci-$VERSION

# copy this script and some info to /usr/src/pbuilds/agrsm06pci
mkdir -p $PKG/usr/src/pbuilds/agrsm06pci

cp $CWD/agrsm06pci.pbuild $PKG/usr/src/pbuilds/agrsm06pci

description > $PKG/usr/src/puilds/agrsm06pci/readme.txt

generatelist

clear
echo
cd $CWD
rm -f $MODNAME

# use this one if you are using Slax 6.1.X
#mksquashfs $PKG $MODNAME -b 256K -lzmadic 256K || exit 33
#Use this one if you are using Porteus
dir2xzm $PKG $MODNAME
chmod a-wx $MODNAME
chmod a+r $MODNAME

echo
echo " agrsm06pci"
echo
description
echo
echo "module $MODNAME successfully created in $CWD"
echo
echo "removing stuff from install"
rm -rf /usr/lib/AgereSoftModem/
rm -rf /lib/modules/`uname -r`/kernel/drivers/char/agr*

rm -Rf $TMP/*

[SCRIPT] Make module for PCTEL modems

Pctel Modems have linux drivers see this page for more information

http://linmodems.technion.ac.il/package ... lcome.html

If you see the welcome page above, you will see I participated a bit in the helping of getting the driver to work, but if it were not for Porteus & community, it would not have been possible either, I tested code without being harmed.

NOTE:  This script has been written for Porteus V1.0

Copy + paste main code and save as pctel.pbuild.sh

Make it executable with: chmod +x pctel.pbuild.sh

Change into the folder and run script with: ./pctel.pbuild.sh

 

bash-4.1# cat pctel.pbuild
#!/bin/bash

PKG=pctel-0.9.7-9-rht-11
TMP=/tmp/pctel-$$

# download the source from linmodems page, uncomment if you want to download pctel source
#wget http://linmodems.technion.ac.il/packages/pctel/pctel-0.9.7-9-rht-11.tar.gz
#set -e

tar -zxvf $PKG*
sleep 2;
cd $PKG/src
sed -i '88 a #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)' linmodem-2.6.c
sed -i '90 a #else' linmodem-2.6.c
sed -i '91 a static DEFINE_SEMAPHORE(linmodem_sem);' linmodem-2.6.c
sed -i '92 a #endif' linmodem-2.6.c
sed -i '1207 a #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)' linmodem-2.6.c
sed -i '1209 a #else' linmodem-2.6.c
sed -i '1210 a static DEFINE_SEMAPHORE(serial_sem);' linmodem-2.6.c
sed -i '1211 a #endif' linmodem-2.6.c
sleep 3;

# run ./configure -auto for the type of modem you have
# you can have pct789,,,cm8738, i8xx, sis, via686a
./configure -auto # otherwise change this to your modem type :)
make
make install DESTDIR=$TMP
#mkdir -p $TMP/lib/modules/`uname -r`/misc/
#cp -ra /lib/modules/`uname -r`/misc/*.ko $TMP/lib/modules/`uname -r`/misc/
mkdir -p $TMP/etc/udev/rules.d/
echo "KERNEL==\"ttyS_PCTEL0\", SYMLINK=\"modem\"" > $TMP/etc/udev/rules.d/70-pctel.rules
sleep 3
rm -rf /lib/modules/`uname -r`/misc/pctel.o
rm -rf /lib/modules/`uname -r`/misc/ptserial.o
sleep 3
cd ../../

mkdir -p $TMP/etc/rc.d/
echo "#!/bin/bash " >> $TMP/etc/rc.d/rc.pctel
echo "#==========================================================" >> $TMP/etc/rc.d/rc.pctel
echo "# Startup script for PCTEL modem modules " >> $TMP/etc/rc.d/rc.pctel
echo "# " >> $TMP/etc/rc.d/rc.pctel
echo "# copied from http://kristol.org/david/dell-i8200/#pctel " >> $TMP/etc/rc.d/rc.pctel
echo "# and modified for Slax Linux Live/Porteus LiveCD by " >> $TMP/etc/rc.d/rc.pctel
echo "# Antonio A. Olivares " >> $TMP/etc/rc.d/rc.pctel
echo "# This email address is being protected from spambots. You need JavaScript enabled to view it., This email address is being protected from spambots. You need JavaScript enabled to view it. " >> $TMP/etc/rc.d/rc.pctel
echo "#==========================================================" >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "/sbin/depmod -a " >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "if [-e /dev/modem] &> /dev/null; then" >> $TMP/etc/rc.d/rc.pctel
echo " { " >> $TMP/etc/rc.d/rc.pctel
echo " echo \"Linking /dev/ttyS_PCTEL0 to /dev/modem to let kppp access modem\" " >> $TMP/etc/rc.d/rc.pctel
echo " ln -s /dev/ttyS_PCTEL0 /dev/modem " >> $TMP/etc/rc.d/rc.pctel
echo " } " >> $TMP/etc/rc.d/rc.pctel
echo "fi " >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo "# See how we were called. " >> $TMP/etc/rc.d/rc.pctel
echo " case \"\$1\" in " >> $TMP/etc/rc.d/rc.pctel
echo " start) " >> $TMP/etc/rc.d/rc.pctel
echo " echo -n \"Starting pctel . . .\" " >> $TMP/etc/rc.d/rc.pctel
echo " modprobe linmodem" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe pctel" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe pctel_hw" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"done\" " >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " stop)" >> $TMP/etc/rc.d/rc.pctel
echo " echo -n \"Shutting down pctel . . .\"" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r pctel" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r pctel_hw" >> $TMP/etc/rc.d/rc.pctel
echo " modprobe -r linmodem" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"done\"" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " status)" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " restart)" >> $TMP/etc/rc.d/rc.pctel
echo " \$0 stop" >> $TMP/etc/rc.d/rc.pctel
echo " \$0 start" >> $TMP/etc/rc.d/rc.pctel
echo " ;;" >> $TMP/etc/rc.d/rc.pctel
echo " *)" >> $TMP/etc/rc.d/rc.pctel
echo " echo \"Usage: pctel {start|stop|restart|status}\" " >> $TMP/etc/rc.d/rc.pctel
echo " exit 1" >> $TMP/etc/rc.d/rc.pctel
echo " esac" >> $TMP/etc/rc.d/rc.pctel
echo " " >> $TMP/etc/rc.d/rc.pctel
echo " exit 0" >> $TMP/etc/rc.d/rc.pctel
chmod +x $TMP/etc/rc.d/rc.pctel

# copy build script
mkdir -p $TMP/usr/src/pbuilds/
cp $0 $TMP/usr/src/pbuilds/
find $TMP -type d | xargs chmod -v 755
find $TMP | grep .gz | xargs gunzip
find $TMP | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded


dir2xzm $TMP $PKG.xzm
rm -Rf $TMP
rm -Rf $PKG
chmod 755 $PKG.xzm

Thanks Tonio !!