Skip to contentSkip to conversation

NAND together with SD CARD images

DISCUSSION [email protected] 3 participants 5 messages Jul 21, 2024 – Jul 24, 2024

lore
Share & tools
lore
#0 lore raw

Hello community,
I have a project where I work with two different image recipes. One is meant for production  and targets NAND, another one for SD CARD. The second one is basically a tiny image that contains scripts to flash the NAND with the production image.

My question is: what's the recommended way to manage these two images in terms of MACHINE and UBOOT_CONFIG?

How I did till now: just changed the weak default for UBOOT_CONFIG found in the machine.conf depending on the image I was baking. This does not look good to me because it clutters the deploy dir for the given machine with unrelated build artifacts.

A better alternative comes to my mind: the physical board is just one, so it makes sense that both images should refer to the same MACHINE variable. The machine.conf provides a weak assignment for UBOOT_CONFIG and image recipes should  change its value depending on their needs. But I suspect that since the data store for each recipe (comprised image recipes) is a local coly, such assignment does not work.

Then only two bins are left: mess up the deploy dir as I did till now OR use two different machines with different weak defaults, which I think is somewhat wrong as the hardware is one.

Can you help me sort this out?
Thanks

#1 lore raw

Hello,
we usually declare two different MACINEs, one mymachine-nand.conf and one mymachine-sdcard.conf.

Cheers,
--
Marco Cavallini | KOAN sas
Bergamo - Italia
embedded software engineering
https://KoanSoftware.com

#2 lore raw

Hi Marco,
By further reading around it looks like MACHINE is something that represents a specific board configuration and not a specific board. Names could be tremendously misleading. It looks like this is the recommended approach by NXP too.
Thanks
Bye

Il dom 21 lug 2024, 08:34 Marco Cavallini via Lists.Yoctoproject.Org <[email protected]> ha scritto:

Quoted 11 lines

Hello,
we usually declare two different MACINEs, one mymachine-nand.conf and one mymachine-sdcard.conf.

Cheers,
--
Marco Cavallini | KOAN sas
Bergamo - Italia
embedded software engineering
https://KoanSoftware.com

#3 lore raw
In reply to [email protected]

We usually have one machine and let the bootloader figure it out.

If there are bootswitches to boot from NAND vs SD card, there's usually a way to get at those switches through reading some register. Set U-boot's "boot_targets" based on that, so it tries to boot from that media first.

Another quick way is to just try SD first then revert to NAND boot. The SD check is usually very quick because of the card-detect.

You can create the same image for SD and NAND by setting IMAGE_FSTYPES (to ubifs and ext4 I'd guess). Handy to be able to run directly from SD during development.

To create the "flash the NAND" image, just create a recipe that RDEPENDS on the production image. Add a dependency on "image_complete" and then you can just fetch the image from the deploy directory and pack it in.

So no new machine, just a new image.

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topic.nl

Please consider the environment before printing this e-mail

Quoted 9 lines · On 21-07-2024 03:39, ppanaccio78 via lists.yoctoproject.org wrote:

Hello community,
I have a project where I work with two different image recipes. One is meant for production  and targets NAND, another one for SD CARD. The second one is basically a tiny image that contains scripts to flash the NAND with the production image. My question is: what's the recommended way to manage these two images in terms of MACHINE and UBOOT_CONFIG?
How I did till now: just changed the weak default for UBOOT_CONFIG found in the machine.conf depending on the image I was baking. This does not look good to me because it clutters the deploy dir for the given machine with unrelated build artifacts. A better alternative comes to my mind: the physical board is just one, so it makes sense that both images should refer to the same MACHINE variable. The machine.conf provides a weak assignment for UBOOT_CONFIG and image recipes should  change its value depending on their needs. But I suspect that since the data store for each recipe (comprised image recipes) is a local coly, such assignment does not work.
Then only two bins are left: mess up the deploy dir as I did till now OR use two different machines with different weak defaults, which I think is somewhat wrong as the hardware is one.
Can you help me sort this out?
Thanks

#4 lore raw

Hi Mike,
The approach you describe is really interesting. Especially the part where the "flash the NAND" is made dependant on the nand image. Though this means technicians in the field should flash a new sd card for every new release instead of just scp-ipping the files to the live (old) SD image. Thanks for sharing!

Il mer 24 lug 2024, 13:09 Mike Looijmans <[email protected]> ha scritto:

Quoted 78 lines

We usually have one machine and let the bootloader figure it out.

If there are bootswitches to boot from NAND vs SD card, there's usually a way
to get at those switches through reading some register. Set U-boot's "boot_targets" based on that, so it tries to boot from that media first.

Another quick way is to just try SD first then revert to NAND boot. The SD check is usually very quick because of the card-detect.

You can create the same image for SD and NAND by setting IMAGE_FSTYPES (to ubifs and ext4 I'd guess). Handy to be able to run directly from SD during
development.

To create the "flash the NAND" image, just create a recipe that RDEPENDS on
the production image. Add a dependency on "image_complete" and then you can
just fetch the image from the deploy directory and pack it in.

So no new machine, just a new image.

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topic.nl

Please consider the environment before printing this e-mail

Quoted 2 lines · On 21-07-2024 03:39, ppanaccio78 via lists.yoctoproject.org wrote:

Hello community,
I have a project where I work with two different image recipes. One is

meant

Quoted 1 line

for production and targets NAND, another one for SD CARD. The second

one is

Quoted 3 lines

basically a tiny image that contains scripts to flash the NAND with the production image.
My question is: what's the recommended way to manage these two images in

terms

Quoted 2 lines

of MACHINE and UBOOT_CONFIG?
How I did till now: just changed the weak default for UBOOT_CONFIG found

in

Quoted 1 line

the machine.conf depending on the image I was baking. This does not look

good

Quoted 1 line

to me because it clutters the deploy dir for the given machine with

unrelated

Quoted 2 lines

build artifacts.
A better alternative comes to my mind: the physical board is just one,

so it

Quoted 1 line

makes sense that both images should refer to the same MACHINE variable.

The

Quoted 1 line

machine.conf provides a weak assignment for UBOOT_CONFIG and image

recipes

Quoted 4 lines

should change its value depending on their needs.
But I suspect that since the data store for each recipe (comprised image recipes) is a local coly, such assignment does not work. Then only two bins are left: mess up the deploy dir as I did till now OR

use

Quoted 1 line

two different machines with different weak defaults, which I think is

somewhat

Quoted 3 lines

wrong as the hardware is one.
Can you help me sort this out?
Thanks