public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc from info in the uImage?
Date: Sun, 16 Dec 2007 21:14:44 +0100	[thread overview]
Message-ID: <20071216201444.33E17248AC@gemini.denx.de> (raw)
In-Reply-To: Your message of "Fri, 14 Dec 2007 16:53:21 +0100." <1197647601.21876.12.camel@gentoo-jocke.transmode.se>

In message <1197647601.21876.12.camel@gentoo-jocke.transmode.se> you wrote:
>
> This is what I came up with to make $dtb a hush variable that don't
> end up in the environment:

> #define FLAG_PARSE_SEMICOLON (1 << 1)
> #define FLAG_EXIT_FROM_LOOP 1
> int misc_init_r (void)
> {
> 	char *bootstr, dtb_str[30], workstr[256];
> 
> 	u_boot_hush_start();

Be careful. You are invoking undefined behaviour heare. The  idea  is
that  u_boot_hush_start() is supposed to be called exactly once only.
[Yes, I know from looking at the code that at the moment  this  seems
to be OK, but ther eis no guarantee for it.]

> 	sprintf(dtb_str, "dtb=0x%lx", (ulong)dt_blob_start);
> 	/* Set $dtb in local HUSH env.to my OF tree */
> 	if (parse_string_outer(dtb_str,
> 			       FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0) {
> 		/* Add " - $dtb" to $bootcmd if it is missing */
> 		bootstr = getenv("bootcmd");
> 		if (bootstr && !strstr(bootstr, "- $dtb")) {
> 			strcpy(workstr, bootstr);
> 			strcat(workstr, " - $dtb");
> 			setenv("bootcmd", workstr);
> 		}
> 	}
> 	return 0;
> }
> 
> It is fairly ugly, but it works. Comments?

I don't understand why you make it so complicated when a preboot
command would do exactly the same?

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
The only time the world beats a path to your door is when you are  in
the bathroom.

  reply	other threads:[~2007-12-16 20:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 18:49 [U-Boot-Users] Can U-boot Autodetect arch/ppc versus arch/powerpc from info in the uImage? Darcy Watkins
2007-12-03 21:36 ` Wolfgang Denk
2007-12-03 23:33   ` [U-Boot-Users] Can U-boot Autodetect arch/ppc versusarch/powerpc " Joakim Tjernlund
2007-12-04  0:23     ` Wolfgang Denk
2007-12-04  1:06       ` Joakim Tjernlund
2007-12-06 22:43         ` [U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc " Joakim Tjernlund
2007-12-07  0:57           ` Wolfgang Denk
2007-12-07  6:55             ` Joakim Tjernlund
2007-12-07 11:11               ` Wolfgang Denk
2007-12-07 13:14           ` Jerry Van Baren
2007-12-09 13:12             ` Joakim Tjernlund
2007-12-09 15:00               ` Wolfgang Denk
2007-12-09 17:32                 ` Joakim Tjernlund
2007-12-09 19:28                   ` Wolfgang Denk
2007-12-09 21:14                     ` Joakim Tjernlund
2007-12-09 21:36                       ` Wolfgang Denk
2007-12-09 21:59                         ` Joakim Tjernlund
2007-12-09 22:47                           ` [U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpcfrom " Joakim Tjernlund
2007-12-13 18:49                 ` [U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc from " Jerry Van Baren
2007-12-13 23:03                   ` Joakim Tjernlund
2007-12-14 15:53                     ` Joakim Tjernlund
2007-12-16 20:14                       ` Wolfgang Denk [this message]
2007-12-16 21:27                         ` Joakim Tjernlund
2007-12-17 14:42                           ` Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071216201444.33E17248AC@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox