wireless项目地址:http://www.linuxfromscratch.org/blfs/view/stable-systemd/basicnet/wireless_tools.html
wpa_supplicant项目地址:http://www.linuxfromscratch.org/blfs/view/stable-systemd/basicnet/wpa_supplicant.html
1.使用wget下载wireless包和补丁并校验md5
wget https://hewlettpackard.github.io/wireless-tools/wireless_tools.29.tar.gz wget http://www.linuxfromscratch.org/patches/blfs/8.3/wireless_tools-29-fix_iwlist_scanning-1.patch
md5sum -c md5sums
2.解压wireless包并进入包目录
tar -xvf wireless_tools.29.tar.gz cd wireless_tools.29
3.参照书中说明编译安装
patch -Np1 -i ../wireless_tools-29-fix_iwlist_scanning-1.patch make -j8 make PREFIX=/usr INSTALL_MAN=/usr/share/man install
4.返回blfs-sources目录并删除解压的包目录
cd $LFS/sources/blfs-sources rm -rf wireless_tools
5.下载wpa包的依赖libnl包和补丁包并验证md5
wget http://mirror.fileplanet.com/lfs/pub/blfs/8.3/l/libnl-3.4.0.tar.gz wget http://mirror.fileplanet.com/lfs/pub/blfs/8.3/l/libnl-doc-3.4.0.tar.gz md5sum -c md5sums
6.解压并进入libnl包目录
tar -xvf libnl-3.4.0.tar.gz cd libnl-3.4.0
7.参照书中内容编译安装
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static &&
make -j8 make -j8 check make install mkdir -vp /usr/share/doc/libnl-3.4.0 &&
tar -xf ../libnl-doc-3.4.0.tar.gz --strip-components=1 --no-same-owner \
-C /usr/share/doc/libnl-3.4.0
8.返回blfs-sources目录并删除解压的包目录
cd $LFS/sources/blfs-sources rm -rf libnl-3.4.0
9.下载pciutils并校验md5
wget https://mirrors.edge.kernel.org/pub/software/utils/pciutils/pciutils-3.6.2.tar.xz md5sum -c md5sums
10.解压并进入pciutils包目录
tar -xvf pciutils-3.6.2.tar.xz cd pciutils-3.6.2
11.参照书中说明编译安装
make PREFIX=/usr \
SHAREDIR=/usr/share/hwdata \
SHARED=yes make PREFIX=/usr \
SHAREDIR=/usr/share/hwdata \
SHARED=yes \
install install-lib && chmod -v 755 /usr/lib/libpci.so
12.返回blfs-sources目录并删除解压的包目录
cd $LFS/sources/blfs-sources rm -rf pciutils-3.6.2
13.配置pci自动更新服务脚本
cat > /lib/systemd/system/update-pciids.service << "EOF" &&
[Unit]
Description=Update pci.ids file
Documentation=man:update-pciids()
DefaultDependencies=no
After=local-fs.target
Before=shutdown.target [Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/update-pciids
EOF
cat > /lib/systemd/system/update-pciids.timer << "EOF" &&
[Unit]
Description=Update pci.ids file weekly [Timer]
OnCalendar=Sun ::
Persistent=true [Install]
WantedBy=timers.target
EOF
systemctl enable update-pciids.timer
14.运行命令查看无线网络设备硬件的名字
lspci
15.解压在编译lfs过程中用过的linux内核包,进入linux内核包按照lfs的linux内核编译方法编译内核添加以下配置
[*] Networking support ---> [CONFIG_NET]
[*] Wireless ---> [CONFIG_WIRELESS]
<*/M> cfg80211 - wireless configuration API [CONFIG_CFG80211]
[*] cfg80211 wireless extensions compatibility [CONFIG_CFG80211_WEXT]
<*/M> Generic IEEE 802.11 Networking Stack (mac80211) [CONFIG_MAC80211]
Device Drivers --->
[*] Network device support ---> [CONFIG_NETDEVICES]
[*] Wireless LAN ---> [CONFIG_WLAN]
<*/M>一定要在所选择的项目上面打上m
我的机器是intel7625的无线网卡设备,wireless LAN下没有这个型号,查询其它linux发行版给无线网卡加载的是哪个模块,所以选择了iwlwifi的两个模块
Device Drivers ---> [*] Network device support ---> --- Network device support
[*] Wireless LAN ---> --- Wireless LAN
[ ] ADMtek devices
[ ] Atheros/Qualcomm devices
[ ] Atmel devices
[ ] Broadcom devices
[ ] Cisco devices
[*] Intel devices
< > Intel PRO/Wireless 2100 Network Connection
< > Intel PRO/Wireless 2200BG and 2915ABG Network Connection
< > Intel Wireless WiFi 4965AGN (iwl4965)
< > Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)
<M> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi)
<M> Intel Wireless WiFi DVM Firmware support
<M> Intel Wireless WiFi MVM Firmware support
[ ] Enable broadcast filtering (NEW)
[ ] Enable runtime power management mode for PCIe devices (NEW)
Debugging Options --->
[ ] Intersil devices
[ ] Marvell devices
[ ] MediaTek devices
[ ] Ralink devices
[ ] Realtek devices
[ ] Redpine Signals Inc devices
[ ] STMicroelectronics devices
[ ] Texas Instrument devices
[ ] ZyDAS devices
< > Simulated radio testing tool for mac80211
< > Wireless RNDIS USB support
16.去lfs的固件网站下载所对应的iwlwifi-7265D-22到29区间的固件到/lib/firmware/目录下
cd /lib/firmware/ wget http://anduin.linuxfromscratch.org/BLFS/linux-firmware/iwlwifi-7265D-29.ucode
17.下载wpa包和补丁并校验md5
wget https://w1.fi/releases/wpa_supplicant-2.6.tar.gz wget http://www.linuxfromscratch.org/patches/blfs/8.3/wpa_supplicant-2.6-upstream_fixes-2.patch md5sum -c md5sums
18.解压并进入wpa包目录
tar -xvf wpa_supplicant-2.6.tar.gz cd wpa_supplicant-2.6
19.参照书中内容编译安装
cat > wpa_supplicant/.config << "EOF"
CONFIG_BACKEND=file
CONFIG_CTRL_IFACE=y
CONFIG_DEBUG_FILE=y
CONFIG_DEBUG_SYSLOG=y
CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_WIRED=y
CONFIG_EAP_GTC=y
CONFIG_EAP_LEAP=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_OTP=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TLS=y
CONFIG_EAP_TTLS=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_IPV6=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_READLINE=y
CONFIG_SMARTCARD=y
CONFIG_WPS=y
CFLAGS += -I/usr/include/libnl3
EOF
patch -p1 -i ../wpa_supplicant-2.6-upstream_fixes-2.patch &&
cd wpa_supplicant &&
make BINDIR=/sbin LIBDIR=/lib
install -v -m755 wpa_{cli,passphrase,supplicant} /sbin/ &&
install -v -m644 doc/docbook/wpa_supplicant.conf.5 /usr/share/man/man5/ &&
install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 /usr/share/man/man8/
20.安装systemd支持
install -v -m644 systemd/*.service /lib/systemd/system/
21.安装dbus支持
install -v -m644 dbus/fi.{epitest.hostap.WPASupplicant,w1.wpa_supplicant1}.service \
/usr/share/dbus-/system-services/ &&
install -v -d -m755 /etc/dbus-/system.d &&
install -v -m644 dbus/dbus-wpa_supplicant.conf \
/etc/dbus-/system.d/wpa_supplicant.conf
22.配置开机启动wpa服务支持
systemctl enable wpa_supplicant
23.返回blfs-sources目录并删除解压的包目录
cd $LFS/sources/blfs-sources rm -rf wpa_supplicant-2.6
24.设置wpa
install -v -dm755 /etc/wpa_supplicant &&
wpa_passphraseSSID
SECRET_PASSWORD
> /etc/wpa_supplicant/wpa_supplicant-wifi0
.conf
wifi0替换为pci查到的无线网络设备名字
25.配置开机启动wpa网卡服务
systemctl enable wpa_supplicant@wlan0 wlan0更换为无线设备名字
26.使用wpa_cli遇到如下报错
Could not connect to wpa_supplicant: (nil) - re-trying
则在/etc/wpa_supplicant/wpa_supplicant-wifi0.conf文件中加入以下参数
ctrl_interface=DIR=/run/wpa_supplicant GROUP=root
update_config=1
27.使用wps_cli工具链接无线网络的方法
wpa_cli
2.添加一个网络连接
add_network
默认id为0
3.扫描并显示结果
scan
scan_result
4.设置网络id:0的接入点与连接秘钥
set_network 0 ssid “<填入网络名字>”
set_network 0 psk "<填入网络密码>"
5.使用配置网络或连接配置网络id 0
enable_network 0 select_network 0
完整命令 | 简短命令 | 描述 |
status | stat | 显示当前连接状态 |
quit | q | 退出 |
terminate | term | 关闭wpa_supplicant |
reconfigure | recon | 使用提供的配置文件 (-c 参数) 重新加载wpa_supplicant |
scan | scan | 扫描可用的接入点 (只扫描它, 不显示任何内容) |
scan_result | scan_r | 显示上次扫描的结果 |
list_networks | list_n | 显示已配置网络及其状态的列表 (活动或不活动、启用或禁用) |
select_network | select_n | 在已定义的网络中选择一个网络以启动连接 |
enable_network | enable_n | 使配置的网络可供选择 |
remove_network | remove_n | 从列表中删除网络及其配置 |
add_network | add_n | 将新网络添加到列表中。它的 id 将自动创建 |
set_network | set_n |
显示了一个非常短的可用选项列表, 以便在没有参数的情况下配置网络。 |
get_network | get_n | 显示指定网络所需的参数。 |
save_config | save_c | 保存配置 |
参数 |
描述 |
ssid |
接入点名称 |
psk |
密码 |