From: gobo72 Date: Thu, 10 Mar 2011 17:34:55 +0000 (+0000) Subject: Finalisation Wifi selon tests concluants du HP-Mini X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=e8cc14e96c051666130d201fa5c60291a881e008;p=hvlinux.git Finalisation Wifi selon tests concluants du HP-Mini --- diff --git a/config/packages-list b/config/packages-list index 4ec3513..b1a89f1 100644 --- a/config/packages-list +++ b/config/packages-list @@ -82,6 +82,7 @@ FFMPEG="ffmpeg-svn-20539" FIREFOX="firefox-3.6.13" FILE_PKG="file-5.04" FINDUTILS="findutils-4.4.2" +FIRMWARE_B43_LPPHY="broadcom-wl-4.178.10.4" FLAC="flac-1.2.1" FLEX="flex-2.5.35" FONTCONFIG="fontconfig-2.7.3" diff --git a/config/sysinfos.default b/config/sysinfos.default index 88ea103..2bc1701 100644 --- a/config/sysinfos.default +++ b/config/sysinfos.default @@ -44,6 +44,10 @@ DVDROM="yes" # Sound card support: yes or no SOUND_CARD="yes" +# Wifi support +#WIFI_SUPPORT="no" +#FIRMWARE_B43_LPPHY="yes" + # Keyboard mapping (example: us, cf) KEYBOARD="us" diff --git a/config/sysinfos.hp-mini b/config/sysinfos.hp-mini index b8586b6..2cd2ff8 100644 --- a/config/sysinfos.hp-mini +++ b/config/sysinfos.hp-mini @@ -26,8 +26,11 @@ XORG_VIDEO_DRIVER="intel" # Removable media drives. Comment if your system doesn't have one. DVDROM="no" +WIFI_SUPPORT="yes" +FIRMWARE_B43_LPPHY="yes" + # General network settings -INTERFACES="eth0" +INTERFACES="eth0 wlan0" MACHINE_NAME="gresimuth" DOMAIN="mongol.com" LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3 @@ -35,5 +38,8 @@ LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3 # Network interface card eth0 settings BOOTPROTO[0]="dhcp" +# Network interface card wlan0 settings +BOOTPROTO[1]="wifi" + # Samba support USE_SAMBA="no" diff --git a/stage2/bootscripts/ifdown b/stage2/bootscripts/ifdown index 115c488..a6fabf9 100755 --- a/stage2/bootscripts/ifdown +++ b/stage2/bootscripts/ifdown @@ -24,14 +24,13 @@ check_brctl() } # First make sure interface is available -if ! ip link show ${DEVICE} ; then +if ! ip link show ${DEVICE} 1> /dev/null 2>&1 ; then echo "Interface ${DEVICE} not available" exit ${EXIT_CODE_WARNING} fi -if [ "x${BOOTPROTO}" = "xdhcp" ]; then +if [ "x${BOOTPROTO}" = "xdhcp" -o "x${BOOTPROTO}" = "xwifi" ]; then # DHCP configuration - # Load DHCP client parameters source /etc/sysconfig/network/dhcp-client @@ -42,17 +41,21 @@ if [ "x${BOOTPROTO}" = "xdhcp" ]; then cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || exit ${EXIT_CODE_FAILURE} elif [ x${BOOTPROTO} = "xstatic" ]; then # Static configuration - cmd_run_log ip addr flush ${DEVICE} && - cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} + cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE} elif [ x${BOOTPROTO} = "xpppoe" ]; then # PPPoE configuration cmd_run_log pppoe-stop - cmd_run_log ip addr flush ${DEVICE} && - cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} + cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE} else exit 1 fi +if [ "x${BOOTPROTO}" = "xwifi" ]; then + killall wpa_supplicant +fi + +cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} + # Determining if the interface is part of a bridge: if [ -n "${BRIDGE_TO}" ]; then check_brctl diff --git a/stage2/bootscripts/ifup b/stage2/bootscripts/ifup index b8fc5e8..b363046 100755 --- a/stage2/bootscripts/ifup +++ b/stage2/bootscripts/ifup @@ -23,23 +23,54 @@ check_brctl() fi } -# First make sure interface is available -if ! ip link show ${DEVICE} ; then - echo "Interface ${DEVICE} not available" +# Make sure interface is available +if ! ip link show ${DEVICE} > /dev/null 2>&1; then + echo "Interface ${1} not found" exit ${EXIT_CODE_WARNING} fi # Determining if the interface is a bridge: if [ "x${BRIDGE}" = "xyes" ]; then check_brctl - cmd_run_log ${BRCTL} addbr ${1} && - cmd_run_log ${BRCTL} stp ${1} off || exit 1 + cmd_run_log ${BRCTL} addbr ${DEVICE} && + cmd_run_log ${BRCTL} stp ${DEVICE} off || exit 1 fi # Determining if the interface is part of a bridge: if [ -n "${BRIDGE_TO}" ]; then check_brctl - cmd_run_log ${BRCTL} addif ${BRIDGE_TO} ${1} || exit 1 + cmd_run_log ${BRCTL} addif ${BRIDGE_TO} ${DEVICE} || exit 1 +fi + +if [ "x${BOOTPROTO}" = "xwifi" ]; then + # Bring interface up + link_status=$(ip link show ${DEVICE}) + if [ -n "${link_status}" ]; then + if ! echo "${link_status}" | grep -q UP; then + cmd_run_log ip link set ${DEVICE} up + fi + fi + + if [ -f /var/run/wpa_supplicant/${DEVICE} ]; then + echo "Stopping previous wpa_supplicant" + killall wpa_supplicant + rm /var/run/wpa_supplicant/${DEVICE} + fi + + wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 + count=0 + while ! wpa_cli -i wlan0 status | grep "wpa_state=COMPLETED"; do + echo "Waiting for wpa_supplicant to complete" + sleep 1 + + let count=count+1 + if [ $count -gt 10 ]; then + echo "wpa_supplicant failure" + exit ${EXIT_CODE_WARNING} + fi + done + + BOOTPROTO=dhcp fi if [ "x${BOOTPROTO}" = "xdhcp" ]; then diff --git a/stage2/hv-install-2 b/stage2/hv-install-2 index 12de7aa..7b4c8ad 100755 --- a/stage2/hv-install-2 +++ b/stage2/hv-install-2 @@ -36,9 +36,17 @@ ipkg ${UDEV} ipkg -m noac ${UDEV_CONFIG} ipkg ${GRUB} ipkg -m acnb ${DHCP} -PREFIX=/usr ipkg -m noac -s wireless-tools ${WIRELESS_TOOLS} -ipkg -m noac ${WPA_SUPPLICANT} -PREFIX=/usr ipkg -m noac ${B43_FWCUTTER} + +if [ -n "${WIFI_SUPPORT}" ]; then + PREFIX=/usr ipkg -m noac -s wireless-tools ${WIRELESS_TOOLS} + ipkg -m noac ${WPA_SUPPLICANT} + + if [ -n "${FIRMWARE_B43_LPPHY}" ]; then + PREFIX=/usr ipkg -m noac ${B43_FWCUTTER} + ipkg -s firmware-b43-lpphy ${FIRMWARE_B43_LPPHY} + fi +fi + ipkg ${NANO} rscr once "Installing HV-utilities" install-hv-utilities diff --git a/stage2/install-bootscripts b/stage2/install-bootscripts index f0a45a3..63415ee 100755 --- a/stage2/install-bootscripts +++ b/stage2/install-bootscripts @@ -22,7 +22,8 @@ for nic_device in ${INTERFACES}; do echo "IFSCOPE=\"\"" >> ${file} echo "GATEWAY=\"${GATEWAY[${LOOP_INDEX}]}\"" >> ${file} - if [ "x${BOOTPROTO[${LOOP_INDEX}]}" = "xdhcp" ]; then + if [ "x${BOOTPROTO[${LOOP_INDEX}]}" = "xdhcp" -o \ + "x${BOOTPROTO[${LOOP_INDEX}]}" = "xwifi" ]; then DHCP_USED="yes" fi diff --git a/stage2/misc/wireless b/stage2/misc/wireless deleted file mode 100755 index c48ce2d..0000000 --- a/stage2/misc/wireless +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $network_devices/services/wireless -# -# Description : Wireless Handler -# -# Authors : Joe Ciccone - joeciccone@crazyeyesoft.com -# -# Version : 00.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} -. ${IFCONFIG} - -if [ ! -d "${network_devices}/ssid" ]; then - boot_mesg "${network_devices}/ssid does not exist, cannot continue." ${FAILURE} - echo_failure - exit 1 -fi - -case "${2}" in - up) - if [ "${ESSID}" = "scan" ]; then - for wnet in `iwlist ${1} scan | grep ESSID | cut -d: -f2 | cut -d'"' -f2` \ - `iwlist ${1} scan | grep Address | awk '{print $5}'`; do - if [ -f "${network_devices}/ssid/${wnet}" ]; then - ESSID=${wnet} - break - fi - done - fi - - if [ -n "${OVERRIDE_ESSID}" ]; then - ESSID=${OVERRIDE_ESSID} - fi - - if [ "${ESSID:-scan}" = "scan" ]; then - boot_mesg "Could not find a configurable ssid for ${1}, cannot continue." ${FAILURE} - echo_failure - exit 1 - else - if [ ! -f "${network_devices}/ssid/${ESSID}" ]; then - boot_mesg "Unable to open ${network_devices}/ssid/${ESSID}, cannot continue." ${FAIURE} - echo_failure - exit 1 - fi - source ${network_devices}/ssid/${ESSID} - fi - - args1="essid ${ESSID}" - - if [ -n "${MODE}" ]; then - args1="${args1} mode ${MODE}" - fi - - if [ -n "${FREQ}" ]; then - args1="${args1} freq ${FREQ}" - fi - - if [ -n "${RATE}" ]; then - args1="${args1} rate ${RATE}" - fi - - boot_mesg "Configuring ${1} for essid ${ESSID}" - iwconfig ${1} ${args1} - evaluate_retval - - boot_mesg "Setting up ${TYPE} on ${1} ..." - case "${TYPE}" in - wep) - args2="" - if [ -n "${KEY1}" ]; then - args2="key ${KEY1}" - fi - - if [ -n "${KEY2}" ]; then - args2="${args2} key ${KEY2}" - fi - - if [ -n "${KEY3}" ]; then - args2="${args2} key ${KEY3}" - fi - - if [ -n "${KEY4}" ]; then - args2="${args2} key ${KEY4}" - fi - - iwconfig ${1} ${args2} - evaluate_retval - ;; - wpa) - wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -i${1} - ;; - *) - boot_mesg "Unknown Type ${TYPE}, cannot continue." ${FAILURE} - echo_failure - exit 1 - ;; - esac - evaluate_retval - ;; - - down) - ;; - - *) - echo "Usage: ${0} [interface] {up|down}" - exit 1 - ;; -esac - -# End $network_devices/services/wireless diff --git a/stage2/packages-update b/stage2/packages-update index bfe5154..479ffb8 100755 --- a/stage2/packages-update +++ b/stage2/packages-update @@ -66,10 +66,17 @@ fpkg -m gnu ${AUTOMAKE} fpkg -m gnu ${GROFF} fpkg ${IPROUTE2} \ "http://devresources.linux-foundation.org/dev/iproute2/download" -fpkg -e "tar.gz" ${WIRELESS_TOOLS} \ - "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux" -fpkg -e "tar.gz" ${WPA_SUPPLICANT} "http://hostap.epitest.fi/releases" -fpkg ${B43_FWCUTTER} "http://bu3sch.de/b43/fwcutter" + +if [ -n "${WIFI_SUPPORT}" ]; then + fpkg -e "tar.gz" ${WIRELESS_TOOLS} \ + "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux" + fpkg -e "tar.gz" ${WPA_SUPPLICANT} "http://hostap.epitest.fi/releases" + + if [ -n "${FIRMWARE_B43_LPPHY}" ]; then + fpkg ${B43_FWCUTTER} "http://bu3sch.de/b43/fwcutter" + fpkg ${FIRMWARE_B43_LPPHY} "http://downloads.openwrt.org/sources" + fi +fi fpkg -s "linux/utils/kbd" ${KBD} ${KERNEL_URL} fpkg -e "tar.gz" ${LESS} "http://www.greenwoodsoftware.com/less" @@ -83,3 +90,4 @@ fpkg -e "tar.gz" ${GRUB} "ftp://alpha.gnu.org/gnu/grub" fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history" exit $? + diff --git a/stage2/pkg/firmware-b43-lpphy b/stage2/pkg/firmware-b43-lpphy new file mode 100644 index 0000000..fe05de2 --- /dev/null +++ b/stage2/pkg/firmware-b43-lpphy @@ -0,0 +1,10 @@ +#!/bin/bash + +hvbuild() +{ + local FIRMWARE_INSTALL_DIR="/lib/firmware" + + cd ${LFS_TMP}/${PACKAGE}/linux + + b43-fwcutter -w ${FIRMWARE_INSTALL_DIR} wl_apsta.o +} diff --git a/stage2/pkg/wireless-tools b/stage2/pkg/wireless-tools index 0d1821a..e72babc 100644 --- a/stage2/pkg/wireless-tools +++ b/stage2/pkg/wireless-tools @@ -8,23 +8,6 @@ hvconfig_pre() hvbuild_post() { + echo "TODO: Configurer ssid" install -d -m755 /etc/sysconfig/network/ssid - - #install -d -m755 /etc/sysconfig/network-devices/ifconfig.ath0 && - #cat > /etc/sysconfig/network-devices/ifconfig.ath0/01-wireless << "EOF" -#ONBOOT=yes -#SERVICE=wireless -#ESSID=scan -#TYPE=wep -#EOF - -#cat > /etc/sysconfig/network/ssid/[ssid] << "EOF" -#MODE=Managed -#KEY1="" -#KEY2="" -#KEY3="" -#KEY4="" -#EOF - - install -v -m740 ${SCRDIR}/misc/wireless /etc/rc.d/init.d }