[Galaxy S I9000 Android Development] n01ce:
I can't make it work under Cyanfox 2.0.2 (KitKat 4.4.2 ROM).

Initially, here are my firmware and driver files:

root@GT-I9000:/ # ls -l /system/vendor/firmware
-rw-r--r-- root root 17663 2008-08-01 14:00 bcm4329.hcd
-rw-r--r-- root root 246791 2008-08-01 14:00 fw_bcmdhd.bin
-rw-r--r-- root root 267027 2008-08-01 14:00 fw_bcmdhd_apsta.bin
...

root@GT-I9000:/ # ls -l /system/lib/modules
-rw-r--r-- root root 418216 2008-08-01 14:00 bcmdhd.ko
...

root@GT-I9000:/ # lsmod
bcmdhd ...

root@GT-I9000:/ # uname -a
Linux localhost 3.0.101-g664e662 #1 PREEMPT Fri Jan 3 23:42:51 UTC 2014 armv7l GNU/Linux

root@GT-I9000:/ # modinfo /system/lib/modules/bcmdhd.ko
filename: /system/lib/modules/bcmdhd.ko
license: GPL v2
alias: sdio:c00v*d*
alias: sdio:c*v02D0d4324*
alias: sdio:c*v02D0d4330*
alias: sdio:c*v02D0d4329*
alias: sdio:c*v02D0d0492*
depends:
vermagic: 3.0.101-g664e662 preempt mod_unload ARMv7
parm: clockoverride:SDIO card clock override
parm: dhd_oob_gpio_num:DHD oob gpio number

root@GT-I9000:/ # modinfo /data/data/bcmon/bcm4329.ko
filename: /data/data/bcmon/bcm4329.ko
license: GPL v2
alias: sdio:c*v02D0d4319*
alias: sdio:c*v02D0d0493*
alias: sdio:c*v02D0d0000*
depends:
vermagic: 2.6.37.6-cyanogenmod-g0799e00 preempt mod_unload ARMv7
parm: dhd_oob_gpio_num:DHD oob gpio number
parm: clockoverride:SDIO card clock override

From the CyanogenMod driver makefile, it seems that the Wi-Fi firmware is bcmdhd.bin.

WIFI_DRIVER_FW_PATH_STA := "/vendor/firmware/fw_bcmdhd.bin"
WIFI_DRIVER_FW_PATH_AP := "/vendor/firmware/fw_bcmdhd_apsta.bin"
# Copy Bluetooth firmware, since BCM4329 is a BT/WiFi chip
PRODUCT_COPY_FILES += \
device/htc/msm8660-common/firmware/bcm4329.hcd:system/vendor/firmware

So I'm basically interrested in:

- Patching fw_bcmdhd.bin (fimware ~200KB)

- Patching bcmdhd.ko (driver ~400KB)

But not in bcm4329.hcd that manages the Bluetooth.

So where are the patched firmwares? Let's look inside the bcmon apk (7zip can extract it), we can find them at the root:

22/06/2013 23:59 199*432 bcm4330_sta.bcmon.bin

22/06/2013 23:59 249*144 fw_bcm4329.bcmon.bin

22/06/2013 23:59 219*400 fw_bcmdhd.bcmon.bin

Interresting enough, I can't find any track of fw_bcmdhd in bcmon source on Google code. Should I use bcmdhd or bcm4923 firmwares? That's unclear but let's go on.

Bcmon source codes contains:

bcm4329\scripts\setup.sh

bcm4329\fw\fw_bcm4329.bcmon.bin

bcm4329\driver\bin\cm7.1-nexusone\bcm4329.ko

bcm4329\driver\bin\cm7.2-evo4g\bcm4329.ko

First of all, there's no specific support for Samsung Galaxy S i9000. But there's a support for the chip, that is bcm4329.

There's definitely a problem of driver ".ko" file. bcmon is built to remove bcm4329 library, not bcmdhd library. That's not meant to work in my case. Even if there's some kind of bcmdhd (pathched or original?) firmware binary in the apk.

setup.sh is made to replace bcm4329 driver!

bcmon setup.sh:

#!/system/bin/sh
CUR_DIR=`dirname $0`
CUR_DIR=`readlink -f $CUR_DIR`
DRIVER_NAME="bcm4329"
DRIVER_FLNM="bcm4329.ko"
FW_PATH="$CUR_DIR/fw_bcm4329.bcmon.bin"

IS_BCM_LOADED=`lsmod | grep bcm4329 | wc -l`

if [ $IS_BCM_LOADED == 1 ]; then
IS_BCM_PATCHED=`grep "bcmon_loaded" /proc/kallsyms | wc -l`
if [ $IS_BCM_PATCHED == 0 ]; then
echo Original module loaded. disabling WiFi
svc wifi disable
fi
fi
echo LOADING MODULE
rmmod $DRIVER_NAME 2>/dev/null
insmod $DRIVER_FLNM firmware_path=$FW_PATH
ifconfig eth0 up

I tried to load the driver module built for Nexus One without success (bcm4329.ko that comes within bcmon).

I don't understand how you guys can make it work with CyanFox 2... it needs to be built for that specific kernel or version magic will raise an alert.

root@GT-I9000:/data/data/bcmon # insmod /data/data/bcmon/bcm4329.ko firmware_path=/data/data/bcmon/fw_bcm4329.bcmon.bin
insmod: init_module '/data/data/bcmon/bcm4329.ko' failed (Exec format error)
255|root@GT-I9000:/data/data/bcmon # dmesg log
...
<3>[11054.558677] bcm4329: version magic '2.6.37.6-cyanogenmod-g0799e00 preempt mod_unload ARMv7 ' should be '3.0.101-g664e662 preempt mod_unload ARMv7 '

So I believe I need the right galaxy S i9000 bcmon-patched bcm4329.ko. Where is it? Has anyone compiled it for Cyanfox 2.0.2 specific kernel? (3.0.101-g664e662)

Result of the following shell commands would be appreciated from users of Galaxy S bcmon-working phones (after enabling bcmon):

ls -l /system/vendor/firmware
ls -l /system/lib/modules
lsmod
uname -a
modinfo bcm4329.ko
modinfo bcmdhd.ko

Howto from a PC: Turn on USB debugging mode on the phone, open a PC terminal prompt from Android SDK platform-tools folder, type "adb shell" then "su" and then these commands.