buildroot raspberrypi3_defconfig how to enable SPI? - raspberry-pi3

I'm trying to make a RPI3 buildroot image with CAN interface.
So far I don't see any device in /sys/bus/spi/devices
Please help
What I did are below
At the buildroot terminal "make raspberrypi3_defconfig" then enabled those below via "make xconfig" and "make linux-xconfig"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
BR2_PACKAGE_IPROUTE2
NET
CAN
CAN_DEV
SPI
CAN_MCP251X
After that I flashed sdcard.img to an SD card then I add those two lines below to config.txt
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25
I expected to see spi0.0 but I don't see any device in /sys/bus/spi/devices
Can you please help?
Thank you

Related

Why Xorg server fails on system created with Buildroot for Raspberry Pi4?

I am trying to create my own system for Raspberry Pi4 using Buildroot.
Target is to make custom OS with Xorg, Qt5 and OpenGLESv2 HW rendering. I create my custom Buildroot configuration, nothing specific yet. Very similar to default raspberry pi4 buildroot config but enabled Xorg/Mesa/OpenGLES. My config is that:
BR2_arm=y
BR2_cortex_a72=y
BR2_ARM_FPU_NEON_VFPV4=y
BR2_CCACHE=y
BR2_CCACHE_DIR="$(BR2_EXTERNAL_I_TREE_PATH)/../.buildroot-ccache"
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="MyHost"
BR2_TARGET_GENERIC_ISSUE="Welcome to MyHost"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD="4rt56gbd"
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_I_TREE_PATH)/board/rpi4/users.txt"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_I_TREE_PATH)/rootfs_overlay/"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_I_TREE_PATH)/board/rpi4/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_I_TREE_PATH)/board/rpi4/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,967d45b29ca2902f031b867809d72e3b3d623e7a)/linux-967d45b29ca2902f031b867809d72e3b3d623e7a.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_GLMARK2=y
BR2_PACKAGE_MESA3D_DEMOS=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_KMSRO=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XSERVER_XORG_SERVER=y
BR2_PACKAGE_XCB_UTIL_CURSOR=y
BR2_PACKAGE_XCB_UTIL_KEYSYMS=y
BR2_PACKAGE_XCB_UTIL_WM=y
BR2_PACKAGE_XLIB_LIBFS=y
BR2_PACKAGE_XLIB_LIBXSCRNSAVER=y
BR2_PACKAGE_XLIB_LIBXCOMPOSITE=y
BR2_PACKAGE_XLIB_LIBXFONT=y
BR2_PACKAGE_XLIB_LIBXTST=y
BR2_PACKAGE_XLIB_LIBXVMC=y
BR2_PACKAGE_XLIB_LIBXXF86DGA=y
BR2_PACKAGE_XLIB_LIBDMX=y
BR2_PACKAGE_XAPP_X11PERF=y
BR2_PACKAGE_XAPP_XCALC=y
BR2_PACKAGE_XAPP_XCLOCK=y
BR2_PACKAGE_XDRIVER_XF86_INPUT_KEYBOARD=y
BR2_PACKAGE_XDRIVER_XF86_INPUT_LIBINPUT=y
BR2_PACKAGE_XDRIVER_XF86_INPUT_MOUSE=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_FBDEV=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_FBTURBO=y
BR2_PACKAGE_XFONT_FONT_ADOBE_100DPI=y
BR2_PACKAGE_XFONT_FONT_ADOBE_75DPI=y
BR2_PACKAGE_XFONT_FONT_ADOBE_UTOPIA_100DPI=y
BR2_PACKAGE_XFONT_FONT_ADOBE_UTOPIA_75DPI=y
BR2_PACKAGE_XFONT_FONT_ADOBE_UTOPIA_TYPE1=y
BR2_PACKAGE_XFONT_FONT_ARABIC_MISC=y
BR2_PACKAGE_XFONT_FONT_BH_100DPI=y
BR2_PACKAGE_XFONT_FONT_BH_75DPI=y
BR2_PACKAGE_XFONT_FONT_BH_LUCIDATYPEWRITER_100DPI=y
BR2_PACKAGE_XFONT_FONT_BH_LUCIDATYPEWRITER_75DPI=y
BR2_PACKAGE_XFONT_FONT_BH_TTF=y
BR2_PACKAGE_XFONT_FONT_BH_TYPE1=y
BR2_PACKAGE_XFONT_FONT_BITSTREAM_100DPI=y
BR2_PACKAGE_XFONT_FONT_BITSTREAM_75DPI=y
BR2_PACKAGE_XFONT_FONT_BITSTREAM_TYPE1=y
BR2_PACKAGE_XFONT_FONT_CRONYX_CYRILLIC=y
BR2_PACKAGE_XFONT_FONT_DAEWOO_MISC=y
BR2_PACKAGE_XFONT_FONT_DEC_MISC=y
BR2_PACKAGE_XFONT_FONT_IBM_TYPE1=y
BR2_PACKAGE_XFONT_FONT_ISAS_MISC=y
BR2_PACKAGE_XFONT_FONT_JIS_MISC=y
BR2_PACKAGE_XFONT_FONT_MICRO_MISC=y
BR2_PACKAGE_XFONT_FONT_MISC_CYRILLIC=y
BR2_PACKAGE_XFONT_FONT_MISC_ETHIOPIC=y
BR2_PACKAGE_XFONT_FONT_MISC_MELTHO=y
BR2_PACKAGE_XFONT_FONT_MUTT_MISC=y
BR2_PACKAGE_XFONT_FONT_SCHUMACHER_MISC=y
BR2_PACKAGE_XFONT_FONT_SCREEN_CYRILLIC=y
BR2_PACKAGE_XFONT_FONT_SONY_MISC=y
BR2_PACKAGE_XFONT_FONT_SUN_MISC=y
BR2_PACKAGE_XFONT_FONT_WINITZKI_CYRILLIC=y
BR2_PACKAGE_XFONT_FONT_XFREE86_TYPE1=y
BR2_PACKAGE_XDATA_XCURSOR_THEMES=y
BR2_PACKAGE_NODM=y
BR2_PACKAGE_XTERM=y
BR2_PACKAGE_OPENBOX=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
BR2_PACKAGE_RPI_FIRMWARE_X=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_LIBDRI2=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_S6=y
BR2_PACKAGE_S6_LINUX_UTILS=y
BR2_PACKAGE_S6_PORTABLE_UTILS=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_UTIL_LINUX_KILL=y
BR2_PACKAGE_UTIL_LINUX_MOUNT=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
First issue comes with X server.
It starts working but very strange/ubnormal. Xorg logs show me lines:
(II) xfree86: Adding drm device (/dev/dri/card1)
(II) xfree86: Adding drm device (/dev/dri/card0)
(II) no primary bus or device found falling back to sys/devices/platform/gpu/drm/card1
But on normal Raspbian OS X server first adds card0 then card1. And makes fall back to card0. Why my Xorg starts with card1?
I think this is my main issue, because of that later GLX extension does not start. And so I cannot make OpenGLES working in my system.
In my config.txt i have line
dtoverlay=vc4-fkms-v3d
and I belive vc4 drivers start properly because I see /dev/dri/card0 /dev/dri/card1 and /dev/dri/renderD128 devices
Maybe someone had similar experience?
What I am doing wrong?
My fault in question.
I was wrong that issue was in order of /dev/dri/card? adding by Xorg.
Issue was different. xserver built in buildroot needs libglamor enabled? this should be enabled in buildroot config. If enabled then es2_info reports no issue with OpenGLES.. besides that in my case still glmark2-es2 does not work with error "Failed to open bo 1: Permission denied"

Linux dynamic kernel loading with overloading device tree

I want to make my own protocol driver for my custom made spi board. The platform on which I want to attach it is a raspberry Pi4 with arm32. I want to load it dynamically with an overlay device tree.
I can build the driver file but the following isn't clear:
Where should the driver exactly placed? I tried /lib/modules/5.4.79-v7, /lib/modules/5.4.79-v7/build
I made in the config.txt an entry dtoverlays= driver.ko and placed the dtbo under /boot/overlays. Is this correct?
Can the driver be loaded at runtime without a second reboot after I placed the overlay file in the right folder.
Is the driver first loaded if the function "spi_new_device" is called or can it be done in this way?
If I call sudo insmod .ko the driver is loaded with:
rpi4: loading out-of-tree module taints kernel.
The probe function isn't called yet.
Where should the driver exactly placed? I tried /lib/modules/5.4.79-v7, /lib/modules/5.4.79-v7/build
Answer: The driver is placed under /lib/modules/5.4.79-v7/extra if it is an extra module and build with.
make -C /lib/modules/`uname -r`/build M=$PWD modules_install
I made in the config.txt an entry dtoverlays= driver.ko and placed the dtbo under /boot/overlays. Is this correct?
Answer: It can be done in this way with rpi.
Can the driver be loaded at runtime without a second reboot after I placed the overlay file in the right folder.
Answer: If the driver is installed under extra it is not loaded. Also it is not loaded after reboot. The driver must be loaded with "modprobe" but without the extension ".ko". Modprobe search the driver under lib/modules.

ovs2.6: could not create netdev dpdk1 of unknown type dpdk

I am trying to setup OVS2.6 with DPDK16.07. I am following INSTALL.DPDK.md instructions that came under openvswitch-2.6.0.tar.gz. Getting following warning message in ovs-vswitchd.log:
00034|netdev|WARN|could not create netdev dpdk1 of unknown type dpdk
00035|bridge|WARN|could not open network device dpdk1 (Address family not supported by protocol)
Googling little bit shows this issue is faced by earlier ovs version as well, but I didn't find any satisfactory solution.
Any idea what could be rootcause, and how to fix it?
Thanks!
All ports that are to be used by Open vSwitch must be bound to the uio_pci_generic, igb_uio or vfio-pci module before the application is run. Any network ports under Linux control will be ignored by OvS or any DPDK application.
Please check the output of $DPDK_DIR/tools/dpdk-devbind.py scripts with -s parameter. You must see some ports in "Network devices using DPDK-compatible driver" section like below;
$/dpdk-stable-16.07.2/tools$ ./dpdk-devbind.py -s
Network devices using DPDK-compatible driver
============================================
0000:05:00.0 '82571EB Gigabit Ethernet Controller (Copper)' drv=igb_uio unused=e1000e
0000:05:00.1 '82571EB Gigabit Ethernet Controller (Copper)' drv=igb_uio unused=e1000e
I have the same issue as well, and by checking the code I found that before starting ovs-vswitchd, we should use the command below, to initialize dpdk.
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true

How Do I add New ethernet device to Kernel Config file

I wanted to add a new device for Kernel compiled for vexpress board.I would want to see new device option should come under meuconfig program.
make ARCH=arm versatile_defconfig
make ARCH=arm menuconfig
I would want to see TI device support under --Ethernet Driver Support under menuconfig.
Also doing so would allow me to compile .o files related TI driver code provided in Linux kernel?
EDIT: I have added two snapshots of vexpress menuconfig and Keystone menuconfig,I would want to have support for TI devices in vexpress meuconfig which is second snapshot here.
You can edit file: .../drivers/net/Kconfig and add there your entry for enabling TI device:
config TI_ETHER_NET
tristate "TI Ethernet support"
depends on PCI
help
This is my driver for TI device
and then copy your drivers source into .../drivers/net/ and add appropriate entry to Makefile in this directory:
obj-$(CONFIG_TI_ETHER_NET) += your_driver.o

Falied to register i2c-dev module

I'm trying to run some i2c testcases for ltp-ddt on arm board.
I installed i2c-tools, i checked i2c devices in /dev folder,
$ls /dev/i2c-*
/dev/i2c-0 /dev/i2c-1 /dev/i2c-2 /dev/i2c-3.
But, when i try to detect i2c devices by running
$i2cdetect -a 0
its throwing error as,
Error: Could not open file `/dev/i2c-0': No such device or address
Please let me know the valid solution ASAP.

Resources