Re: [PATCH 4/4] MIPS: bootm: add ELF handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 31, 2018 at 10:48:51PM +0200, Oleksij Rempel wrote:
> With this handler barebox will be able to start linux kernel as
> is, without additional image conversation.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
>  arch/mips/lib/bootm.c | 47 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
> index 91e7e1c68..8906ae7b4 100644
> --- a/arch/mips/lib/bootm.c
> +++ b/arch/mips/lib/bootm.c
> @@ -10,6 +10,7 @@
>  #include <restart.h>
>  
>  #include <asm/byteorder.h>
> +#include <asm/io.h>
>  
>  static int do_bootm_barebox(struct image_data *data)
>  {
> @@ -42,11 +43,57 @@ static struct binfmt_hook binfmt_barebox_hook = {
>  	.exec = "bootm",
>  };
>  
> +static int do_bootm_elf(struct image_data *data)
> +{
> +	void (*entry)(int, void *);
> +	struct elf_image *elf;
> +	void *buf;
> +
> +	buf = read_file(data->os_file, NULL);
> +	if (!buf)
> +		return -EINVAL;
> +
> +	elf = elf_load_image(buf);
> +	if (IS_ERR(elf))
> +		return PTR_ERR(elf);
> +
> +	bootm_get_devicetree(data);

Check return value?

A
	if (data->dryrun) {
		elf_release_image(elf);
		return 0;
	}

Would be nice here.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux