From: Detlev Zundel Date: Wed, 06 Jun 2007 15:43:40 +0200 Subject: [U-Boot-Users] [PATCH] Fill fw_arg3 In-Reply-To: <200706061306.56051.florian.fainelli@telecomint.eu> (Florian Fainelli's message of "Wed\, 6 Jun 2007 13\:06\:55 +0200") References: <20070530231724.19159353B27@atlas.denx.de> <200706061258.37801.florian.fainelli@telecomint.eu> <200706061306.56051.florian.fainelli@telecomint.eu> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Florian, > This patch allows MIPS based Linux kernels to do runtime bootloader detection > by reading Linux's fw_arg3 in the PROM code (for instance) filled with the > magic number "UBOO". This may not be really useful for other boards than MIPS > and in particular those that use several different bootloaders (like > ADM5120). > > Signed-off-by: Florian Fainelli > -- > > diff --git a/lib_mips/mips_linux.c b/lib_mips/mips_linux.c > index 952d5a9..0823bc0 100644 > --- a/lib_mips/mips_linux.c > +++ b/lib_mips/mips_linux.c > @@ -33,6 +33,8 @@ DECLARE_GLOBAL_DATA_PTR; > #define LINUX_MAX_ENVS 256 > #define LINUX_MAX_ARGS 256 > > +#define UBOOT_MAGIC_NUMBER 0x55424F4F /* UBOO */ > + > #ifdef CONFIG_SHOW_BOOT_PROGRESS > # include > # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) > @@ -213,7 +215,7 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], > /* we assume that the kernel is in place */ > printf ("\nStarting kernel ...\n\n"); > > - theKernel (linux_argc, linux_argv, linux_env, 0); > + theKernel (linux_argc, linux_argv, linux_env, UBOOT_MAGIC_NUMBER); > } > > static void linux_params_init (ulong start, char *line) I know U-Boot is magic - but why have more than needed? [dzu at pollux u-boot]$ grep IH_MAGIC include/* include/image.h:#define IH_MAGIC 0x27051956 /* Image Magic Number */ [dzu at pollux u-boot]$ grep 27051956 /usr/share/magic 0 belong 0x27051956 u-boot/PPCBoot image Cheers Detlev -- ... does Linux have a better [security] track record than MS? Damn right it does. We've had fewer problems, and I think there are more people out there standing up for what's right anyway. Less PR people deathly afraid of rocking the boat. Better technology, and fewer horrid design mistakes. [Linus Torvalds] -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de