From: "Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] make the machid configurable via the environment (Was: [PATCH] Changed load address and entry point for uImage to ZRELADDR + 6MB)
Date: Wed, 30 Jan 2008 09:08:49 +0100 [thread overview]
Message-ID: <20080130080849.GA25875@digi.com> (raw)
In-Reply-To: <20080116205131.GA3605@digi.com>
Hello Nicolas,
Nicolas Pitre wrote:
> > But does U-Boot properly provide machine information to the kernel these
> > days? I have been and still being burned by U-Boot hardcoding the
> > _wrong_ machine ID, and therefore custom built kernels from k.o simply
> > won't boot on those boards without hacking the kernel source.
> With "our" U-Boot you can override the compiled-in machid with an
> environment variable. I didn't implement this patch but I think it's
> not that difficult. I will check tomorrow if I can easily get a patch
> out of our scm.
It took a bit longer, but here it comes. This is on top of todays
u-boot.
I didn't tested this patch in that version, but this is how it is done
in our version of U-Boot (that is considerable older).
Switching the machid is also very convenient because we have modules
that can be plugged on different base boards and so can use different
machids.
Best regards
Uwe
--->8---
From: Uwe Kleine-K?nig <Uwe.Kleine-Koenig@digi.com>
make the machid configurable via the environment
If the variable "machid" exists, let do_bootm_linux use that instead of
bd->bi_arch_number.
Signed-off-by: Uwe Kleine-K?nig <Uwe.Kleine-Koenig@digi.com>
---
lib_arm/armlinux.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/lib_arm/armlinux.c b/lib_arm/armlinux.c
index 6d32a41..62185f0 100644
--- a/lib_arm/armlinux.c
+++ b/lib_arm/armlinux.c
@@ -78,6 +78,8 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
void (*theKernel)(int zero, int arch, uint params);
image_header_t *hdr = &header;
bd_t *bd = gd->bd;
+ int machid = bd->bi_arch_number;
+ char *s;
#ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv ("bootargs");
@@ -85,6 +87,12 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
theKernel = (void (*)(int, int, uint))ntohl(hdr->ih_ep);
+ s = getenv ("machid");
+ if (s) {
+ machid = simple_strtoul (s, NULL, 16);
+ printf ("Using machid 0x%x from environment\n", machid);
+ }
+
/*
* Check if there is an initrd image
*/
@@ -260,7 +268,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
cleanup_before_linux ();
- theKernel (0, bd->bi_arch_number, bd->bi_boot_params);
+ theKernel (0, machid, bd->bi_boot_params);
}
--
1.5.3.8
--
Uwe Kleine-K?nig, Software Engineer
Digi International GmbH Branch Breisach, K?ferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
next parent reply other threads:[~2008-01-30 8:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1200469629509-git-send-email-vivek.kutal@celunite.com>
[not found] ` <20080116081303.GA25437@uranus.ravnborg.org>
[not found] ` <20080116100904.GA4487@digi.com>
[not found] ` <alpine.LFD.1.00.0801160855140.25841@xanadu.home>
[not found] ` <20080116163434.GA2955@digi.com>
[not found] ` <alpine.LFD.1.00.0801161233050.25841@xanadu.home>
[not found] ` <20080116181027.GB29568@uranus.ravnborg.org>
[not found] ` <alpine.LFD.1.00.0801161318000.25841@xanadu.home>
[not found] ` <20080116205131.GA3605@digi.com>
2008-01-30 8:08 ` Uwe Kleine-König [this message]
2008-01-30 9:33 ` [U-Boot-Users] [PATCH] make the machid configurable via theenvironment (Was: [PATCH] Changed load address and entrypoint for uImage to ZRELADDR + 6MB) Ulf Samuelsson
2008-01-30 14:53 ` Nicolas Pitre
2008-01-30 15:47 ` Russell King - ARM Linux
2008-01-31 0:05 ` Wolfgang Denk
2008-01-31 8:43 ` Russell King - ARM Linux
2008-01-30 23:49 ` Wolfgang Denk
2008-01-30 23:41 ` [U-Boot-Users] [PATCH] make the machid configurable via the environment (Was: [PATCH] Changed load address and entry point " Wolfgang Denk
2008-02-14 21:25 ` Wolfgang Denk
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=20080130080849.GA25875@digi.com \
--to=uwe.kleine-koenig@digi.com \
--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