Skip to content
Snippets Groups Projects
image.c 84.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • {
    	int noffset, confs_noffset;
    	int len;
    
    
    	confs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH);
    
    	if (confs_noffset < 0) {
    
    		debug("Can't find configurations parent node '%s' (%s)\n",
    			FIT_CONFS_PATH, fdt_strerror(confs_noffset));
    
    		return confs_noffset;
    	}
    
    	if (conf_uname == NULL) {
    		/* get configuration unit name from the default property */
    
    		debug("No configuration specified, trying default...\n");
    		conf_uname = (char *)fdt_getprop(fit, confs_noffset,
    						 FIT_DEFAULT_PROP, &len);
    
    		if (conf_uname == NULL) {
    
    			fit_get_debug(fit, confs_noffset, FIT_DEFAULT_PROP,
    					len);
    
    		debug("Found default configuration: '%s'\n", conf_uname);
    
    	noffset = fdt_subnode_offset(fit, confs_noffset, conf_uname);
    
    	if (noffset < 0) {
    
    		debug("Can't get node offset for configuration unit name: "
    			"'%s' (%s)\n",
    			conf_uname, fdt_strerror(noffset));
    
    static int __fit_conf_get_prop_node(const void *fit, int noffset,
    
    		const char *prop_name)
    {
    	char *uname;
    	int len;
    
    	/* get kernel image unit name from configuration kernel property */
    
    	uname = (char *)fdt_getprop(fit, noffset, prop_name, &len);
    
    	if (uname == NULL)
    		return len;
    
    
    	return fit_image_get_node(fit, uname);
    
    }
    
    /**
     * fit_conf_get_kernel_node - get kernel image node offset that corresponds to
     * a given configuration
     * @fit: pointer to the FIT format image header
     * @noffset: configuration node offset
     *
     * fit_conf_get_kernel_node() retrives kernel image node unit name from
     * configuration FIT_KERNEL_PROP property and translates it to the node
     * offset.
     *
     * returns:
     *     image node offset when found (>=0)
     *     negative number on failure (FDT_ERR_* code)
     */
    
    int fit_conf_get_kernel_node(const void *fit, int noffset)
    
    	return __fit_conf_get_prop_node(fit, noffset, FIT_KERNEL_PROP);
    
    }
    
    /**
     * fit_conf_get_ramdisk_node - get ramdisk image node offset that corresponds to
     * a given configuration
     * @fit: pointer to the FIT format image header
     * @noffset: configuration node offset
     *
     * fit_conf_get_ramdisk_node() retrives ramdisk image node unit name from
     * configuration FIT_KERNEL_PROP property and translates it to the node
     * offset.
     *
     * returns:
     *     image node offset when found (>=0)
     *     negative number on failure (FDT_ERR_* code)
     */
    
    int fit_conf_get_ramdisk_node(const void *fit, int noffset)
    
    	return __fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP);
    
    }
    
    /**
     * fit_conf_get_fdt_node - get fdt image node offset that corresponds to
     * a given configuration
     * @fit: pointer to the FIT format image header
     * @noffset: configuration node offset
     *
     * fit_conf_get_fdt_node() retrives fdt image node unit name from
     * configuration FIT_KERNEL_PROP property and translates it to the node
     * offset.
     *
     * returns:
     *     image node offset when found (>=0)
     *     negative number on failure (FDT_ERR_* code)
     */
    
    int fit_conf_get_fdt_node(const void *fit, int noffset)
    
    	return __fit_conf_get_prop_node(fit, noffset, FIT_FDT_PROP);
    
    /**
     * fit_conf_print - prints out the FIT configuration details
     * @fit: pointer to the FIT format image header
    
     * @noffset: offset of the configuration node
    
     * @p: pointer to prefix string
     *
     * fit_conf_print() lists all mandatory properies for the processed
     * configuration node.
     *
     * returns:
     *     no returned results
     */
    
    void fit_conf_print(const void *fit, int noffset, const char *p)
    
    {
    	char *desc;
    	char *uname;
    	int ret;
    
    	/* Mandatory properties */
    
    	ret = fit_get_desc(fit, noffset, &desc);
    	printf("%s  Description:  ", p);
    
    		printf("unavailable\n");
    
    		printf("%s\n", desc);
    
    	uname = (char *)fdt_getprop(fit, noffset, FIT_KERNEL_PROP, NULL);
    	printf("%s  Kernel:       ", p);
    
    	if (uname == NULL)
    
    		printf("unavailable\n");
    
    		printf("%s\n", uname);
    
    
    	/* Optional properties */
    
    	uname = (char *)fdt_getprop(fit, noffset, FIT_RAMDISK_PROP, NULL);
    
    		printf("%s  Init Ramdisk: %s\n", p, uname);
    
    	uname = (char *)fdt_getprop(fit, noffset, FIT_FDT_PROP, NULL);
    
    		printf("%s  FDT:          %s\n", p, uname);
    
    
    /**
     * fit_check_ramdisk - verify FIT format ramdisk subimage
     * @fit_hdr: pointer to the FIT ramdisk header
     * @rd_noffset: ramdisk subimage node offset within FIT image
     * @arch: requested ramdisk image architecture type
     * @verify: data CRC verification flag
     *
     * fit_check_ramdisk() verifies integrity of the ramdisk subimage and from
     * specified FIT image.
     *
     * returns:
     *     1, on success
     *     0, on failure
     */
    #ifndef USE_HOSTCC
    
    static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
    				int verify)
    
    	fit_image_print(fit, rd_noffset, "   ");
    
    		puts("   Verifying Hash Integrity ... ");
    		if (!fit_image_check_hashes(fit, rd_noffset)) {
    			puts("Bad Data Hash\n");
    			show_boot_progress(-125);
    
    		puts("OK\n");
    
    	show_boot_progress(126);
    	if (!fit_image_check_os(fit, rd_noffset, IH_OS_LINUX) ||
    	    !fit_image_check_arch(fit, rd_noffset, arch) ||
    	    !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
    		printf("No Linux %s Ramdisk Image\n",
    
    		show_boot_progress(-126);
    
    	show_boot_progress(127);