FIT support: node syntax
Yegor Yefremov
yegorslists at googlemail.com
Wed Jan 6 03:23:11 PST 2016
Hi Marc,
I've looked at U-Boot source code to get the idea, how to pass configuration id.
See this definition:
kernel at 1 {
description = "Vanilla Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0x80200000>;
entry = <0x80200000>;
hash at 1 {
algo = "crc32";
};
hash at 2 {
algo = "sha1";
};
};
One can see two hash nodes: hash at 1 and hash at 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 at 1, hash at 2, signature at 1, signature at 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 at conf_name_string
So snprintf(unit_name, sizeof(unit_name), "conf%d at 1", num); should be
something like:
snprintf(unit_name, sizeof(unit_name), "%s at 1", conf_name_string);
or even complicated, if we allow to pass conf_name_string at number to
bootm command.
configurations {
default = "conf210 at 1";
conf210 at 1 {
description = "Boot Linux kernel with FDT blob (210)";
kernel = "kernel at 1";
fdt = "fdt210 at 1";
};
conf211 at 1 {
description = "Boot Linux kernel with FDT blob (211)";
kernel = "kernel at 1";
fdt = "fdt211 at 1";
};
};
Yegor
More information about the barebox
mailing list