[PATCH 2/2] Add MIPS arch support to barebox

Shinya Kuribayashi skuribay at pobox.com
Tue Jun 28 11:06:56 EDT 2011


On 6/28/11 2:13 AM, Antony Pavlov wrote:
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> new file mode 100644
> index 0000000..10c0fbb
> --- /dev/null
> +++ b/arch/mips/Kconfig
> @@ -0,0 +1,55 @@
[...]
> +source arch/mips/mach-qemu/Kconfig
> +
> +choice
> +	prompt "Bring up type"
> +
> +	config MIPS_NATIVE_BRINGUP
> +		bool "native"
> +		help
> +		   Barebox will act as a native bootloader. This includes all the
> +		   required initialization needed to bring up a piece of hardware.
> +
> +endchoice

Native bringup / native bootloader should be replaced with
something more appropriate or descriptive.

> +source arch/mips/boot/Kconfig
> +
> +source common/Kconfig
> +source commands/Kconfig
> +source net/Kconfig
> +source drivers/Kconfig
> +source fs/Kconfig
> +source lib/Kconfig
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> new file mode 100644
> index 0000000..60d88e5
> --- /dev/null
> +++ b/arch/mips/Makefile
> @@ -0,0 +1,51 @@
> +CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -fno-merge-constants
> +
> +CPPFLAGS += -march=mips64 -P -EB -mno-abicalls
> +CPPFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
> +	    -Wno-uninitialized -Wno-format -Wno-main
> +#CPPFLAGS += -save-temps

it's good thing to take 64-bit support into account from the beginning.

> diff --git a/arch/mips/boot/entry.c b/arch/mips/boot/entry.c
> new file mode 100644
> index 0000000..98d954e
> --- /dev/null
> +++ b/arch/mips/boot/entry.c
> @@ -0,0 +1,80 @@
> +/*
> + * (C) Copyright 2000-2006
> + * Wolfgang Denk, DENX Software Engineering, wd at denx.de.

Which part in this file belongs to Wolfgang?  I don't see any, and
recommend you to replace with yours.

> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include<debug_ll.h>
> +#include<common.h>
> +#include<init.h>
> +#include<asm-generic/memory_layout.h>
> +
> +#include<asm/io.h>
> +
> +#include<string.h>
> +
> +/* These symbols are generated by the linker */
> +extern long __bss_start;
> +extern long __bss_end;
> +
> +extern void start_barebox(void);
> +
> +/************************************************************************
> + *
> + * This is the first part of the initialization sequence: we are now
> + * running from ROM.
> + *
> + ************************************************************************
> + */
> +
> +void board_init_in_rom(void *rom, void *ram)
> +{
> +	int i;
> +	int * a, *b;
> +#define ROM_SIZE	512 * 1024
> +
> +	a = rom;
> +	b = ram;
> +
> +	for (i = ROM_SIZE; i>  0; i-=sizeof(int)) {
> +		*b = *a;
> +		a++;
> +		b++;
> +	}
> +}
> +
> +/************************************************************************
> + *
> + * This is the next part if the initialization sequence: we are now
> + * running from RAM and have a "normal" C environment, i. e. global
> + * data can be written, BSS has been cleared, the stack size in not
> + * that critical any more, etc.
> + *
> + ************************************************************************
> + */
> +
> +void board_init_in_ram()
> +{
> +	/* clear the BSS first */
> +	memset(&__bss_start, 0x00,&__bss_end -&__bss_start);
> +
> +	/* Initialization complete - start the monitor */
> +	start_barebox();
> +}
> diff --git a/arch/mips/boot/head.S b/arch/mips/boot/head.S
> new file mode 100644
> index 0000000..f5712b8
> --- /dev/null
> +++ b/arch/mips/boot/head.S
> @@ -0,0 +1,233 @@
> +/*
> + * Startup Code for MIPS32 CPU-core
> + *
> + * Copyright (c) 2003	Wolfgang Denk<wd at denx.de>
> + * Further modifications by Antony Pavlov

Hmm, not really, and stopped reviewing here.  I might be able to
give a thorough review, but don't have any spare time these days.




More information about the barebox mailing list