[PATCH v2 03/12] arm: introduce lib64 for arm64 related stuff

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 14 23:15:32 PDT 2016


On Tue, Jun 14, 2016 at 09:06:37AM +0200, Raphael Poggi wrote:
> diff --git a/arch/arm/lib64/Makefile b/arch/arm/lib64/Makefile
> new file mode 100644
> index 0000000..a424293
> --- /dev/null
> +++ b/arch/arm/lib64/Makefile
> @@ -0,0 +1,10 @@
> +obj-$(CONFIG_ARM_LINUX)	+= armlinux.o
> +obj-$(CONFIG_BOOTM)	+= bootm.o
> +obj-y	+= div0.o
> +obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memcpy.o
> +obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memset.o
> +extra-y += barebox.lds
> +
> +pbl-y	+= lib1funcs.o
> +pbl-y	+= ashldi3.o
> +pbl-y	+= div0.o
> diff --git a/arch/arm/lib64/armlinux.c b/arch/arm/lib64/armlinux.c
> new file mode 100644
> index 0000000..21a2292
> --- /dev/null
> +++ b/arch/arm/lib64/armlinux.c
> @@ -0,0 +1,275 @@

[...]

> +static void setup_tags(unsigned long initrd_address,
> +		unsigned long initrd_size, int swap)
> +{
> +	const char *commandline = linux_bootargs_get();
> +
> +	setup_start_tag();
> +	setup_memory_tags();
> +	setup_commandline_tag(commandline, swap);
> +
> +	if (initrd_size)
> +		setup_initrd_tag(initrd_address, initrd_size);
> +
> +	setup_revision_tag();
> +	setup_serial_tag();
> +#ifdef CONFIG_ARM_BOARD_APPEND_ATAG
> +	if (atag_appender != NULL)
> +		params = atag_appender(params);
> +#endif
> +	setup_end_tag();
> +
> +	printf("commandline: %s\n"
> +	       "arch_number: %d\n", commandline, armlinux_get_architecture());
> +
> +}

All the code around ATAGs can be removed. ARM64 is device tree only and
won't ever need this.

> +
> +void start_linux(void *adr, int swap, unsigned long initrd_address,
> +		unsigned long initrd_size, void *oftree)
> +{
> +	void (*kernel)(int zero, int arch, void *params) = adr;
> +	void *params = NULL;
> +	int architecture;
> +
> +	if (oftree) {
> +		pr_debug("booting kernel with devicetree\n");
> +		params = oftree;
> +	} else {
> +		setup_tags(initrd_address, initrd_size, swap);
> +		params = armlinux_get_bootparams();
> +	}
> +	architecture = armlinux_get_architecture();
> +
> +	shutdown_barebox();
> +
> +	kernel(0, architecture, params);
> +}

> diff --git a/arch/arm/lib64/bootm.c b/arch/arm/lib64/bootm.c

This file is an exact copy of arch/arm/lib/bootm.c as of a324fb5a, so it
seems that either the 32bit version works for arm64 or this is untested.

Have you already booted a kernel? Does it work? Although starting a
kernel is admittedly a key feature for a bootloader, we could drop the
code from the initial arm64 porting effort if it doesn't work yet.

> diff --git a/arch/arm/lib64/module.c b/arch/arm/lib64/module.c

Please drop this file. I suppose it won't work on arm64 anyway, so
there's no need to carry a nonworking copy of arm32 module support in
the arm64 tree.

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 |



More information about the barebox mailing list