futility/updater_archive.c
/* Prints the information of given image file in JSON format. */
Prints the information of given image file in JSON format.
Prints the information of given image file in JSON format .
static void print_json_image(
		const char *name, const char *fpath, struct model_config *m,
		struct archive *archive, int indent, int is_host)
{
	struct firmware_image image = {0};
	const struct vb2_gbb_header *gbb = NULL;
	if (!fpath)
		return;
	if (load_firmware_image(&image, fpath, archive))
		return;
	if (!is_host)
		printf(",\n");
	printf("%*s\"%s\": { \"versions\": { \"ro\": \"%s\", \"rw\": \"%s\" },",
	       indent, "", name, image.ro_version, image.rw_version_a);
	indent += 2;
	if (!is_host) {
        } else if (patch_image_by_model(&image, m, archive) != 0) {
		ERROR("Failed to patch images by model: %s\n", m->name);
	} else if (NULL != (gbb = find_gbb(&image))) {
		printf("\n%*s\"keys\": { \"root\": \"%s\", ",
		       indent, "",
		       get_gbb_key_hash(gbb, gbb->rootkey_offset,
					gbb->rootkey_size));
		printf("\"recovery\": \"%s\" },",
		       get_gbb_key_hash(gbb, gbb->recovery_key_offset,
					gbb->recovery_key_size));
	}
	printf("\n%*s\"image\": \"%s\" }", indent, "", fpath);
	free_firmware_image(&image);
}
static void print_json_image ( const char * name , const char * fpath , struct model_config * m , struct archive * archive , int indent , int is_host ) { struct firmware_image image = { 0 } ; const struct vb2_gbb_header * gbb = NULL ; if ( ! fpath ) return ; if ( load_firmware_image ( & image , fpath , archive ) ) return ; if ( ! is_host ) printf ( " \n " ) ; printf ( " \" \" \" \" \" \" \" \" \" \" \" \" " , indent , " " , name , image . ro_version , image . rw_version_a ) ; indent += 2 ; if ( ! is_host ) { } else if ( patch_image_by_model ( & image , m , archive ) != 0 ) { ERROR ( " \n " , m -> name ) ; } else if ( NULL != ( gbb = find_gbb ( & image ) ) ) { printf ( " \n \" \" \" \" \" \" " , indent , " " , get_gbb_key_hash ( gbb , gbb -> rootkey_offset , gbb -> rootkey_size ) ) ; printf ( " \" \" \" \" " , get_gbb_key_hash ( gbb , gbb -> recovery_key_offset , gbb -> recovery_key_size ) ) ; } printf ( " \n \" \" \" \" " , indent , " " , fpath ) ; free_firmware_image ( & image ) ; }
Prints the information of given image file in JSON format.
Prints the information of given image file in JSON format .
/* No extra information to be printed */