cp210x.ko kompilieren für Raspberry

Begonnen von jostmario, 01 November 2013, 12:05:36

Vorheriges Thema - Nächstes Thema

jostmario

Hallo

wer könnte mir die cp210x.ko für mein Raspberry Pi kompilieren um mein Stommesser per USB zu integrieren bekomme das irgendwie nicht zum laufen.
bekomme die fehlermeldung :  could not insert 'cp210x': Exec format error
die Datei findet sich hier
http://www.meintechblog.de/2013/10/smart-metering-mit-owl-usb-und-fhem-live-tracking-des-stromverbrauchs/
evtl zeigen wie es geht per Skype und Teamviewer.
evtl für ne kleine Spende :-)

Danke Gruß Josty

das wäre die anleitung dazu wenn damit jemand was anfangen kann:

Run

./install.sh

to install the pre compiled cp210x driver kernel module.
This will only work on a raspbian 3.6.11 kernel (2013-02-09-wheezy-raspbian.zip).
If this does not work on your raspberypi then you
will need to compile the driver for the kernel version that you have
installed. Some details of how this may be done are shown below.




BUILDING THE RASPBERRYPI cp210x DRIVER
/
The following details how the cp210x driver may be rebuilt. It also
serves as a basic guide to cross compiling the raspberrypi kernel.

This guide assumes
- You have an Ubuntu 12.04 machine
- You have a raspberrypi running raspybian (either the 3.2.27+ or the 3.6.11+ kernel)
- You have the ssh server on the raspberrypi and the Ubuntu machine and they are
  connected to the same IP network.
   
When complete the raspberrypi will be able to run the cm160server and the Ubuntu
machine will be able to run the electricowl GUI.   

ON THE RASPBERRYPI
Grab the current kernel configuration as follows
- From a terminal window or ssh session, take a copy of the current kernel configuration using the following command.
  zcat /proc/config.gz > /tmp/.config
- Copy the current kernel configuration to the Ubuntu machine
  scp /tmp/.config <USERNAME>@<UBUNTU MACHINE IP ADDRESS>:/tmp
      replace <USERNAME> with your username on the Ubuntu machine and
      <UBUNTU MACHINE IP ADDRESS> with its IP address.


ON THE UBUNTU MACHINE
Cross compile the raspberrypi kernel as follows
- cd ~
- mkdir raspberrypi_kernel
- cd raspberrypi_kernel
- sudo apt-get install git (only required if git is not installed on your ubuntu machine)
- git clone --depth 1 git://github.com/raspberrypi/linux.git
- git clone git://github.com/raspberrypi/tools.git
- cd linux
- git fetch
- git checkout rpi-3.2.27 (for the 3.2.27 kernel) or git checkout rpi-3.6.y (for the 3.6.11 kernel)
- Edit the Makefile (in the current folder) and
  Change the following line
   HOSTCXXFLAGS = -O2
  to
   HOSTCXXFLAGS = -O2 -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s
- PATH=$PATH:$HOME/raspberrypi_kernel/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
- make mrproper
- cp /tmp/.config .
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
   Enter return to select the default option for each kernel option presented

  The raspberrypi kernel will then be built, this will take some time....

Now that the kernel has been built we need to copy the cp210x driver source code into the kernel
source tree and compile it. The following cmds detail how this may be done.

- mv ~/raspberrypi_kernel/linux/drivers/usb/serial/cp210x.c /tmp/cp210x.c.org
- copy the cp210x.c (from the tarball) file to ~/raspberrypi_kernel/linux/drivers/usb/serial/cp210x.c
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

   This time only the new cp210x driver will be rebuild, this shouldn't take long

- Copy the cp210x kernel module to the raspberry pi using the following command
    scp drivers/usb/serial/cp210x.ko pi@192.168.0.115:/tmp
    (The IP address should be the IP address of the raspberrypi)

ON THE RASPBERRYPI
The modified cp210x kernel driver needs to be copied from /tmp/cp210x.ko to its correct location.
by running the following commands from a terminal on the raspberry pi. The 3.2.27+ text should be
substituted with 3.6.11+ if the raspbery pi has a 3.6.11 kernel.

- sudo mv /lib/modules/3.2.27+/kernel/drivers/usb/serial/cp210x.ko /lib/modules/3.2.27+/kernel/drivers/usb/serial/cp210x.ko.old1
- sudo cp /tmp/cp210x.ko /lib/modules/3.2.27+/kernel/drivers/usb/serial/cp210x.ko
- Edit the /etc/modules file and add the following line to the end of the file to ensure the cp210x module is loaded on restart
   cp210x
- Remove the previous cp210x kernel driver
    sudo rmmod cp210x
- Add the modified cp210x kernel driver
    sudo modprobe cp210x


Note !!!
If you run 'sudo modprobe cp210x' and get the following error then you have probably compiled the
cp210x module  for the wrong processor architecture. Check that you edited the Makefile as detailed
in the steps above.

ERROR: could not insert 'cp210x': Exec format error
Raspberry Pi  ---  HM-LAN ---  8X HM_HM_CC_RT_DN --- OWL+USB Strommesser    UVR1611

netbus


gemx

Ich hab den erst vor ein paar Wochen compiliert,
Die Datei die als Patch angegeben ist funktioniert so nicht mehr mit einem neueren Kernel.
Da musste ich etwas mehr basteln.
Bei mir funktioniert jetzt aber alles. :-)

Welches Kernelversion hast du denn?

Mach mal uname -a und poste das Ergebnis.

Dann kann ich dir das passende Kernelmodul schicken

netbus

Ich habe 3.10.25+
Mir ist auch schon beim kompilieren aufgefallen das der Patch nicht mehr passt.  Wäre toll wenn du mir deinen Treiber schicken kannst sofern mein Kernel passt . Wenn nicht Bitte den Patch.
Danke

Gesendet von meinem GT-I9505 mit Tapatalk


powdaking

#4
Mir bitte auch :)
Wie hast du es hinbekommen?

# uname - a
# Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux

gemx

So, bitte schön.

Anbei das Kernel modul für den 3.10.x kernel des Raspberry

Installation
* Datei enptacken und nach /lib/modules/<kernel version/kernel/drivers/usb/serial kopieren

sudo service fhem stop
rmmod cp210x


Wenn nach dem nachfolgenden Befehl sudo modprobe cp210x keine Fehlermeldung kommt,
einfach den rpi neustarten sudo reboot und alle sollte funktionieren :-)

netbus

Danke funktioniert. Du bist der Beste  ;D

powdaking

Bei mir nicht. Es kommt zwar kein Fehler, aber das OWL zeigt weiterhin nur Internals an (State : open).
Netbus, was hast du im Detail gemacht?

netbus


sudo service fhem stop
rmmod cp210x

die neue cp210x.ko nach /lib/modules/3.10.25+/kernel/drivers/usb/serial/cp210x.ko kopieren

sudo modprobe cp210x
sudo service fhem start


powdaking


netbus

hy gemx.
könntest du die source auch zur verfügung stellen?
Dann kompiliere ich selbst.
ich habe leider auf 3.10.33 upgedated und deine cp210x.ko funkt nicht mehr  :(

netbus

habe jetzt die source gefunden  ;D
Hier die source und modul für den Kernel 3.10.33+

liha

Hallo,

ich war dann wohl etwas vorschnell, habe mich ein wenig in fhem eingelesen und wollte "mal eben" fhem auf einem raspberry pi aufsetzen. die ersten gehversuche (fritzbox/wetter/vu+solo2) laufen schon recht gut. nun sollte die eule eingebunden werden.
Das ganze scheitert wohl an meinem vorschnellen update des system, denn ich habe nun den kernel 3.12.20+ und bekomme die cp210x
nicht installiert...

ist es nun einfacher den rasperry neu aufzusetzen oder warten das jemand eventuel .....?
selber compilieren ist nicht, da ich absoluter anfänger bin  ::)

Uli_L

Hänge auch beim installieren des Moduls... Habe es mehrfach modifiziert und kompiliert.
sudo service fhem stop -> ok
sudo rmmode cp210x -> ok
sudo modprobe cp210x -> Absturz!!! Raspi bleibt komplett stehen!

Hat jemand eine Idee?

Didi86

Hallo zusammen,

wie kann ich mir den Treiber denn wohl für meinen Ubuntu Server (Kernel 3.13.0-32-generic) kompilieren? Falls mir jemand die Arbeit abnehmen möchte, habe ich den Inhalt der cp210x.c Datei (als RTF Dokument) im Anhang hochgeladen. Für Hilfe bin ich sehr dankbar, denn Linux ist (noch) nicht gerade mein Steckenpferd. ;)

Viele Grüße

Didi