From: Wolfgang Denk Date: Wed, 28 Jul 2010 23:17:30 +0200 Subject: [U-Boot] [PATCH 5/5] New implementation for internal handling of environment variables. In-Reply-To: <201007261652.39368.matthias.fuchs@esd-electronics.com> References: <1279395948-25864-1-git-send-email-wd@denx.de> <1279395948-25864-6-git-send-email-wd@denx.de> <201007261652.39368.matthias.fuchs@esd-electronics.com> Message-ID: <20100728211731.04B56152397@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Matthias Fuchs, In message <201007261652.39368.matthias.fuchs@esd-electronics.com> you wrote: > > I could think of some situations where the new env command > is helpful. But more during development than for production systems. It depends. "Reset to factory defaults" is a not so uncommon request. And acceleration of scripts is not so uncommon either. > Switching between environment profiles would be cool. And a "env default -f" > behavior that keeps MAC addresses and serial# is also on my wishlist. Actually neither MAC addresses nor serial# are part of the default environment. > I did some testing on our PMC440 with environment in EEPROM. > Please see some comments below. Thanks. > > +static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > > +{ > > + char buf[32]; > > + char *addr, *cmd, *res; > > + size_t size; > > + ssize_t len; > > + env_t *envp = (env_t *)addr; > addr is uninitialized. declaration is enough here. Will check this. ... > > + if (chk) { /* export as checksum protected block */ > Add: > envp = (env_t *)addr; > > + res = (char *)&envp->data; > > + } else { /* export as raw binary data */ > > + res = (char *)&addr; > Should'n this be > res = addr; No. We need the address of the pointer variable, so the function can store the result pointer there. ... > Fixes for non-building board (AR405, CANBT, PMC440) will come up shortly. Thanks a lot.