Manually load the driver
#### 16th, Jul
Driver Loading
Modprobe libertas
Modprobe libertas_sdio
Error pulling when loading the second row
# Modprobe libertas_sdio
Libertas_sdio: libertas sdio driver
Libertas_sdio: Copyright Pierre Ossman
Model = 0xb
Sd8686_helper.bin sd8686.bin
Init: untracked PID 958 exited
After a while, the following will appear:
Libertas: Can't load helper firmware
Libertas: failed to load helper firmware
Libertas_sdio: Probe of mmc2: 0001: 1 failed with error-2
But you can see it again with lsmod.
# Lsmod
Libertas_sdio 8776 0-live 0xbf022000
Libertas 97416 1 libertas_sdio, live 0xbf009000
Usbserial 30256 0-live 0xbf000000
### Try using insmod
Insmod/lib/modules/2.6.24.7/kernel/Drivers/NET/wireless/libertas. Ko
Insmod/lib/modules/2.6.24.7/kernel/Drivers/NET/wireless/libertas/libertas_sdio.ko
Still the same
### Find the file fireware file NOT MENTIONED IN THE SYSTEM
Copy fireware from romfs/lib of huaheng to/nfs/rootfs/lib
$ Or not
### Copy fireware to system/etc/and finally load it
As follows:
# Modprobe libertas_sdio
Libertas_sdio: libertas sdio driver
Libertas_sdio: Copyright Pierre Ossman
Model = 0xb
Sd8686_helper.bin sd8686.bin
Init: untracked PID 714 exited
Init: untracked PID 717 exited
Libertas: eth1: Marvell WLAN 802.11 Adapter
$ Suggestions
Title: Android init not loading firmware
Android Employee A: You need to run the insmod in a separate process launched by init.
#########
Understanding principles
Android uses a modified wpa_supplicant (external/wpa_supplicant) daemon for WiFi support which is controlled through a socket by hardware/libhardware_legacy/WiFi/wifi. C (wifihw) that gets controlled from Android UI through android.net. wiFi package from frameworks/base/WiFi/Java/Android/NET/WiFi/and it's corresponding JNI implementation in frameworks/base/CORE/JNI/android_net_wifi_wifi.cpp higher level network management is done in frameworks/base/CORE/Java/Android/Net
1. Add in build/target/board/generic/boardconfig. mk
Board_wpa_supplicant_driver: = wext
2. Open debugging information -- Optional
Debugging is disabled by default.
2.1 modify external/wpa_supplicant/common. C and set wpa_debug_level = msg_debug
2.2 modify common. h and change # define wpa_printf from if (level)> = msg_info) to If (level)> = msg_debug)
3. Create System/etc/WiFi/wpa_supplicant.conf
There are two types of socket
One is Android private socket
Ctrl_interface = eth1
Update_config = 1
Ap_scan = 1 ### depends on the WiFi driver. If not, change it to 0.
The other is the UNIX standard socket. The second is selected here.
Ctrl_interface = dir =/data/system/wpa_supplicant group = WiFi
Update_config = 1
Ap_scan = 1 ### depends on the WiFi driver. If not, change it to 0.
4. Add the following statement to init. RC:
# @ Qiu
Mkdir/system/etc/WiFi 0777 WiFi
Chmod 0777/system/etc/WiFi
Chmod 0777/system/etc/WiFi/wpa_supplicant.conf
Chown WiFi/system/etc/WiFi/wpa_supplicant.conf
Mkdir/data/MISC/WiFi 0777 WiFi
Mkdir/data/MISC/WiFi/sockets 0770 WiFi
Chmod 0777/data/MISC/WiFi
Chmod 0777/data/MISC/WiFi/wpa_supplicant.conf
Chown WiFi/data/MISC/WiFi
Chown WiFi/data/MISC/WiFi/wpa_supplicant.conf
# Wpa_supplicant socket (UNIX socket mode)
Mkdir/data/system/wpa_supplicant 0777 WiFi
Chmod 0777/data/system/wpa_supplicant
Chown WiFi/data/system/wpa_supplicant
# Qiu @
# For private socket, yes
Mkdir/system/etc/WiFi 0777 WiFi
Chmod 0777/system/etc/WiFi
Chmod 0777/system/etc/WiFi/wpa_supplicant.conf
Chown WiFi/system/etc/WiFi/wpa_supplicant.conf
# Wpa_supplicant control socket for Android wifi. C (Android private socket)
Mkdir/data/MISC/WiFi 0777 WiFi
Mkdir/data/MISC/WiFi/sockets 0770 WiFi
Chmod 0777/data/MISC/WiFi
Chmod 0777/data/MISC/WiFi/wpa_supplicant.conf
Chown WiFi/data/MISC/WiFi
Chown WiFi/data/MISC/WiFi/wpa_supplicant.conf
5. Add wpa_supplicant and dhcpcd startup services to init. RC.
Service wpa_supplicant/system/bin/wpa_supplicant-dd-dwext-ieth1-C/system/etc/WiFi/wpa_supplicant.conf
Group system WiFi inet
Disabled
Oneshot
# If it is a pricvate socket, add a line to the group:
Socket wpa_eth1 dgram 777 WiFi
Service dhcpcd/system/bin/dhcpcd-F/system/etc/dhcpcd. conf-D eth1
Group system DHCP WiFi
Disabled
Oneshot
5.5 Add the/system/etc/dhcpcd. conf file.
Interface eth1
Option subnet_mask, routers, domain_name_servers
6. Compile the WiFi driver into the kernel
First, add
Setprop wifi. Interface "eth1"
Setprop WLAN. Driver. Status "OK"
Next, modify Hardware/libhardware_legacy/WiFi/wifi. C.
New out/target/product/generic/system/lib/libhardware_legacy.so --- v2
Add at the beginning of the body of the function wifi_load_driver ()
// @ Qiu
LogE ("Weber @ WiFi driver loaded! ");
Return 0;
// Qiu @
Add at the beginning of the function wifi_unload_driver ()
// @ Qiu
LogE ("Weber @ WiFi driver unloaded! ");
Return 0;
// Qiu @
#### 17th, Jul
Change drive from m to *, get zImage-vvv39
Start:
An error occurred while loading firmware.
Libertas: Can't load helper firmware
Libertas: failed to load helper firmware
Libertas_sdio: Probe of mmc2: 0001: 1 failed with error-2
It seems that fireware cannot be loaded.
### Try to modify wifi. C to enable it to automatically load modules
Modify
# Ifndef wifi_driver_module_path1
# Define wifi_driver_module_path1 "/system/lib/modules/libertas. Ko"
# Endif
# Ifndef wifi_driver_module_path2
# Define wifi_driver_module_path2 "/system/lib/modules/libertas_sdio.ko"
# Endif
# Ifndef wifi_driver_module_name1
# Define wifi_driver_module_name1 "libertas"
# Endif
# Ifndef wifi_driver_module_name2
# Define wifi_driver_module_name2 "libertas_sdio"
# Endif
Make some modifications in the code after this file, and also modify the wifi_load_driver () function.
Libhardware_legacy.so --- v3
-Click WiFi in settings after startup
The serial port is shown as follows. It seems that it can be loaded.
# Libertas_sdio: libertas sdio driver
Libertas_sdio: Copyright Pierre Ossman
Model = 0xb
Sd8686_helper.bin sd8686.bin
Init: untracked PID 954 exited
Init: untracked PID 957 exited
Libertas: eth1: Marvell WLAN 802.11 Adapter
However, WiFi is unavailable under the WiFi icon
View the main of logcat:
7899 E/wifihw (708): cannot access "/data/MISC/WiFi/wpa_supplicant.conf": Permission denied
7900 E/wifihw (708): Wi-Fi will not be enabled
7901 w/wifihw (708): Weber @ WiFi driver unloaded!
7902 E/wifiservice (708): failed to start supplicant daemon.
7903 D/settingswifienabler (791): received WiFi state changed from enabling to unknown
Add the following statement to init. RC.
Mkdir/data/MISC/WiFi 0770 WiFi
Mkdir/data/MISC/WiFi/sockets 0770 WiFi
Chmod 0770/data/MISC/WiFi
Chmod 0660/data/MISC/WiFi/wpa_supplicant.conf
Chown WiFi/data/MISC/WiFi
Chown WiFi/data/MISC/WiFi/wpa_supplicant.conf
And CP system/etc/WiFi/wpa_supplicant.conf./data/MISC/WiFi/
Start, and finally enable WiFi, but still cannot open the webpage
View logcat
4564 E/wpa_supplicant (917): failed to read or parse configuration '/system/etc/WiFi/wpa_supplicant.conf '.
4565 E/wifihw (708): Unable to open connection to supplicant on "/data/system/wpa_supplicant/sta": no such file or directory
4566 D/wifiservice (708): action_battery_changed pluggedtype: 1
4899 E/wifihw (708): Supplicant not running, cannot connect
5574 E/wifihw (708): Supplicant not running, cannot connect
5575 V/wifistatetracker (708): Supplicant died unexpectedly
5576 D/dalvikvm (934): dexopt: Load 3102 ms, verify 1519 ms, opt 24 Ms
5577 D/installd (665): dexinv: --- end '/system/APP/browser.apk' (SUCCESS )---
5578 D/networkstatetracker (708): setdetailed state, old = idle and new state = disconnected
5579 D/connectivityservice (708): connectivitychange for WiFi: disconnected/disconnected
# Modify the wpa_supplicant.conf permission to 777 in init. RC,
There are still errors:
5573 E/wifihw (708): Unable to open connection to supplicant on "/data/system/wpa_supplicant/sta": no such file or director
# Add the following statements to init. RC:
Setprop wifi. Interface "eth1"
Setprop WLAN. Driver. Status "OK"
Setprop WLAN. Interface "eth1"
The result is still not displayed in logcat.
E/wifihw (708): Unable to open connection to supplicant on "/data/system/wpa_supplicant/eth1": no such file or directory
# In init. RC, the DHCP service is enabled to add the WiFi group permission for eth1.
A new error occurs.
If enable WiFi is enabled at the beginning, the following error occurs:
E/wifihw (709): Unable to open connection to supplicant on "/data/system/wpa_supplicant/eth1": Connection refused
Because this is the default boot WiFi, if not started, the error is the same as the previous
### 18th, Jul
# Try to set group = System in wpa_supplicant.conf, but it still doesn't work, so I have to change it back.
Ls/data/system/wpa_supplicant/eth1-l
Srwxrwx --- 1 1010 1010 0 Jul 18/data/system/wpa_supplicant/eth1
# Ls/data/system/wpa_supplicant/eth1-l
Srwxrwxrwx 1 1010 1010 0 Jul 18/data/system/wpa_supplicant/eth1
### 18th, Jul manual debugging
# Wpa_supplicant-dd-dwext-ieth1-C/system/etc/WiFi/wpa_supplicant.conf &
# IOCTL [siocsiwpmksa]: invalid argument "output errors"
# Ls/data/system/wpa_supplicant/eth1-l
Srwxrwxrwx 1 1010 1010 0 Jul 18/data/system/wpa_supplicant/eth1
# Wpa_cli-I eth1-P/data/system/wpa_supplicant
I don't know how to set the AP
Bash # wpa_cli-ieth1 scan // search for Wireless Networks
Bash # wpa_cli-ieth1 scan_results // Display Search Results
Bash # wpa_cli-ieth1 add_network
Bash # iwconfig eth1 Essid "you_wifi_net"
Bash # wpa_cli-ieth1 password 0 "password"
Bash # wpa_cli-ieth1 enable_network
### 19th, Jul
Modify VI frameworks/base/WiFi/Java/Android/NET/WiFi/wifistatetracker. Java
Change tiwlan0 to eth1
Not compiled yet
### At the beginning, the debug option of step 2 is not selected. On this option, MM compilation is available in the external/wpa_supplicant directory.
Get
System/bin/wpa_cli --- vvv1
System/lib/libwpa_client.so --- vvv1
System/bin/wpa_supplicant --- vvv1
### Try Android private socket
Modify VI system/etc/WiFi/wpa_supplicant.conf
VI data/MISC/WiFi/wpa_supplicant.conf
Modify init. RC
Comment the UNIX socket section in chmod
Added when wpa_supplicant was started.
Socket wpa_eth1 dgram 660 WiFi
The result still does not work.
### Add it to external/wpa_supplicant/wpa_ctrl.c
Logw. Note that the header file and log_tag must be added first.
17 # define log_tag "wifiqiu"
18 # include "cutils/log. H"
MM compiled
System/bin/wpa_cli --- vvv2
System/lib/libwpa_client.so --- vvv2
However, there is no wifiqiu output. I don't know if make is not used, but because of mm.
### 20th, Jul
1. Added have_custom_wifi_driver_2: = true to boardconfig. mk.
2. Modify the WiFi/wifi. C to check and uninstall the two functions of the driver, and compile them with make.
Libhardware_legacy.so --- v4
System/bin/wpa_cli --- vvv2.1
System/bin/wpa_supplicant-v2
System/lib/libwpa_client.so --- vvv2.1
### The above version has not been tested yet, and problems have been found
1. The log in external/wpa_supplicant/wpa_ctrl.c is not comprehensive,
There are three cases in which a function is not added, so the logw is added and can be distinguished.
2. Follow the prompts in manual strace wpa_cli
Access ("/data/MISC/WiFi/wpa_supplicant", f_ OK) =-1 enoent (no such file or directory)
Use grep to search for the external/wpa_supplicant/wpa_cli.c file.
Change it to/data/MISC/WiFi
Compile with mm in external/wpa_supplicant and hardware/libhardware_legacy respectively
Get
System/bin/wpa_cli --- vvvvv3
System/lib/libwpa_client.so --- vvv3
Libhardware_legacy.so --- V5
An error occurred while connecting the socket after startup.
Connect (CTRL-> S, (struct sockaddr *) & Ctrl-> DEST, sizeof (CTRL-> DEST) <0)
And cannot disable WiFi
I had to re-Modify wifi. C and directly return 0 in the unload function so that WiFi can be disabled.
Libhardware_legacy.so --- v5.1
### Manual debugging again when Jul uses private
# Wpa_supplicant-dd-dwext-ieth1-C/system/etc/WiFi/wpa_supplicant.conf &
# IOCTL [siocsiwpmksa]: invalid argument
Mkdir [ctrl_interface]: Permission denied
[1] + done (255) wpa_supplicant-dd-dwext-ieth1-C/system/etc/WiFi/wpa_supplicant.conf
Mkdir is found in ctrl_iface_unix.c.
The error occurs outside of # ifdef Android, which is strange.
### Replace driver_wext.c in external/wpa_supplicant in Donut
Re-compile mm to get:
Wpa_supplicant --- vvv3
$ Or not
### 22th, Jul
Copy the donut wpa_supplicant folder to eclair.
Compiled with mm
System/bin/wpa_cli --- vvvvv4
System/bin/wpa_supplicant --- vvv4
System/lib/libwpa_client.so --- vvv4
Wpa_supplicant --- vvv3
Finally, you can find the network.
However, the IP address cannot be obtained.
Logcat prompt:
I/wifistatetracker (713): dhcphandler: DHCP request failed: timed out waiting for DHCP to finish
### Manual DHCP startup prompt
Eth1: Open '/data/MISC/DHCP/dhcpcd-eth1.pid': no such file or directory
Add in init. RC
Mkdir/data/MISC/DHCP 0777 WiFi
Chmod 0777/data/MISC/DHCP
Chown WiFi/data/MISC/DHCP
Still cannot get the address
Eth1: Flock '/data/MISC/DHCP/dhcpcd-eth1.pid': Try again
Later, I changed the above wifi to DHCP and still could not obtain the IP address.
$
Kill dhcpcd and start it manually
# Dhcpcd-F/system/etc/dhcpcd. conf-D eth1
Eth1: dhcpcd 4.0.1 starting
Eth1: hardware address = 00: 1A: 6B: A2: 38: 65
Eth1: executing '/system/etc/dhcpcd-run-hooks', reason preinit
Eth1:/system/etc/dhcpcd-run-hooks: Permission denied
Eth1: Waiting For Carrier
Eth1: host does not support a monotonic clock-timing can skew
Eth1: timed out
Eth1: executing '/system/etc/dhcpcd-run-hooks', reason fail
Eth1:/system/etc/dhcpcd-run-hooks: Permission denied
$ Change all permissions to 777 and execute again
# Dhcpcd-F/system/etc/dhcpcd. conf-D eth1
Eth1: dhcpcd 4.0.1 starting
Eth1: hardware address = 00: 1A: 6B: A2: 38: 65
Eth1: executing '/system/etc/dhcpcd-run-hooks', reason preinit
Eth1: Waiting For Carrier
Eth1: host does not support a monotonic clock-timing can skew
Eth1: timed out
Eth1: executing '/system/etc/dhcpcd-run-hooks', reason fail
$ The android server has not been closed yet. re-enable wifi. Hey, you can allocate the address.
However, I still cannot access the Internet. It is probably because of the address.
After eth0 is disabled, you can access the Internet.
WiFi porting has come to an end