From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Grinberg Date: Tue, 05 Jul 2011 10:38:05 +0300 Subject: [U-Boot] [PATCH 5/5] Warn when the machine ID isn't passed to an ARM kernel and u-boot is compiled in debug mode. The kernel cannot boot without it. In-Reply-To: <20110704174541.GF3016@harvey-pc.matrox.com> References: <20110704174541.GF3016@harvey-pc.matrox.com> Message-ID: <4E12BF5D.6080307@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 07/04/11 20:45, Christopher Harvey wrote: > Signed-off-by: Christopher Harvey > --- > arch/arm/lib/board.c | 4 ++++ > arch/arm/lib/bootm.c | 6 ++++++ > 2 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c > index 169dfeb..dbb835a 100644 > --- a/arch/arm/lib/board.c > +++ b/arch/arm/lib/board.c > @@ -404,6 +404,10 @@ void board_init_f (ulong bootflag) > post_bootmode_init(); > post_run (NULL, POST_ROM | post_bootmode_get(0)); > #endif > + /* 0xffffffff is used to mark is value as "unset". > + Hopefully there will never be this many machines. > + Can't use 0 since 0 is already used as a mach-type. */ > + gd->bd->bi_arch_number = 0xffffffff; > > gd->bd->bi_baudrate = gd->baudrate; > /* Ram ist board specific, so move it to board code ... */ > diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c > index 802e833..70b3b76 100644 > --- a/arch/arm/lib/bootm.c > +++ b/arch/arm/lib/bootm.c > @@ -113,6 +113,12 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) > printf ("Using machid 0x%x from environment\n", machid); > } > > +#ifdef DEBUG > + if(machid==0xffffffff) { this one lacks some white spaces: if (machid == 0xffffffff) { and I agree with Wolfgang, the illegal value should be a self describing define instead. > + debug("\nWarning: machid not set! Linux will not finish booting.\n\n"); > + } > +#endif Is there a reason to close this in ifdef DEBUG? and also use debug()? I would print this in any case, because machid must be set for Linux to boot properly. This message will not hurt anyone (just add ~50 bytes, this is not an spl code) and if someone hacks Linux to boot in any case (without checking the machid), then he can also hack U-Boot and remove the message (if it bothers him). -- Regards, Igor.