FIT support: node syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux