0

I have built Linux Kernel 5.10.36-v8 using Buildroot and using it into my Raspberry Pi 4B for the past few weeks. I recently wanted to enable SPI ports on the Raspberry Pi and followed the instructions in this link: https://elinux.org/RPi_SPI and modified my boot/config.txt. Unfortunately, I do not see a /dev/spidev0.x entry. I am not sure what I am missing here. I added an extra UART by the same method and that works perfectly fine, as I can see a /dev/ttyAMA1 appearing when I rebuild and load the kernel.

FYI, This is the content of my config.txt file:

# Please note that this is only a sample, we recommend you to change it to fit
# your needs.
# You should override this file using a post-build script.
# See http://buildroot.org/manual.html#rootfs-custom
# and http://elinux.org/RPiconfig for a description of config.txt syntax

# We always use the same names, the real used variant is selected by
# BR2_PACKAGE_RPI_FIRMWARE_{DEFAULT,X,CD} choice
start_file=start.elf
fixup_file=fixup.dat

kernel=Image

# To use an external initramfs file
#initramfs rootfs.cpio.gz

# Disable overscan assuming the display supports displaying the full resolution
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1

# How much memory in MB to assign to the GPU on Pi models having
# 256, 512 or 1024 MB total memory
gpu_mem_256=100
gpu_mem_512=100
gpu_mem_1024=100

# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console
dtoverlay=miniuart-bt

# enable 64bits support
arm_64bit=1

# Enable Uart-5
enable_uart=1
dtoverlay=uart5

# Enable I2C
dtparam=i2c_arm=on

# Enable SPI0 with 1 CS
dtparam=spi=on
dtoverlay=spi0-1cs

# Enable SPI1 with 1 CS
dtoverlay=spi1-3cs

The kernel config file has these entries:

CONFIG_SPI=y
CONFIG_SPI_BCM2835=m
CONFIG_SPI_BCM2835AUX=m
CONFIG_SPI_GPIO=m
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_SLAVE=y

Also my \overlays folder has the built spi0-1cs.dtbo type files and so I assume that it gets built into my final image. But I don't see any entry in /sys/bus/spi/devices or /sys/class/spi_master or spi_slave.

When I install Raspbian lite version on my SD card and try doing the same change in boot/config.txt, I can see the spidev0.x and spidev1.x appearing in /dev directory. So it is quite apparent that I am missing some trivial step while building my own kernel & filesystem using buildroot. Can someone please guide me through this?

2 Answers 2

1

You might want to consider using the "official" documentation rather than documentation derived from the official docs. I don't know much about building kernels, but the rpi-update utility may serve your purposes as well as building the kernel yourself.

0

The issue got resolved. The default setting of buildroot did not enable the following configuration:

BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y

This was causing the spidev modules to not load, even when they were built in the kernel. After adding the above configuration and rebuilding the kernel, the /dev/spidev0.x and /dev/spidev1.x appeared.

I got help from Issues tab in Github repository of Raspberry pi and here is the Issues link, in case more details are needed on how I figured it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.