编译Openwrt固件/默认开启wifi
本文转自:http://blog.chinaunix.net/uid-9688646-id-5029122.html
修改的文件为 ./package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_11n}${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid Hello-World
option encryption none
option disabled 0
EOF
devidx=$(($devidx + 1))
done
cat <
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid 'OpenWrt SLboat Mod'
option encryption none
EOF
devidx=$(($devidx + 1))
done
}
# base on ORG version:14.07,r42656
# this file has mod by slboat,most mod for default wifi config file,so can default enable it
# org file is inside the source: package/mac80211/files/lib/wifi/mac80211.sh
# how we mod it:
# http://see.sl088.com/id/1xm
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)
option hwmode 11${mode_11n}${mode_band}
$ht_capab
# REMOVE THIS LINE TO DISABLE WIFI - SLBoat Mod:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid 'OpenWrt SLBoat Mod'
option encryption none
EOF
devidx=$(($devidx + 1))
done
}
# ORG version:12.09-rc1
# this file has mod by slboat
# org file is inside the source: package/mac80211/files/lib/wifi/mac80211.sh
# how we mod it :
# http://see.sl088.com/wiki/Openwrt_%E5%9B%BA%E4%BB%B6%E7%BC%96%E8%AF%91/%E9%BB%98%E8%AE%A4%E5%BC%80%E5%90%AFwifi
vade 发表于 2011-5-25 12:01
多谢 xujifsad, 搞定了。
修改的文件为 openwrt/trunk/package/mac80211/files/lib/wifi/mac80211.sh, ...
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_11n}${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid Hello-World
option encryption none
option disabled 0
EOF
devidx=$(($devidx + 1))
done
cat <
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid 'OpenWrt SLboat Mod'
option encryption none
EOF
devidx=$(($devidx + 1))
done
}
# base on ORG version:14.07,r42656
# this file has mod by slboat,most mod for default wifi config file,so can default enable it
# org file is inside the source: package/mac80211/files/lib/wifi/mac80211.sh
# how we mod it:
# http://see.sl088.com/id/1xm
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)
option hwmode 11${mode_11n}${mode_band}
$ht_capab
# REMOVE THIS LINE TO DISABLE WIFI - SLBoat Mod:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid 'OpenWrt SLBoat Mod'
option encryption none
EOF
devidx=$(($devidx + 1))
done
}
# ORG version:12.09-rc1
# this file has mod by slboat
# org file is inside the source: package/mac80211/files/lib/wifi/mac80211.sh
# how we mod it :
# http://see.sl088.com/wiki/Openwrt_%E5%9B%BA%E4%BB%B6%E7%BC%96%E8%AF%91/%E9%BB%98%E8%AE%A4%E5%BC%80%E5%90%AFwifi
vade 发表于 2011-5-25 12:01
多谢 xujifsad, 搞定了。
修改的文件为 openwrt/trunk/package/mac80211/files/lib/wifi/mac80211.sh, ...
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
option hwmode 11${mode_11n}${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network lan
option mode ap
option ssid Hello-World
option encryption none
option disabled 0
EOF
devidx=$(($devidx + 1))
done
红色为我修改的内容,第一个“#”是添加的,目的是注释掉该行,后面添加的是使能wifi,
但我实际发现无线有时还是不能自动默认打开,请问还能是什么问题呢?
1、使路由器第一次启动后默认开启WIFI
修改文件openwrt/trunk/package/mac80211/files/lib/wifi/mac80211.sh的最后部分
option disabled 1
2、如何单独编译内核模块安装包
make package/kernel/{compile, install} V=s
PS:OpenWRT的kernel modules 配置文件都在这
3、添加U盘/移动硬盘支持
添加USB挂载
Base system —> <*>block-mount
添加硬盘格式支持()
Kernel modules —> Filesystems —> <*> kmod-fs-ext4 (移动硬盘EXT4格式选择)
Kernel modules —> Filesystems —> <*> kmod-fs-vfat(FAT16 / FAT32 格式 选择)
Kernel modules —> Filesystems —> <*> kmod-fs-ntfs (NTFS 格式 选择)
添加UTF8编码,CP437编码,ISO8859-1编码
Kernel modules —> Native Language Support —> <*> kmod-nls-cp437
Kernel modules —> Native Language Support —> <*> kmod-nls-iso8859-1
Kernel modules —> Native Language Support —> <*> kmod-nls-utf8
添加SCSI支持
Kernel modules —> Block Devices —> <*>kmod-scsi-core
添加USB相关支持
Kernel modules —> USB Support —> <*> kmod-usb-core.
Kernel modules —> USB Support —> <*> kmod-usb-ohci.
Kernel modules —> USB Support —> <*> kmod-usb-storage.
Kernel modules —> USB Support —> <*> kmod-usb-storage-extras.
Kernel modules —> USB Support —> <*> kmod-usb2.
添加自动挂载工具
Utilities —> Filesystem —> <*> badblocks
4、OpenWrt取消strip的方法
make package/foo/{clean,compile} V=99 STRIP=/bin/true
也就是说如果默认使用strip破坏了你的程序、库,可以使用STRIP=/bin/true来取消strip操作,直接在Makefile中定义也是可以的
5、UBOOT移植编译
http://www.right.com.cn/forum/thread-84684-1-1.html
6、用OpenWrt的交叉编译器编译外部程序文件,遇到如下错误:
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
解决办法是在命令行输入:
export STAGING_DIR=(你的OpenWrt目录的绝对路径)/staging_dir
7、4G LTE的移植
大致步骤 移植4G网卡,改写网络配置文件,改写4G拨号脚本,配置WIFI和WIFI的DHCP。
涉及文件:
内核部分 driver/usb/serial/option.c 加PID,VID
文件系统部分:
/etc/config/network 加入WAN接口配置并配置为4G模式;加入WIFI接口,并配置为静态地址模式以便能自动启。
/etc/config/wireless 将wifi-iface的network字段与 /etc/config/network中的WIFI接口匹配相同
/etc/config/firewall 修改防火墙规则,使各个接口都可以通信。
/etc/config/dhcp 添加WIFI接口的DHCP功能
/etc/chatscripts/3g.ch 拨号脚本
以上所有文件内容在这个网页:
http://blog.csdn.net/sydjm/article/details/8490357