[U-Boot] [PATCH 5/6] cmd_nvedit.c: allow board-specific code before/after saving the environment

Mike Frysinger vapier at gentoo.org
Tue May 15 07:14:14 CEST 2012


On Monday 14 May 2012 12:10:48 Timur Tabi wrote:
> Mike Frysinger wrote:
> > this is less bloat:
> > int board_start_saveenv(void) __attribute__((weak, alias("saveenv")));
> > 
> > int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > argv[]) {
> > 
> > 	printf("Saving Environment to %s...\n", env_name_spec);
> > 	return board_saveenv() ? 1 : 0;
> > 
> > }
> 
> Ah, I see.  This forces the board-specific function to call saveenv().
> That gives us more flexibility in the board code.
> 
> However, I was trying to mimic what we have in the NAND layer, with
> nand_get_device() and nand_release_device().  That is, before we save the
> environment, we have to "get" it, and then after we save it, we can
> "release" it.

i don't think the nand approach is terribly applicable.  different solutions 
for different cases.

> Your approach, although it eliminates two weak functions, is not as
> "architecturally clean" as mine, IMHO.

i'd prefer my approach because it keeps down the bloat for the vast majority 
of people out there while not restricting boards who want this override
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120515/8e4e7844/attachment.pgp>


More information about the U-Boot mailing list