Hi,

WIRELESS:
Not sure if anybody is interested...

Added wireless networking to my LFS box and to my surprise  ;-) it worked.

Attached is:
ipv-wireless which goes into /etc/sysconfig/network-devices/services
wireless which goes into /etc/sysconfig/network-device/ifconfig-wlan0
and my build script to show the make and make install options for wireless_tools.

Prerequisites are:
wireless_tools from http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
either madwifi from http://madwifi.sourceforge.net/
or acx100 from http://acx100.sourceforge.net/

The acx100 drivers don't work on X86_64 machines and don't like SMP machines.
madwifi should work on both; I don't yet have one of these cards.

The build instructions for the acx100 driver are
./Configure && make && make install && /sbin/depmod -ae $(uname -r) -F /lib/modules/$(uname -r)/build/System.map

DHCP:
One useful start option to the dhcpcd server is "-h $(hostname)" to push hostname up to the DHCP server.

Regards,
Duncan
#!/bin/sh 
########################################################################
# Begin $network_devices/services/ipv4-wireless
#
# Description : IPV4 Wireless Script
#
# Authors     : Duncan Webb - duncan at linuxowl dot com
#
# Version     : 00.00
#
# Notes       : 
#
########################################################################

. /etc/sysconfig/rc 
. ${rc_functions} 
. ${IFCONFIG}

RETVAL=1
DEVICE=$1
UP_DOWN=$2
PIDFILE="/var/run/dhcpcd-$1.pid"
LEASEINFO="/var/lib/dhcpc/dhcpcd-$1.info"

# some basic check
if [ "${MODULE}" = "" ]; then exit 1; fi
if [ ! -e "/lib/modules/$(uname -r)/net/${MODULE}.ko" ]; then exit 1; fi
if [ "${DEVICE}" = "" ]; then exit 1; fi
if [ ! -d ${FIRMWARE_DIR} ]; then exit 1; fi
if [ -z ${PREFIX} ]; then PREFIX=24; fi

case "${UP_DOWN}" in
    ("up")
    modprobe ${MODULE} debug=${DEBUG} firmware_dir=${FIRMWARE_DIR}
    iwconfig ${DEVICE} rate ${RATE}
    iwconfig ${DEVICE} channel ${CHANNEL}
    iwpriv ${DEVICE} SetSPreamble ${SHORT_PREAMBLE}
    iwconfig ${DEVICE} txpower ${TXPOWER}
    iwconfig ${DEVICE} essid ${ESSID}
    iwconfig ${DEVICE} mode ${MODE}
    iwconfig ${DEVICE} key Open ${KEY1} [1]
    iwconfig ${DEVICE} key Open ${KEY2} [2]
    iwconfig ${DEVICE} key Open ${KEY3} [3]
    iwconfig ${DEVICE} key Open ${KEY4} [4]
    iwconfig ${DEVICE} key Open ${KEY}
    iwpriv ${DEVICE} SetLEDPower ${LED_POWER}
    #ifconfig ${DEVICE} up
    #ip addr add ${args} dev ${DEVICE}
    if [ "${IP}" != "" ]; then
        #ifconfig ${DEVICE} ${IP} netmask ${NETMASK}
        ip addr add ${IP}/${PREFIX} dev ${DEVICE}
        if [ "${GATEWAY}" != "" ]; then
            ip route add default via ${GATEWAY} dev ${DEVICE}
        fi
    else
        dhcpcd ${DHCP_START} -d ${DEVICE} -t 5 > /dev/null 2>&1
        RETVAL="$?"
        if [ "${RETVAL}" != "0" ]; then
            #ifconfig ${DEVICE} ${IP_FALLBACK} netmask ${NETMASK}
            ip addr add ${IP_FALLBACK}/${PREFIX} broadcast ${BROADCAST} dev 
${DEVICE}
            RETVAL="$?"
            if [ "${GATEWAY}" != "" ]; then
                #route add default gw ${GATEWAY} ${DEVICE}
                ip route add default via ${GATEWAY} dev ${DEVICE}
            fi
        fi
        # Print the assigned settings if requested
        if [ "${RETVAL}" = "0" -a "$PRINTIP" = "yes" ]; then
            . ${LEASEINFO}
            if [ "$PRINTALL" = "yes" ]; then
                echo_ok
                boot_mesg "    DHCP Assigned Settings for $1:"
                boot_mesg_flush
                boot_mesg "    IP Address:      $IPADDR"
                boot_mesg_flush
                boot_mesg "    Subnet Mask:     $NETMASK"
                boot_mesg_flush
                boot_mesg "    Default Gateway: $GATEWAY"
                boot_mesg_flush
                boot_mesg "    DNS Server:      $DNS"
                boot_mesg_flush
            else
                boot_mesg "    IP Addresss: $IPADDR"
                echo_ok
            fi
        else
            $(exit "${RETVAL}")
            evaluate_retval
        fi
    fi
    #ifconfig ${DEVICE} mtu ${MTU}
    ip link set ${DEVICE} mtu ${MTU} 
    ;;

    ("down")
    #ifconfig ${DEVICE} down
    if [ "${IP}" == "" ]; then
        #boot_mesg -n "Stopping dhcpcd on the $1 interface..."
        if [ -e $LEASEINFO ]; then
            . $LEASEINFO
            dhcpcd ${DHCP_STOP} -d ${DEVICE}
            RETVAL="$?"
            if [ "${RETVAL}" -eq 0 ]; then
                echo_ok
            elif [ "${RETVAL}" -eq 1 ]; then
                boot_mesg "dhcpcd not running!" ${WARNING}
                echo_warning
            else
                echo_failure
            fi
        else
            boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
            boot_mesg "dhcpcd is not running!" ${WARNING}
            echo_warning
            exit 1
        fi
    else
        echo ""
        killproc dhcpcd
    fi
    ;;

    (*)
        echo "Usage: ${0} [interface] {up|down}"
        exit 1
    ;;
esac

exit ${RETVAL}
ONBOOT="yes"
SERVICE="ipv4-wireless"
DHCP_START="-h $(hostname)"
DHCP_STOP="-k "
PRINTIP="yes"
PRINTALL="no"

#modprobe.conf stuff
#alias wlan0 acx_pci
#options acx_pci debug=0x000b firmware_dir=/lib/firmware
MODULE="acx_pci"
DEBUG=0x0000
FIRMWARE_DIR="/lib/firmware"

DEVICE=wlan0
RATE=auto
CHANNEL=1
SHORT_PREAMBLE=1
TXPOWER=18
ESSID="My ESSID"
#MODE=Managed
#MODE=Auto
MODE=Ad-Hoc
#ALG=restricted
ALG=open
KEY1="1234567890"
KEY2="2345678901"
KEY3="3456789012"
KEY4="4567890123"
#KEY="[1]"
KEY="off"
USE_DHCP=0
#IP=192.168.2.2 #use dhcpcd instead
IP_FALLBACK=192.168.2.253
#NETMASK=255.255.255.0
PREFIX=24
GATEWAY=192.168.2.1
LED_POWER=0
MTU=576
red="\033[01;31m"
green="\033[01;32m"
yellow="\033[01;33m"
blue="\033[01;34m"
function message () {
  colour=${2:-${green}}
  normal="\033[00m"
  title_begin="\033]0;"
  title_end="\007"
  if [ "${TERM}" != "linux" ]; then
    echo -en "${title_begin}$1${title_end}"
  fi
  echo -e "${colour}* $1${normal}"
}
installdir=/sources/Installed/ &&
installname=$(basename `pwd`) &&
if [ ! -d ${installdir} ]; then mkdir -p ${installdir}; fi
pushd . &&
message "Running make" &&
make PREFIX=/usr INSTALL_DIR=/sbin INSTALL_MAN=/usr/share/man &&
message "Press enter when ready to install" ${yellow} &&
read ENTER &&
message "Finding files before installing ${installname}" &&
(find /bin /etc /lib /opt /sbin /usr /var -depth -print 2> /dev/null > 
.before-${installname}) &&
message "Running make install" &&
make PREFIX=/usr INSTALL_DIR=/sbin INSTALL_MAN=/usr/share/man install &&
message "Finding files after installing ${installname}" &&
(find /bin /etc /lib /opt /sbin /usr /var -depth -print 2> /dev/null > 
.after-${installname}) &&
echo "${installname} built on $(date +"%d.%b.%Y %H:%M")" >> 
${installdir}${installname} &&
if ! diff .before-${installname} .after-${installname} | grep '>' >> 
${installdir}${installname}; then
  echo "No additions" >> ${installdir}${installname}
fi &&
rm -f .before-${installname} .after-${installname} &&
message "Running make clean" &&
make clean &&
message "Running ldconfig" &&
/sbin/ldconfig &&
message "Changing permissions" &&
chown -R root:root . &&
popd &&
cat ${installdir}${installname} &&
message "DONE\007"
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to