Require guidance to create .wic image with my Customising image and dtbs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Require guidance to create .wic image with my Customising image and dtbs

Jump to solution
3,002 Views
kamalesh
Contributor II

Hi,

Actually i am new to this community. I have a imx 8m quad dev kit. I have succesfully flashed the image using uuu tool. I have applied uuu uuu.auto file. It flashed the kernel-5.10.72 image to board through emmc.

I have tried this link from yocto porting guide $ git clone https://source.codeaurora.org/external/imx/linux-imx. But there is no directory. Then i have downloaded manually and added my driver, device tree. Finally i have created the image, modules, dtbs using the make Image, make modules, make dtbs.

Now i am facing difficulties, how to flash this customized one, where we need to place the files.

Could you please direct me to the right direction?
Please share any related document.

Thanks.

Regards,
Kamalesh

Labels (1)
0 Kudos
Reply
1 Solution
2,559 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the patch I provided in my previous post.

Please continue to discuss the Linux driver porting problem in your new thread.

Thanks.

View solution in original post

0 Kudos
Reply
22 Replies
2,805 Views
yipingwang
NXP TechSupport
NXP TechSupport

First of all, please deploy SD card with the following command.

$ sudo dd if=*.wic of=/dev/sdx bs=1M && sync

Please refer to the following procedure on your host PC to deploy your custom images.

1. Format partition 1 on the card as VFAT with this command:
$ sudo mkfs.vfat /dev/sdx1

2. Mount the formatted partition with this command:
$ mkdir mountpoint
$ sudo mount /dev/sdx1 mountpoint

3. Copy the Image and *.dtb files to the mountpoint by using cp. The device tree names should match the one used by the variable specified by U-Boot. Unmount the partition with this command:
$ sudo umount mountpoint

For Kernel module, please deploy them to rootfs partition.

$ mkdir /home/user/mountpoint
$ sudo mount /dev/sdx2 /home/user/mountpoint

$ cd /home/user/mountpoint

Then copy Kernel modules to folder lib/modules/6.12.3-lts-next-g24e49103b666/kernel/

Please refer to section "4.3.5 Copying the kernel image and DTB file" in https://www.nxp.com.cn/docs/en/user-guide/IMX_LINUX_USERS_GUIDE.pdf

0 Kudos
Reply
2,796 Views
kamalesh
Contributor II
Hi yipingwang,
Thanks for your quickly reply.
Actually i have some doubts.
I have extracted this LF_v5.10.72-2.2.3_images_IMX8MQEVK.zip.

From this I have flashed the uuu.auto file using emmc. In this file, they have used imx-image-full-imx8mqevk.wic(which is kerenel 5).

Can i use the same image for these procedure which received from you?

Regards,
Kamalesh
0 Kudos
Reply
2,794 Views
yipingwang
NXP TechSupport
NXP TechSupport

If you are using emmc, you could did the above procedure on the target board.

Please use /dev/mmcblk0p1 to replace /dev/sdx1 

Please use /dev/mmcblk0p2 to replace /dev/sdx2 in the above procedure.

0 Kudos
Reply
2,789 Views
kamalesh
Contributor II
Hi,
I have connected my board with my host pc. I have done the dip switch as 1100 for detection.
For lsusb,
lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 04f3:0c4f Elan Microelectronics Corp. ELAN:Fingerprint
Bus 003 Device 002: ID 0408:4033 Quanta Computer, Inc. ACER HD User Facing
Bus 003 Device 011: ID 1fc9:012b NXP Semiconductors i.MX 8M Dual/8M QuadLite/8M Quad Serial Downloader
But, It did not detected as mmcblk0p1. what to do.

I will clearly explain my position now. I have extracted the linux-imx directory from NXP github.

I have compiled the image, modules, dtbs and root file systems as per my requirement.
Now i want to merge these files and have to see camera video node created or not.

Note:- I have compiled the linux-imx directory and created the rootfs in the name of 5.10.72-dirty.

How to proceed?

Thanks for your quick support.

Regards,
Kamalesh
0 Kudos
Reply
2,786 Views
yipingwang
NXP TechSupport
NXP TechSupport

As you mentioned previously, you have used UUU to program the pre-built .wic image to emmc on the target board. After booting up to Linux on the target board, you will find the following information after run command "fdisk -l" command.

Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x076c4a2a

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 16384 697957 681574 332.8M c W95 FAT32 (LBA)
/dev/mmcblk0p2 704512 19152713 18448202 8.8G 83 Linux

0 Kudos
Reply
2,772 Views
kamalesh
Contributor II


Hi,
I have checked in my imx8m quad dev kit. Two partition detected as your statement.
I have to do the all procedure  in this development kit board right?

Regards,
kamalesh

0 Kudos
Reply
2,746 Views
yipingwang
NXP TechSupport
NXP TechSupport

You could deploy your custom images to emmc with the following procedure on the target board.

1. Mount the formatted partition with this command:
$ mkdir mnt
$ sudo mount /dev/mmcblk0p1  mnt

2. Copy the your Image and *.dtb files to the mnt folder by using cp. The device tree name should be same as the original. Unmount the partition with this command:
$ sudo umount mnt

For Kernel module, please deploy them to rootfs partition.

$ mkdir mnt
$ sudo mount /dev/mmcblk0p2 mnt

$ cd mnt

Then copy Kernel modules to folder lib/modules/*/kernel/

0 Kudos
Reply
2,761 Views
bernhardfink
NXP Employee
NXP Employee

The SD card is just a good analogy to understand the situation on an eMMC. If you have a Linux PC and an SD card, you can program the SD card with the *.wic image like this:

 

$ sudo dd if=*.wic of=/dev/sdx bs=1M && sync

 

The wic file is a complete storage image, containg everything from the first to the last byte (a kind ISO file). So everything is written at once.

You can now inspect the structure and the content of the SD card on your Windows or Linux PC:

bernhardfink_1-1739198732816.png

The boot image partition can be changed with low level utilities, the other two partitions have a file system (FAT and ext4) and can be changed easily form a Windows or Linux OS.

The same would apply to an eMMC if you would be able to connect it to a PC. It's fixed to the i.MX 8M Plus, so you can see the 8M Plus as the Linux PC which allows you to work on these three partitions. What I do for example:

  • I update my DTS file on the Linux PC and copy the resulting DTS file on a USB stick
  • I boot Linux on the 8M Plus and connect the USB stick
  • Replace the DTB file on the second partition with the new file from the USB stick

You could do the same with the Linux kernel ( = Image).

Updating things in the root fs is working in the same way until you run out of space on the partition. For example if you wnat to have a test video in the home directory, take one from a PC and transfer it to the root fs using a USB stick.

In case you have no option to connect a USB stick, you could maybe realize a connection over ethernet.

Updating things on the first partition is more complicated, if you renew one of the components there (for example the LPDDR4 training firmware), then you need to re-package all involved components using the imx-mkimage utility.

Maybe you find one or the other interesting command in this article:  https://www.emcraft.com/som/imx-8m/booting-linux-from-emmc

Regards,
Bernhard.

 

0 Kudos
Reply
2,739 Views
kamalesh
Contributor II
Hi yipingwang and bernhardfink,

Thank you for the technical explanation. This forum will be useful for everyone.

I have successfully replaced my custom BSP files in the i.MX8M Quad development kit.

Could you please help resolve my doubts below?

I have flashed the image imx-image-multimedia-imx8mqevk.wic and uploaded my driver as well as the device tree to the correct path. I checked lsmod, and only my driver is loaded. In the original DTS (DTB), my information is also present.

However, the video node is not being created. There are already four default video nodes. My driver is a universal driver for my camera chip. Is a universal driver sufficient to create the video node?

Please help me resolve these queries.

Regards,
Kamalesh
0 Kudos
Reply
2,736 Views
yipingwang
NXP TechSupport
NXP TechSupport

Would you please create a new thread to address your current problem?

Please describe your modification for Kernel and dts in details.

Please provide your Linux console log.

0 Kudos
Reply
2,731 Views
kamalesh
Contributor II
I will create new thread for my current issue.

Below is the procedure.
I have flashed imx-image-multimedia-imx8mqevk.wic to my dev kit. As per your statement. I have mounted the mmcblk0p1 to one folder, then i have replaced my custome image(Image) and device tree9imx8mq-evk.dtb) in mmcblk0p1 mounted folder.
I mounted the mmcblk0p2 in another folder, then i have replaced the customized kernel/* files.
Finally umounted this mmcblk0p1 and mmcblk0p2 folder.

Then sudo reboot.
Are you asking my dmesg kernel messages?

Regards,
Kamalesh.
0 Kudos
Reply
2,727 Views
yipingwang
NXP TechSupport
NXP TechSupport

Yes, please also provide Linux Kernel booting up log.

0 Kudos
Reply
2,663 Views
kamalesh
Contributor II

Hi,
Sorry for the late reply. Here I attached the boot log and Kernel log(dmesg).
Please review and give comments.

Regards,
kamalesh

0 Kudos
Reply
2,660 Views
yipingwang
NXP TechSupport
NXP TechSupport

What Linux driver do you use in your Kernel?

Would you please provide your Linux Kernel configuration file?

Have you add the device node in dts file?

Would you please describe your modification regarding Linux Kernel and dts in details?

0 Kudos
Reply
2,604 Views
kamalesh
Contributor II
Hi,

I am using Universal driver for LT9211 which I have received from vendor itself.
Kernel configuation file means config.gz right?
I will attach these file in my next one.
Yes, I have added device tree details.
&mipi_csi_1 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
port {
mipi1_sensor_ep: endpoint@0 {
remote-endpoint = <&lt9211c_mipi1_ep>;
data-lanes = < 0 1 2 3 >;
bus-type = <4>;
};

csi1_mipi_ep: endpoint@1 {
remote-endpoint = <&csi1_ep>;
};
};
};

&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";

lt9211c_mipi: lt9211c_mipi@2d {
compatible = "lontium,lt9211c";
reg = <0x2d>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_csi1_pwn>;
clocks = <&clk IMX8MQ_CLK_CLKO2>;
clock-names = "csi_mclk";
assigned-clocks = <&clk IMX8MQ_CLK_CLKO2>;
assigned-clock-parents = <&clk IMX8MQ_SYS2_PLL_200M>;
assigned-clock-rates = <20000000>;
csi_id = <0>;
reset-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
mclk = <20000000>;
mclk_source = <0>;
port {
lt9211c_mipi1_ep: endpoint {
remote-endpoint = <&mipi1_sensor_ep>;
};
};
};
};


Yes, Below I have given my procedure.
1) I have downloaded the linux-imx directory from github.
2) I have added my driver file(LT9211.c), Makefile and Kconfig files under /kernel/media/i2c/ and made configurations in menuconfig file.
3) I have modified or included my lt9211 details in /arch/arm64/boot/dts/freescale/ directory. (imx8mq-evk.dts file)
4) Finally i have compiled for image, modules, dtbs and drivers.
5) After this I have flashed the raw image.wic from Downloaded file of LF_v5.10.72-2.2.3_images_IMX8MQEVK.zip.
6) Then i have replaced the kernel(rootfs), Image and dts file.

Thanks.

Regards,
Kamalesh
0 Kudos
Reply
2,391 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please build LT9211 driver into Linux Kernel rather than building it as a Kernel module.

In addition, please refer the this patch

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Patch-for-LT9211-bridge-on-i-MX/ta-p/168...

If your problem persists, would you please create a new thread to discuss you Linux Kernel driver porting? It's not related with images deployment. 

0 Kudos
Reply
2,386 Views
kamalesh
Contributor II
Hi,
I have created new forum. In my case, LT9211 bridge is using as lvds to mipi camera bridge.

Thanks for your support.

Regards,
kamalesh
0 Kudos
Reply
2,602 Views
kamalesh
Contributor II

Hi,

Please find the attachment of kernel configuration file.

Thank you.

Tags (1)
0 Kudos
Reply
2,387 Views
yipingwang
NXP TechSupport
NXP TechSupport

In Kernel configuration, please do the following modification, then rebuild Linux Kernel image.

CONFIG_VIDEO_LT9211C=m

=>

CONFIG_VIDEO_LT9211C=y

In your current environment, please try to insert Kernel module for LT9211C manually with "insmod  *.ko".

0 Kudos
Reply
2,384 Views
kamalesh
Contributor II
Hi,
Yes, I have given. I can able to see the kernel message driver succesfully loaded , after loaded the driver using insmod.

But our driver is a universal one. There is no v4l2 registration is present in our driver. Whether this may be the reason for not creating video node?

Regards,
Kamalesh
0 Kudos
Reply