|From:||wojciech . st|
|Subject:||QEMU CAN emulation (Kvaser PCI, SJA1000) - how to setup and run|
|Date:||Thu, 12 Nov 2020 07:57:28 +0100 (CET)|
I would like to run QEMU with CAN emulation and check how does it work.
I focused on the following scenario:
Host Ubuntu 16.04 with vcan0 sends messages to QEMU x86_64 with Linux or vice versa.
But I always get the same error while setting up the can0 on guest:
# ip link set can0 type can bitrate 1000000
ip: either "dev" is duplicate, or "type" is garbage
I build guest Linux with Buildroot and I tried multiple versions of kernel and QEMU to see if any works.
Since with the new Buildroot and QEMU I did not succeed I go as fare as Buildroot from 2016 to get kernel 3.9 (based on info from QEMU 5.1 docs/can.txt example) and 3.8 and see it it works but still get the same result.
So I come into conclusion that I am missing some crucial part or information to start this example.
I use the following setup:
In Buildroot to the default configuration qemu_x86_64_defconfig I usually add only the CAN drivers as modules in kernel configuration:
- <M> CAN bus subsystem support
- <M> Raw CAN Protocol (raw access with CAN-ID filtering)
- <M> Broadcast Manager CAN Protocol (with contest filtering)
- <M> CAN Gateway/Router (with netlink configuration)
- <M> Platform CAN drivers with Netlink support
- CAN bit-timing calculation
- <M> Philips/NXP SJA1000 devices
- <M> Kvaser PCIcanx and Kvaser PCIcan PCI Cards
- CAN devices debugging messages
or small twaks to strt on particular qemu version or configuration.
Right now I focus on the following QEMU configration:
-M pc -m 4096M
-append "rootwait root=/dev/vda console=tty1 console=ttyS0"
On the host side (Ubuntu 16.04 VirtualBox and Native installation):
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
On the QEMU guest side:
ip link set can0 typ can bitrate 1000000
On the guest side after modprobing the drivers I see the can0 interface and no errors in dmesg but the setting up the interface with ip tool up ends with error.
I would be grateful for any comment or suggestions as I already run out of ideas.
|[Prev in Thread]||Current Thread||[Next in Thread]|