Failed to build custom module (lp5521) with torizoncorebuilder


I try to cross compile lp5521 ( leds-lp5521.c « leds « drivers - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules via torizoncorebuilder build command.

But got this error:

=> Building module located at 'lp5521_src/'
make: Entering directory '/workdir/lp5521_src'
make -C /storage/linux M=/workdir/lp5521_src
make[1]: Entering directory '/storage/linux'
  AR      /workdir/lp5521_src/built-in.a
  CC [M]  /workdir/lp5521_src/lp5521.o
/workdir/lp5521_src/lp5521.c: In function ‘store_current’:
/workdir/lp5521_src/lp5521.c:504:6: error: implicit declaration of function ‘strict_strtoul’ [-Werror=implicit-function-declaration]
  504 |  if (strict_strtoul(buf, 0, &curr))
      |      ^~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c: At top level:
/workdir/lp5521_src/lp5521.c:596:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lp5521_init_led’
  596 | static int __devinit lp5521_init_led(struct lp5521_led *led,
      |                      ^~~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:640:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lp5521_probe’
  640 | static int __devinit lp5521_probe(struct i2c_client *client,
      |                      ^~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:747:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lp5521_remove’
  747 | static int __devexit lp5521_remove(struct i2c_client *client)
      |                      ^~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:777:12: error: ‘lp5521_probe’ undeclared here (not in a function); did you mean ‘lp5521_group’?
  777 |  .probe  = lp5521_probe,
      |            ^~~~~~~~~~~~
      |            lp5521_group
/workdir/lp5521_src/lp5521.c:778:13: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]
  778 |  .remove  = __devexit_p(lp5521_remove),
      |             ^~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:778:25: error: ‘lp5521_remove’ undeclared here (not in a function); did you mean ‘lp5521_set_mode’?
  778 |  .remove  = __devexit_p(lp5521_remove),
      |                         ^~~~~~~~~~~~~
      |                         lp5521_set_mode
/workdir/lp5521_src/lp5521.c:583:13: warning: ‘lp5521_unregister_sysfs’ defined but not used [-Wunused-function]
  583 | static void lp5521_unregister_sysfs(struct i2c_client *client)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:577:12: warning: ‘lp5521_register_sysfs’ defined but not used [-Wunused-function]
  577 | static int lp5521_register_sysfs(struct i2c_client *client)
      |            ^~~~~~~~~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:305:12: warning: ‘lp5521_detect’ defined but not used [-Wunused-function]
  305 | static int lp5521_detect(struct i2c_client *client)
      |            ^~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:290:13: warning: ‘lp5521_led_brightness_work’ defined but not used [-Wunused-function]
  290 | static void lp5521_led_brightness_work(struct work_struct *work)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:282:13: warning: ‘lp5521_set_brightness’ defined but not used [-Wunused-function]
  282 | static void lp5521_set_brightness(struct led_classdev *cdev,
      |             ^~~~~~~~~~~~~~~~~~~~~
/workdir/lp5521_src/lp5521.c:237:12: warning: ‘lp5521_configure’ defined but not used [-Wunused-function]
  237 | static int lp5521_configure(struct i2c_client *client)
      |            ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/ /workdir/lp5521_src/lp5521.o] Error 1
make[1]: *** [Makefile:1734: /workdir/lp5521_src] Error 2
make[1]: Leaving directory '/storage/linux'
make: *** [Makefile:6: all] Error 2
make: Leaving directory '/workdir/lp5521_src'
Traceback (most recent call last):
  File "/builder/tcbuilder/backend/", line 89, in build_module"""PATH=$PATH:{toolchain} KERNEL_SRC={linux_src} KDIR={linux_src} \
  File "/usr/lib/python3.9/", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'PATH=$PATH:/storage/toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin KERNEL_SRC=/storage/linux KDIR=/storage/linux             CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=arm64 make -C /workdir/lp5521_src' returned non-zero exit status 2.

Error: Error building kernel module(s)!

Here are the tcbuild.yml and Makefile I used
Makefile (305 Bytes)
tcbuild.yaml (2.5 KB)

Greetings @cifengfang,

Some points to go over here. First of all TorizonCore Builder was designed to integrate out-of-tree kernel modules not in-tree. While it can work on in-tree kernel modules it’s not a guarantee it will work perfectly.

Secondly, if you want this kernel module you could just request us to add it by default. Though this would only get added to the latest version of Torizon OS and I see from your tcbuild.yaml you’re on 5.7.2. But if you’re okay with moving versions, then us adding the module would probably be simpler.

Finally, are you trying to build the source from the colibri branch of our Linux kernel? You should always try to build the source that matches the version of the Linux kernel you are using. 5.7.2 uses this branch toradex_5.4-2.3.x-imx, the code is completely different here

Best Regards,

Hi @jeremias.tx, Thanks for your explanation. I think we are fine with using the latest Torizon OS. Can you reach to your team to add the lp5521 module to a nightly release? Thanks!

Can you reach to your team to add the lp5521 module to a nightly release? Thanks!

Alright I’ve put in the request to our team to enable CONFIG_LEDS_LP5521 as a kernel module. I’ll let you know here once I have news to share. Typically I would expect to hear back in about a week (at most).

Best Regards,

@cifengfang Happy to inform you that our team has added this driver as kernel module as seen here:

zcat /proc/config.gz | grep CONFIG_LEDS_LP5521

This was on the January 27th nightly:

TorizonCore 6.6.0-devel-20240127+build.496

So any nightly image newer than this should also have the option enabled. This option will also be enabled for the following releases as well.

Best Regards,

Hi @jeremias.tx, thanks for the image update. I’m trying to get the devicetree source file from the new images but got below information:

(base) cxl@TorizonDrive:~/Tezi57$ torizoncore-builder dt checkout

> The TorizonCore Builder team is re-evaluating the device tree and device tree overlays workflow, and the dt checkout command is currently not supported on TorizonCore 6. Learn how to clone the device trees and overlays repositories on

It seems like the dt checkout is not available for Tezi 6 yet, so where should I download the source file for the dt-bindings.
Thanks for your help!

On that article that gets linked, scroll down there is a section on how and where to clone the source repositories: Device Tree Overlays on Torizon | Toradex Developer Center

Best Regards,