[U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

Kumar Gala galak at kernel.crashing.org
Tue May 3 16:21:42 CEST 2011


> diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
> index e01787d..53b9b27 100644
> --- a/arch/powerpc/lib/bootm.c
> +++ b/arch/powerpc/lib/bootm.c
> @@ -226,6 +226,23 @@ static int boot_bd_t_linux(bootm_headers_t *images)
> 	return ret;
> }
> 
> +/*
> + * Verify the device tree.
> + *
> + * This function is called after all device tree fix-ups have been enacted,
> + * so that the final device tree can be verified.  The definition of "verified"
> + * is up to the specific implementation.  However, it generally means that the
> + * addresses of some of the devices in the device tree are compared with the
> + * actual addresses at which U-Boot has placed them.
> + *
> + * The function should display warning messages for any problems it finds.
> + * U-Boot will still attempt to boot the operating system, however.
> + */
> +static void __ft_verify_fdt(void *fdt)
> +{
> +}
> +__attribute__((weak, alias("__ft_verify_fdt"))) void ft_verify_fdt(void *fdt);
> +
> static int boot_body_linux(bootm_headers_t *images)
> {
> 	ulong rd_len;
> @@ -296,6 +313,8 @@ static int boot_body_linux(bootm_headers_t *images)
> 		/* fixup the initrd now that we know where it should be */
> 		if (*initrd_start && *initrd_end)
> 			fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1);
> +
> +		ft_verify_fdt(*of_flat_tree);

Do we not want to error out here if verify fails?

> 	}
> #endif	/* CONFIG_OF_LIBFDT */
> 	return 0;
> -- 
> 1.7.3.4



More information about the U-Boot mailing list