I would like to know how to add the can0 driver to the Yocto imx-image-multimedia build image (wic) file for the imx8qmmek. Following the directions from the i.MX Yocto Project User’s Guide document, version L5.4.24_2.1.0, I am able to complete a build and load the wic file to the SD Card, but using an “ip link” command shows no canx nodes. I am using the imx-image-multimedia image since I didn't want the full build image, but did add the Qt libraries and qmake build tools to the base image build. Note, I am building a Qt project for Linux that uses the CAN bus which runs on the imx8qmmek.
So, do I have to config and rebuild the kernel with Yocto to enable the CAN drivers? Or, is there a specific dtb file that I am required to use, such as from the BSP L5.10.0_1.0.0? But, if I need use a specific dtb file, how do I go about using bitbake -c deploy imx-image-multimedia to ensure the dtb file is utilized in the wic image? I would prefer not to have to spend the time using "dd" to load a set of separate images to the SD card.
I did thought about cloning the SD card that came with the imx8qmmek kit, but unfortunately, some of the libraries within the image are too deprecated for what I am using it for.
Thanks.
Solved! Go to Solution.
So I was able to build the imx-boot-imx8qmmek-sd.bin-flash file using the Yocto imx-image-multimedia build per the instructions above. I then created a new SD Card based on the instructions found in section 4.3 of the latest iMX Linux User's Guide, but was unable to boot the SD Card. I used the imx-boot-imx8qmmek-sd.bin-flash and instructions per above and also ensured that the imx8qm-mek.dtb file was included in the first partition of the SD Card. I also used the dtb files, the Image file and rootfs generated from the imx-image-multimedia Yocto build for the SD Card.
One other thing I did try was to flash the imx-image-multimedia wic file to the SD Card and ensured that it booted. But, if I flash the imx-boot-imx8qmmek-sd.bin-flash following the above instructions to the same SD Card flashed with the imx-image-multimedia wic file, it does not boot up. So, I'm guessing either a version mismatch or a sector offset mismatch?
So, what other settings/appends would I need to include in the local.conf file to build a release (wic file) with the imx-boot-imx8qmmek-sd.bin-flash file included? Is there a bitbake command to just deploy and create the wic file? I am assuming that in order to include the imx-boot-imx8qmmek-sd.bin-flash file into the bitbake build, I would need to modify the Yocto recipe which creates the wic file. Where would I find this recipe?
Thanks!
The can driver is related to the kernel. not the rootfs of multi-media or full.
The can driver is enabled by default of the linux kernel.
Why the multi media wic image could not see the can interface on A core side.
Because the bootloader for the default wic image imx-image-multimedia-imx8qmmek.wic is with m4(bootloader imx-boot-imx8qmmek-sd.bin-flash_linux_m4), which assign the can to the m4 side hardware partition.
Please replace the bootloader with imx-boot-imx8qmmek-sd.bin-flash for the imx-image-multimedia-imx8qmmek.wic
Here is the test after replacing the imx-image-multimedia-imx8qmmek.wic bootloader with imx-boot-imx8qmmek-sd.bin-flash
Here is the uuu command or you can use the dd for the sdcard.
emmc: uuu -b emmc_all imx-boot-imx8qmmek-sd.bin-flash imx-image-multimedia-imx8qmmek.wic
binary release script uuu.auto already using the imx-boot-imx8qmmek-sd.bin-flash for emmc
sdcard:uuu -b sd_all imx-boot-imx8qmmek-sd.bin-flash imx-image-multimedia-imx8qmmek.wic
Hi Tony,
Make sure you have the baseboard connected, and that you're using the default dtb "imx8qm-mek.dtb". Once the kernel has booted up you can load the driver with "modprobe flexcan". Let me know if this works for you.
Hi,
Yes, baseboard is connected, but is the file "imx8qm-mek.dtb" the default hardware file for the Yocto build imx-image-multimedia wic file? I ask this because even though modprobe shows the flexcan module, I'm unable to bring up a can node.
With modprobe:
root@imx8qmmek:~# modprobe flexcan
[ 18.700741] CAN device driver interface
But, if I do the following, I receive an error:
root@imx8qmmek:~# ip link set can0 up
Cannot find device "can0"
Is there a udev rule or script that I need to bring up the can0 to can2 devices with? Or, do I have to create an SD card image manually with a separate u-boot and rootfs partition?
Note, I did try the LF_v5.10_1.0.0 version of the imx-image-multimedia wic file, but had the same results as I mentioned above.
Thanks,
Tony
So I believe the issue is that the prebuilt boot container in Yocto partitions the SoC in such a way that the M4 has control over the CAN subsystem.
Please try the following in Yocto:
- add this line to the bottom of local.conf - IMXBOOT_TARGETS_imx8qmmek_append = " flash"
- rebuild the image with bitbake imx-image-multimedia, or whatever image you were building previously
- once the build completes, you should see "imx-boot-imx8qmmek-sd.bin-flash" in the images directory
Insert the SD card with your Linux image into your host machine, and run the following dd command to reprogram the boot container with this new image:
- sudo dd if=<path to imx-boot-imx8qmmek-sd.bin-flash> of=/dev/sdX bs=1k seek=32 && sync, where sdX is the SD card device as enumerated on your machine
Once the above steps are completed you should be able to boot up into Linux with the default dtb, verify the flexcan module is loaded, and then run ifconfig -a to see the CAN interfaces.
Hello,
It took me some time but I was able to make a full Yocto build for my iMX8MP SBC with the instructions provided for the local.conf file as suggested and for my target MPU. I do get the following prompt:
Just an update, using the command "wic ls" does show that the mx8qm-mek.dtb is included in the boot partition. So, I'm guessing either there is another file missing (scfw?) in the boot partition or, there is a udev rule or script that is not included in the rootfs?
Tony
So I was able to build the imx-boot-imx8qmmek-sd.bin-flash file using the Yocto imx-image-multimedia build per the instructions above. I then created a new SD Card based on the instructions found in section 4.3 of the latest iMX Linux User's Guide, but was unable to boot the SD Card. I used the imx-boot-imx8qmmek-sd.bin-flash and instructions per above and also ensured that the imx8qm-mek.dtb file was included in the first partition of the SD Card. I also used the dtb files, the Image file and rootfs generated from the imx-image-multimedia Yocto build for the SD Card.
One other thing I did try was to flash the imx-image-multimedia wic file to the SD Card and ensured that it booted. But, if I flash the imx-boot-imx8qmmek-sd.bin-flash following the above instructions to the same SD Card flashed with the imx-image-multimedia wic file, it does not boot up. So, I'm guessing either a version mismatch or a sector offset mismatch?
So, what other settings/appends would I need to include in the local.conf file to build a release (wic file) with the imx-boot-imx8qmmek-sd.bin-flash file included? Is there a bitbake command to just deploy and create the wic file? I am assuming that in order to include the imx-boot-imx8qmmek-sd.bin-flash file into the bitbake build, I would need to modify the Yocto recipe which creates the wic file. Where would I find this recipe?
Thanks!