From: Wolfgang Denk Date: Thu, 18 Sep 2008 08:54:28 +0200 Subject: [U-Boot] [RFC] bootm: Add sub commands In-Reply-To: <1221688841-3197-1-git-send-email-galak@kernel.crashing.org> References: <1221688841-3197-1-git-send-email-galak@kernel.crashing.org> Message-ID: <20080918065428.1E84C248C6@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 Kumar Gala, In message <1221688841-3197-1-git-send-email-galak@kernel.crashing.org> you wrote: > > Having bootm sub-commands allows both of these as we can break up > the sequeunce of steps that are part of the bootm process. OK. > +int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) > +{ > + int ret = 0; > + > + /* start */ > + if (argv[1][0] == 's') { I think just matching on the first letter is to restrictive; we'll end up with artificical command "names" that nobody can remember. > + if (!images.valid) { > + printf("Need to call %s start first\n", argv[0]); > + return 1; > + } We should probably set up a small state machine. > + else if (argv[1][0] == 'i') { And we need comments what all this means. WTF is 'i' ? > +#if 0 > +are these really common ??? or is there any harm?? > + /* bd_t setup */ > + else if (argv[1][0] == 'p') { > + } Yes, we still have plenty of systems running in the field with arch/ppc and even with 2.4 kernels. > + /* prep os */ > + else if (argv[1][0] == 'p') { > + return do_bootm_linux(BOOT_OS_PREP, argc, argv, &images); > + } We already had 'p' above. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "There was no difference between the behavior of a god and the operations of pure chance..." - Thomas Pynchon, _Gravity's Rainbow_