Add I2C EEPROM slave driver

I’m looking to add the I2C EEPROM slave driver support to the kernel to test software using a EEPROM before the hardware is ready. Has there been any changes to how we go about adding kernel configuration to TorizonOS? Previously, we ask in the forum and it gets added in the next releases (quickly and hassle free I’d like to add).
Here is what I’d like to see added to the kernel config:

output from `tdx-info`
Software summary
Bootloader:               U-Boot
Kernel version:           5.15.148-rt74-6.6.0-devel-6.6.0-devel+git.23a8e831749d #1-TorizonCore SMP PREEMPT_RT Tue Aug 9 12:56:10 UTC 2022
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/6dd2716bd77820e55b72fffa4e8bdfd2589e7122d9af2ed593c29bd33f4a0fd2/0
Distro name:              NAME="TorizonCore with PREEMPT_RT"
Distro version:           VERSION_ID=6.6.0-devel-20240522193205-build.0
Distro variant:           VARIANT="Custom Image"
Hostname:                 verdin-imx8mm-06902102

Hardware info
HW model:                 Custom on Dahlia Board using Verdin iMX8M Mini WB 
Toradex version:          0055 V1.1B
Serial number:            06902102
Processor arch:           aarch64

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


To add the I2C EEPROM slave driver support to the kernel in TorizonOS, you have a couple of options depending on whether the driver is already supported in the Linux kernel source (in-tree) or if it’s an out-of-tree driver. Since you’re interested in adding a kernel configuration, it sounds like the driver is in-tree.

For in-tree drivers like the I2C EEPROM slave driver, the process involves enabling the kernel configuration option you mentioned (CONFIG_I2C_SLAVE_EEPROM). The choice between =y and =m depends on whether you want the driver to be built into the kernel or as a module that can be loaded and unloaded at runtime. Building it as a module (=m) offers more flexibility, allowing you to insert or remove the driver without rebooting. However, if this driver is critical for your application and will always be needed, building it into the kernel (=y) might make sense.

Given the information from tdx-info, you’re working with a PREEMPT_RT kernel version 5.15.148 on a Verdin iMX8M Mini WB, which is a fairly recent setup. To add or modify kernel configurations in TorizonCore, you would typically need to rebuild the kernel with the desired configuration changes. Since TorizonCore is provided as a binary distribution, direct modification of the kernel configuration isn’t as straightforward as it would be in a traditional Yocto Project/OpenEmbedded development environment where you have full control over the build process.

However, Toradex provides mechanisms to customize the TorizonCore images, including the kernel. One approach is to use the TorizonCore Builder Tool, which allows for customizations such as adding device tree overlays, changing the kernel image, or modifying the kernel command line. While the TorizonCore Builder Tool primarily focuses on device tree customizations and deploying containers, kernel modifications require a more involved process, including recompiling the kernel with your configuration changes.

For your specific request, the process would involve:

  1. Preparing the Kernel Source: Clone the Toradex kernel source for your specific version of TorizonCore.
  2. Modifying the Kernel Configuration: Use make menuconfig or edit the .config file directly to enable CONFIG_I2C_SLAVE_EEPROM as either =m or =y.
  3. Rebuilding the Kernel: Compile the kernel with your new configuration.
  4. Deploying the Kernel: Use the TorizonCore

Please, also check if these links can help you solve your problem:

Building External Kernel Modules With Torizon | Toradex Developer Center.

Greetings @mckay,

Previously, we ask in the forum and it gets added in the next releases

We still do this. Is that what you would like here as well? If yes, I can go ahead and put in the request to enable CONFIG_I2C_SLAVE_EEPROM. As a note we only enable kernel configs as m with this process, is that okay for you here?

Best Regards,

Yes, please. The m flag is good for us.

Alright, I’ll go ahead and put in the request. Will let you know once there is an update.

Hi @mckay,

Just wanted to let you know our team was able to go ahead and enable this configuration for you as a kernel module:

$ zcat /proc/config.gz | grep CONFIG_I2C_SLAVE_EEPROM

This should be available in our images starting from the Torizon June 14th nightly image onward.

Best Regards,