How to customize system software for a custom board?

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

How to customize system software for a custom board?

636 Views
chillinwithscb
Contributor III

I need a version of the Linux-kernel based OS for a custom imx8m nano system. IDK how to go about doing that. I've read i.MX Yocto Project User's Guide many times. Don't understand much of it. Lots of info, but little on how to use the info. Talks about creating a custom distro. What's a distro? Talks about creating a custom board config. What a board config? Talks about creating a custom yocto layer. What's that? Talks about alot of stuff as if I might know what it is.

I've read many other docs, taken online classes. Have no idea where to start.

What I know is that the package from NXP (L6.12.3-1.0.0_MX8MN) works good for me on the nano EVK. I know I need to modify the SPL and the device tree for my custom system. How do I modify those things without worrying about the other 99.99% of the OS.

Do I have to create a custom distro, custom board config, custom yocto layer? How does anything of that help me accomplish what I want to do?

This stuff is insanely complicated and I cannot find anything that helps me understand it.

0 Kudos
Reply
3 Replies

627 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @chillinwithscb 

 

I hope you are doing very well.

 

I know, at first these topics are very complicated and sometimes the documentation is not enough to decide where to start.

NXP has an exact document called i.MX Porting Guide, where is described how to create a custom solution for a custom board with our BSP (Yocto Linux).

There is explained the steps to achieve what you want, from porting U-boot (U-boot is the bootloader), porting Linux kernel, porting audio codecs, Peripherals and configure IOMUX.

Also, you can read about the architecture of the i.MX8M Mini, and you will see you can omit the chapter 4 Porting System Controller Firmware.

If you have an specific doubt when developing your project you can ask and I will be happy to help and try to solve the issue (related to the BSP, i.MX processor or NXP software).

 

I hope this can helps to you.

 

Best regards,

Salas.

 

0 Kudos
Reply

618 Views
chillinwithscb
Contributor III

I have so many questions. Surely this will be too much for you.

I've read the porting guide too.  It starts with talk of standalone build. Why? No idea. What is the value of the standalone build if there's a yocto build? I did run the standalone build, but don't know what it gets me. Instructions are useless I have a reason to follow them.

I don't know how to install the files from the standalone build.

WRT "By default, i.MX U-Boot loads kernel image and device tree blob from the first FAT partition." so what? and how do i know whether default applies to me?

WRT "Users can copy their images to this partition" How would a user do that?

WRT "Alternatively, users can flash images to the RAW address for U-Boot loading." huh?

WRT "To flash the kernel generated from the build, execute the following commands: $ sudo dd if=<zImageName> of=/dev/sd<partition> bs=512 seek=2048 conv=fsync && sync" What is a zImageName? Based on "For i.MX 8, compressed images are not supported by U-Boot, and Image file must be used, not Image.gz." maybe zImageName is "Image.gz" (why not just say that? and for IMX8 I'm supposed to use "Image"; which I guess is _not_ zImageName.

I know what sd<partition> means, but how does the build host access the eMMC of the target like that? ... oh, I think these instructions are for writing to an SD card. OMG why doesn't it just say that. Why do I have to guess? Anyway, the target system does not have an SD card reader. These instructions are useless.

WRT "To flash the device trees generated from the build, execute the following commands: $ sudo dd if=.dtb of=/dev/sd bs=512 seek=20480 conv=fsync". Device trees? I thought there was exactly one.

I thought UUU was for installing. How can I use UUU with the standalone build?

Then it talks about the yocto build. Should I use both standalone and yocto? Or should I pick one. How do I pick?

WRT "MACHINE=imx6qsabresd bitbake linux-imx" Isn't the machine setup before you run bitbake? What is "linux-imx" I realize it says that an example command, but it's so unfamiliar I don't see how it's an example of anything useful.

WRT "The new i.MX custom board is a part of the U-Boot source tree, but it is a duplicate of the i.MX reference board code and needs to be customized." huh? what new board? which u-boot source tree? duplicate?

Much of the doc is incomprehensible to me. Maybe some understand it. But it's gibberish to me. I need another source for this information. I've looked, but to date have found nothing. Manufacturer docs are typically terrible. I'm used to that. But, I usually can find another source of information. 

I certainly can ask many questions about the NXP docs. But, I'd rather find a different source of info. I feel I'm wasting time trying to decipher them.

0 Kudos
Reply

594 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @chillinwithscb 

I will try to answer all your doubts.

 

1. Standalone Build vs. Yocto Build

Standalone build: Think of it as just building the Linux kernel (and maybe device trees) directly from the kernel source tree using make. Useful when you are doing kernel changes, debugging drivers, or do not want to rebuild an entire Yocto image for every change.

Yocto build: This is like a "Image factory" . Yocto builds the full rootfs, kernel, U-Boot in a structured way. Use this when you are building a full system image.

In a few words, use Yocto for producing the final image that you flash to your device. Use the standalone build when you are developing a driver, tweaking the kernel, or doing fast experiments or changes. 

 

2. I ran standalone build, now what?

When you build the kernel on standalone, it gives to you the kernel image (Image or zImage), your device tree (.dtb) and modules that can be Custom or included into the kernel.

 

Then, you can install those on the boot partition directly in your SD card or using the UUU tool.

 

3. By default, U-Boot loads from first FAT partition, so what?

That’s only useful if your board is booting from SD card or eMMC with a FAT partition (often /dev/mmcblk0p1). U-Boot expects to find Image and .dtb files.

You will see something like this on the U-boot logs:

reading Image from mmc 0:1...

 

That means U-boot is loading the image from first FAT partition.

 

4. Users can copy images to this partition, how?

Yes, this is easy like:

If using the SD directly in Host:

$ sudo cp Image yourboard.dtb /media/you/boot/

 

In U-boot:

$ ums 0 mmc 0

This will change the board to USB mass storage, and you can drag your files to the boot partition.

 

5. Flash to RAW address – huh?

This is for writing directly to flash offsets (not filesystems). Think of it as "writing straight into memory".

UUU helps to avoid this.

 

6. zImage vs Image vs Image.gz?

zImage: Compressed kernel. Don't use on i.MX8.

Image: Uncompressed kernel. This is what U-Boot on i.MX8 expects.

Image.gz: Gzipped kernel.

For i.MX8 use Image.

image.png

And yes, that kind of command if for SD cards. But again, you can avoid it using UUU tool.

 

7. Device trees? I thought there was one?

U-boot loads the device tree for the kernel, and you can change it before to boot, so, that is the reason you can to have many device trees.

You can refer to this community post to more information about how to flash device trees and Linux Images.

Also, that post can answer your question: "I thought UUU was for installing. How can I use UUU with the standalone build?".

 

8. Yocto vs Standalone – pick one or both?

Use both. Yocto for production, standalone for development.

 

 

9. bitbake linux-imx – what is that?

image.png

Yes, you usually source the environment (source setup-environment), then use:

$ bitbake imx-image-full

 

That tells bitbake to build the Linux kernel (recipe = imx-image-full).
MACHINE=yourboard selects the hardware configuration.

 

 

10. What new board? Which U-Boot tree?


This is referring to when you clone U-Boot and create a custom board definition (e.g., your own .h and .c files for board init). They suggest you copy from a similar reference board and start modifying.

 

Finally, we are working to improve our documentation and it can be read for beginners, advanced and experts users, but at this moment, our guides are all we have available to share with customers.

 

I hope this can helps to you.

 

Best regards,

Salas. 

0 Kudos
Reply