[U-Boot] [PATCH] Add bootstrap command

Matthias Fuchs matthias.fuchs at esd.eu
Thu Jul 16 15:55:07 CEST 2009


Please see my comments below.

On Wednesday 15 July 2009 15:48, Dirk Eibach wrote:

...

> diff --git a/common/cmd_bootstrap.c b/common/cmd_bootstrap.c
> new file mode 100644
> index 0000000..6fceb23
> --- /dev/null
> +++ b/common/cmd_bootstrap.c
> @@ -0,0 +1,75 @@
> +/*
> + * (C) Copyright 2009
> + * Dirk Eibach,  Guntermann & Drunck GmbH, eibach at gdsys.de
> + *
> + * based on code (C) Copyright 2008
> + * Stefan Roese, DENX Software Engineering, sr at denx.de.
> + *
> + * 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 <bootstrap.h>
> +#include <common.h>
> +#include <command.h>
> +#include <i2c.h>
> +#include <asm/io.h>
> +
> +static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +	int x, nbytes, selcfg;
> +	extern char console_buffer[];
> +
> +	printf("Available configurations: \n\n");
> +
> +	for (x = 0; bootstrap_config_labels[x][0] != 0; x++)
> +		printf(" %d - %s\n", (x+1), bootstrap_config_labels[x]);
> +
> +	do {
> +		nbytes = readline(" Selection [1-x / quit]: ");
> +
> +		if (nbytes) {
> +			if (strcmp(console_buffer, "quit") == 0)
> +				return 0;
> +			selcfg = simple_strtol(console_buffer, NULL, 10);
> +			if ((selcfg < 1) || (selcfg > x))
> +				nbytes = 0;
> +		}
> +	} while (nbytes == 0);
Do we really need to have this interactive? At least it would be fine
to use "bootstrap 4" to get the fourth configuration.
So when an additional parameter ist passed to bootstrap you could bypass
alle the printf stuff and directly update the EEPROM.
> +
> +
> +	x = (selcfg - 1);
> +
> +	if (i2c_write(CONFIG_BOOTSTRAP_I2C_EEPROM_ADDR, 0, 1,
> +		bootstrap_configs[x], CONFIG_BOOTSTRAP_BLOCKSIZE) != 0)
> +		printf("Error writing to EEPROM at address 0x%x\n",
> +			CONFIG_BOOTSTRAP_I2C_EEPROM_ADDR);
> +	udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
> +
> +	printf("Done\n");
Can't we life without this 'Done' message?

> +	printf("Please power-cycle the board for the changes to take effect\n");
At least for 440EPx and 405EP calling 'reset' is enough and much easier for scripting :-)

Matthias


More information about the U-Boot mailing list