[U-Boot-Users] Can U-boot Autodetect arch/ppcversusarch/powerpc from info in the uImage?
Wolfgang Denk
wd at denx.de
Sun Dec 16 21:14:44 CET 2007
In message <1197647601.21876.12.camel at 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.
More information about the U-Boot
mailing list