mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* FIT support: node syntax
@ 2016-01-06 11:23 Yegor Yefremov
  0 siblings, 0 replies; only message in thread
From: Yegor Yefremov @ 2016-01-06 11:23 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: barebox, Trent Piepho

Hi Marc,

I've looked at U-Boot source code to get the idea, how to pass configuration id.

See this definition:

kernel@1 {
description = "Vanilla Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0x80200000>;
entry = <0x80200000>;
hash@1 {
algo = "crc32";
};
hash@2 {
algo = "sha1";
};
};

One can see two hash nodes: hash@1 and hash@2.

See this routine, that extracts mandatory fields at first and then
just iterates over all nodes and prints hashes and signs:

http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=common/image-fit.c;h=c531ee74d7fde55c5ac52edb3949fb824954e750;hb=HEAD#l342

According to this routine nodes just need to be unique and you can use
the number after '@' to distinguish between nodes of the same type.

static void fit_image_print_verification_data(const void *fit, int noffset,
                                       const char *p)
{
        const char *name;

        /*
         * Check subnode name, must be equal to "hash" or "signature".
         * Multiple hash/signature nodes require unique unit node
         * names, e.g. hash@1, hash@2, signature@1, signature@2, etc.
         */
        name = fit_get_name(fit, noffset, NULL);
        if (!strncmp(name, FIT_HASH_NODENAME, strlen(FIT_HASH_NODENAME))) {
                fit_image_print_data(fit, noffset, p, "Hash");
        } else if (!strncmp(name, FIT_SIG_NODENAME,
                                strlen(FIT_SIG_NODENAME))) {
                fit_image_print_data(fit, noffset, p, "Sign");


So configuration node is also just a string. So we must pass the
stuff, that comes after '@' in bootm command as a "char *" to
fit_open():

>bootm /boot/kernel-fit.itb@conf_name_string

So snprintf(unit_name, sizeof(unit_name), "conf%d@1", num); should be
something like:

snprintf(unit_name, sizeof(unit_name), "%s@1", conf_name_string);

or even complicated, if we allow to pass conf_name_string@number to
bootm command.

configurations {
default = "conf210@1";
conf210@1 {
description = "Boot Linux kernel with FDT blob (210)";
kernel = "kernel@1";
fdt = "fdt210@1";
};
conf211@1 {
description = "Boot Linux kernel with FDT blob (211)";
kernel = "kernel@1";
fdt = "fdt211@1";
};
};

Yegor

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-06 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 11:23 FIT support: node syntax Yegor Yefremov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox