From: Mark Bellon <mbellon@mvista.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: [PATCH] PPC64: large INITRD causes kernel not to boot
Date: Mon, 08 Aug 2005 10:55:09 -0700 [thread overview]
Message-ID: <42F79C7D.5060406@mvista.com> (raw)
In-Reply-To: <42EA6580.9010204@mvista.com>
[-- Attachment #1: Type: text/plain, Size: 593 bytes --]
In PPC64 there are number of problems in arch/ppc64/boot/main.c that
prevent a kernel from making use of a large (greater than ~16MB) INITRD.
This is 64 bit architecture and really large INITRD images should be
possible.
Simply put the existing code has a fixed reservation (claim) address and
once the kernel plus initrd image are large enough to pass this address
all sorts of bad things occur. The fix is the dynamically establish the
first claim address above the loaded kernel plus initrd (plus some
"padding" and rounding)
mark
Signed-off-by: Mark Bellon <mbellon@mvista.com>
[-- Attachment #2: common_initrd.patch --]
[-- Type: text/x-patch, Size: 2451 bytes --]
Index: linux-2.6.12.3/arch/ppc64/boot/main.c
===================================================================
--- linux-2.6.12.3.orig/arch/ppc64/boot/main.c
+++ linux-2.6.12.3/arch/ppc64/boot/main.c
@@ -22,7 +22,7 @@
extern void printf(const char *fmt, ...);
extern int sprintf(char *buf, const char *fmt, ...);
void gunzip(void *, int, unsigned char *, int *);
-void *claim(unsigned int, unsigned int, unsigned int);
+void *claim(unsigned long, unsigned long, unsigned long);
void flush_cache(void *, unsigned long);
void pause(void);
extern void exit(void);
@@ -31,9 +31,8 @@
void *memmove(void *dest, const void *src, unsigned long n);
void *memcpy(void *dest, const void *src, unsigned long n);
-/* Value picked to match that used by yaboot */
-#define PROG_START 0x01400000
-#define RAM_END (256<<20) // Fixme: use OF */
+#define ONE_MB 0x100000
+#define RAM_END (512<<20) // Fixme: use OF */
char *avail_ram;
char *begin_avail, *end_avail;
@@ -75,13 +74,13 @@
#define DEBUG
-static unsigned long claim_base = PROG_START;
+static unsigned long claim_base;
static unsigned long try_claim(unsigned long size)
{
unsigned long addr = 0;
- for(; claim_base < RAM_END; claim_base += 0x100000) {
+ for(; claim_base < RAM_END; claim_base += ONE_MB) {
#ifdef DEBUG
printf(" trying: 0x%08lx\n\r", claim_base);
#endif
@@ -112,7 +111,23 @@
if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
exit();
- printf("zImage starting: loaded at 0x%x\n\r", (unsigned)_start);
+ printf("zImage starting: loaded at 0x%lx\n\r", (unsigned long)_start);
+
+ /*
+ * The first available claim_base must be "out of the way" -
+ * well above _start + kernel_size + initrd + overhead.
+ */
+
+ claim_base = ((unsigned long) _start) +
+ ((unsigned long) vmlinux_filesize) +
+ (unsigned long)(_initrd_end - _initrd_start) +
+ ONE_MB;
+
+ /*
+ * Now round up the claim_base to a nice 1 MB boundary.
+ */
+
+ claim_base = ((claim_base + ONE_MB - 1) / ONE_MB) * ONE_MB;
/*
* Now we try to claim some memory for the kernel itself
@@ -122,7 +137,7 @@
* size... In practice we add 1Mb, that is enough, but we should really
* consider fixing the Makefile to put a _raw_ kernel in there !
*/
- vmlinux_memsize += 0x100000;
+ vmlinux_memsize += ONE_MB;
printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize);
vmlinux.addr = try_claim(vmlinux_memsize);
if (vmlinux.addr == 0) {
prev parent reply other threads:[~2005-08-08 17:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-29 0:03 [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts Mark Bellon
2005-07-29 0:13 ` Nathan Scott
2005-07-29 0:15 ` Mark Bellon
2005-07-29 0:19 ` Mark Bellon
2005-07-29 0:23 ` Andrew Morton
2005-07-29 0:29 ` Mark Bellon
2005-07-29 0:46 ` Mark Bellon
2005-07-29 13:46 ` Jan Kara
2005-07-29 15:47 ` Mark Bellon
2005-07-29 17:21 ` [PATCH] (REPOST/REVISION) " Mark Bellon
2005-07-29 22:03 ` [PATCH] (TAKE 3) " Mark Bellon
2005-08-02 21:27 ` [PATCH] IDE disks show invalid geometries in /proc/ide/hd*/geometry Mark Bellon
2005-08-03 7:19 ` Andre Hedrick
2005-08-03 16:54 ` Mark Bellon
2005-08-03 17:19 ` Bartlomiej Zolnierkiewicz
2005-08-03 17:37 ` Mark Bellon
2005-08-03 18:05 ` Bartlomiej Zolnierkiewicz
2005-08-03 18:32 ` Mark Bellon
2005-08-03 18:51 ` Bartlomiej Zolnierkiewicz
2005-08-04 6:03 ` Jan Engelhardt
2005-08-04 16:44 ` Mark Bellon
2005-08-04 23:45 ` Eric D. Mudama
2005-08-08 16:02 ` [PATCH] (TAKE 3) disk quotas fail when /etc/mtab is symlinked to /proc/mounts Jan Kara
2005-08-08 17:55 ` Mark Bellon [this message]
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=42F79C7D.5060406@mvista.com \
--to=mbellon@mvista.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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