[RFC] bootwrapper: prevent fdt from being overwritten by kernel

Mark A. Greer mgreer at mvista.com
Fri Oct 27 08:56:53 EST 2006


On Thu, Oct 26, 2006 at 03:50:45PM -0700, Mark A. Greer wrote:
> diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
> index 234bb5b..4927c17 100644
> --- a/arch/powerpc/boot/main.c
> +++ b/arch/powerpc/boot/main.c
> @@ -169,7 +169,7 @@ static int is_elf32(void *hdr)
>  	return 1;
>  }
>  
> -static void prep_kernel(unsigned long *a1, unsigned long *a2)
> +static void get_elfheader(void)
>  {
>  	int len;
>  
> @@ -186,11 +186,13 @@ static void prep_kernel(unsigned long *a
>  		       sizeof(elfheader));
>  
>  	if (!is_elf64(elfheader) && !is_elf32(elfheader)) {
> -		printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
>  		exit();
>  	}
> -	if (platform_ops.image_hdr)
> -		platform_ops.image_hdr(elfheader);
> +}
> +
> +static void prep_kernel(unsigned long *a1, unsigned long *a2)
> +{
> +	int len;

Oops, the "if (!is_elf64(elfheader) && !is_elf32(elfheader)) {"
check should stay in prep_kernel.

Mark



More information about the Linuxppc-dev mailing list