Hey guys,
So I've been spending a lot of time trying to get this to work and I'm now stuck. This is what I've done so far. I got this from
http://sprabhu.blogspot.in/2012_07_01_a ... 4731121321 and had to modify some of it.
Code: Select all
The latest firmware for the Raspberry Pi is made available through the git repository. The firmware built is based on the kernel sources which are also made available through a separate git repository.
Users may want to install the latest firmware to avail of the latest fixes available for the Raspberry Pi kernel. However changes in the kernel necessitates the rebuild of any customer kernel modules installed. These are kernel modules which are not available on the usual kernel which was distributed. In my case, I need to recompile the drivers for my wireless card which aren't available on the stock kernel.
The steps given below is to be used when you recompile your drivers from within the Raspberry Pi.
Before you do anything, get into root
# sudo -s
Before we start, we need to make sure that we have the required tools.
# apt-get update
# apt-get install git gcc make rpi-update
# apt-get upgrade
# rpi-update
To update the firmware to the latest one from the git repo, follow the steps below
Download the latest firmware repo
# git clone --depth 1 https://github.com/raspberrypi/firmware.git
The argument --depth 1 limits the firmware downloaded to only the latest available in the repo.
OR
Update your existing firmware repo by first changing into the firmware repo directory and running the command
# git pull
You now have to download the latest source code from the git repo. The 256 MB of memory available on the Raspberry Pi isn't sufficient to run the git clone command. To get around this, you can download the git repo on a different machine and then copy over the repo to the Raspberry Pi.
To clone the git repo, use the command
# git clone --branch rpi-patches https://github.com/raspberrypi/linux.git rapi-linux
The argument --branch rpi-patches specifies that you would like to download the branch rpi-patches which is the one on which the kernel is built.
Now copy over the directory rapi-linux created to the Raspberry Pi.
OR
Update the existing sources directory by first changing into the sources repo directory and running the command
# git checkout rpi-patches
# git pull
I had to update the soruce directory multiple time to make sure everything synced up.
I have the git repos downloaded to the following location on the Raspberry Pi
/root/firmware
/root/rapi-linux
Now to build the kernel headers required to build the module.
1) Determine the git hash which represents the kernel used to build the firmware and check out the sources.
# cat /root/firmware/extra/git_hash
85b7821857dd0b9cabab59d47f08eabed74679a3
Use this hash to checkout the kernel sources.
# cd /root/rapi-linux
# git checkout 85b7821857dd0b9cabab59d47f08eabed74679a3
2) Prepare the sources so that they can be used to build the kernel module.
Reset the sources to clear any artifacts from an earlier build
# make mrproper
Copy over the kernel configuration and prepare sources.
# zcat /proc/config.gz > .config
# make oldconfig
# make modules_prepare
3) Copy over the files require to build the module from the firmware repo
# cp /root/firmware/extra/Module.symvers /root/rapi-linux
The kernel sources required to build the kernel module is now complete.
To build the module, change into the directory containing the module sources and run the command
# cd /root/rtl8192EU_linux_v4.3.1.1_11320.20140505/
Need to modify some code first.
# nano /root/rapi-linux/drivers/mmc/host/bcm2708_mci.c
You will need to search for the function GP_LEV0 and give it a value, it hasn't been declared yet. Search with "Ctrl + w". Your code should look like this after you find it, it's in there only once.
#define GP_LEV0 1
static int bcm2708_mci_get_cd(struct mmc_host *mmc)
{
int present = -ENOSYS;
struct bcm2708_mci_host *host = mmc_priv(mmc);
void *gpio_base = host->gpio_base;
present = readl( (gpio_base + GP_LEV0) );
if ((present & (1<<29))==(1<<29))
present = 0;
else
present = 1;
printk(KERN_DEBUG"***sdcard present***=%d\n", present);
// FIXME - For now force SD card present for 2835DK
present = 1;
return present;
}
You will need to type "#define GP_LEV0 1" above "static int bcm2708_mci_get_cd"
"Ctrl + o" to save
"Ctrl + x" to exit
Now build the module
# make -C /root/rapi-linux/ M=
We pass the location of the kernel sources directory with the -C parameter.
We pass the location to the module sources using the M= parameter.
To update the kernel on the Raspberry Pi, change into the firmware directory and copy over the required files.
First backup the existing files
# cd /root/firmware
# mkdir -p /root/fw.backups/
# rsync -av /boot /root/fw.backups/
# rsync -av /lib/modules/3.18.9-v7 /root/fw.backups/
Now copy over the new files
# cp -av boot/* /boot/
# cp -av modules/3.18.9-v7/* /lib/modules/3.18.9-v7/
Run depmod to build the module dependencies for modprobe
# depmod -a
Perform any additional steps required for your custom modules. In my case, I need to copy over my newly built wireless module to the new modules folder.
# cp /root/rtl8192EU_linux_v4.3.1.1_11320.20140505/8192eu.ko /lib/modules/3.18.9-v7/kernel/drivers/net/wireless/
# depmod -a
Now reboot the Raspberry Pi so that the new kernel can be loaded.
Here is my new information.
Code: Select all
root@raspberrypi:~# uname -a
Linux raspberrypi 3.18.9-v7+ #767 SMP PREEMPT Sat Mar 7 21:52:35 GMT 2015 armv7l GNU/Linux
root@raspberrypi:~# dmesg | grep usb
[ 1.289696] usbcore: registered new interface driver usbfs
[ 1.295365] usbcore: registered new interface driver hub
[ 1.300843] usbcore: registered new device driver usb
[ 1.670352] usbcore: registered new interface driver smsc95xx
[ 2.199713] dwc_otg bcm2708_usb: DWC OTG Controller
[ 2.206521] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[ 2.215779] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[ 2.234589] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.243360] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.252552] usb usb1: Product: DWC OTG Controller
[ 2.259247] usb usb1: Manufacturer: Linux 3.18.9-v7+ dwc_otg_hcd
[ 2.267185] usb usb1: SerialNumber: bcm2708_usb
[ 2.286965] usbcore: registered new interface driver usb-storage
[ 2.404837] usbcore: registered new interface driver usbhid
[ 2.413432] usbhid: USB HID core driver
[ 2.657972] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.858290] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[ 2.867206] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.168126] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 3.288406] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 3.297777] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.372343] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:0e:90:85
[ 3.468101] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 3.589261] usb 1-1.3: New USB device found, idVendor=0bda, idProduct=818b
[ 3.598851] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.608948] usb 1-1.3: Product: 802.11n NIC
[ 3.615803] usb 1-1.3: Manufacturer: Realtek
[ 3.623091] usb 1-1.3: SerialNumber: 00e04c000001
The problem I have is I can't find the 8192eu.ko file so to move into /lib/modules/... folder. I'm wondering if that's why it won't work? Anyone have any ideas?
Also, I tried this and I get this error.
Code: Select all
root@raspberrypi:~# ls
Desktop firmware fw.backups rapi-linux rtl8192EU_linux_v4.3.1.1_11320.20140505
root@raspberrypi:~# cd rtl8192EU_linux_v4.3.1.1_11320.20140505/
root@raspberrypi:~/rtl8192EU_linux_v4.3.1.1_11320.20140505# ls
clean core hal ifcfg-wlan0 include Kconfig Makefile os_dep platform runwpa wlan0dhcp
root@raspberrypi:~/rtl8192EU_linux_v4.3.1.1_11320.20140505# make
make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.18.9-v7+/build M=/root/rtl8192EU_linux_v4.3.1.1_11320.20140505 modules
make[1]: Entering directory '/lib/modules/3.18.9-v7+/build'
make[1]: *** No rule to make target 'modules'. Stop.
make[1]: Leaving directory '/lib/modules/3.18.9-v7+/build'
Makefile:1323: recipe for target 'modules' failed
make: *** [modules] Error 2
I ran these commands to check out if everything did well, guess not
Code: Select all
root@raspberrypi:~/rtl8192EU_linux_v4.3.1.1_11320.20140505# make -C /root/rapi-linux/ M=
make: Entering directory '/root/rapi-linux'
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
Kernel: arch/arm/boot/Image is ready
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 1051 modules
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make: Leaving directory '/root/rapi-linux'
root@raspberrypi:~/rtl8192EU_linux_v4.3.1.1_11320.20140505# make CONFIG_DEBUG_SECTION_MISMATCH=y
make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.18.9-v7+/build M=/root/rtl8192EU_linux_v4.3.1.1_11320.20140505 modules
make[1]: Entering directory '/lib/modules/3.18.9-v7+/build'
make[1]: *** No rule to make target 'modules'. Stop.
make[1]: Leaving directory '/lib/modules/3.18.9-v7+/build'
Makefile:1323: recipe for target 'modules' failed
make: *** [modules] Error 2