Replicant 6 - Enabling Wifi on Galaxy 2 i9100
I've recently tried out Replicant, a fully free Android distribution for mobile phones. So far it only runs on a few devices and some things not work out of the box (Wifi, GPS, etc) as they require non-free firmware. I'm glad that by default Replicant doesn't include any non-free stuff, a bit like Debian/main. That said, in my case I needed (I wanted) to enable WifI.
Thanks to the help of Jookia (found on Replicant's IRC chan), I should say walk-through, we managed to get Wifi working, very easily. Here's a short and hopefully painless howto that might help others. The following has been tested using Debian/Stretch on the computer and Replicant 6 on the computer-phone.
Get the Firmware Files
The files can be found here, we need bcmdhd_apsta.bin, bcmdhd_p2p.bin, bcmdhd_sta.bin and nvram_net.txt.
On the computer
We'll first create a directory for the firmware files:
mkdir firmware
cd firmware
Then let's get all the files at once:
for i in bcmdhd_{apsta,sta,p2p}.bin nvram_net.txt; do wget 'https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/i9100/proprietary/system/etc/wifi/'$i; done
OR, if you prefere the slow method:
wget https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/i9100/proprietary/system/etc/wifi/bcmdhd_apsta.bin
wget https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/i9100/proprietary/system/etc/wifi/bcmdhd_p2p.bin
wget https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/i9100/proprietary/system/etc/wifi/bcmdhd_sta.bin
wget https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/i9100/proprietary/system/etc/wifi/nvram_net.txt
One more file, we need to download dhd.ko: (and we'll go back up one to the previous directory)
cd ../
wget https://redmine.replicant.us/attachments/download/1484/dhd.ko
It's always a good idea to check that files haven't been modified:
sha256sum firmware/*
This should return:
cd2a00131430c6add45bd12874f6a619a3c0532bcd6e6d92a4efbf68948b027b firmware/bcmdhd_apsta.bin
462e89e7bcf1f4fd701933d9cb80e795acca27a7c80300e42661d7e3bc6f5ea7 firmware/bcmdhd_p2p.bin
462e89e7bcf1f4fd701933d9cb80e795acca27a7c80300e42661d7e3bc6f5ea7 firmware/bcmdhd_sta.bin
41bf03b7d4d4e12ec34929f28e9463a9f93422bb80448addf45f8ddb5d55a0bc firmware/nvram_net.txt
And
sha256sum dhd.ko
Should return:
6e325e3499ee0f53eb5c9eb348126cde2277486071289ddacc391f17440da6ae dhd.ko
Copying files to the phone
First, we need to connect the phone to the computer using a USB cable.
On the Phone
Enable ADB. This should be in Settings -> Developer options -> Android Debugging. Why not enable Root access (ADB only).
On the Computer
We'll need adb on the computer, you can install it easily:
apt install adb
Everything happens in the next step, basically we'll access the phone, copy files over and reboot. And that's it.
adb root
adb remount
adb push dhd.ko /system/lib/modules/dhd.ko
adb shell mkdir /system/vendor/firmware
find firmware/ -type f -exec adb push {} /system/vendor/firmware \;
adb reboot
Hopefuly wifi should be available. Thanks Jookia for your notes, your time and your patience.
Thanks to slacknoob for correcting a missing backslash.