Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: vagabon.xyz@gmail.com, ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH 6/7] setup.c: clean up initrd related code
Date: Mon, 16 Oct 2006 10:48:37 +0200	[thread overview]
Message-ID: <45334765.6000805@innova-card.com> (raw)
In-Reply-To: <20061016.171046.55511403.nemoto@toshiba-tops.co.jp>

Atsushi Nemoto wrote:
> On Mon, 16 Oct 2006 10:03:13 +0200, Franck Bui-Huu <vagabon.xyz@gmail.com> wrote:
>>>  	end = (unsigned long)&_end;
>>>  	tmp = PAGE_ALIGN(end) - sizeof(u32) * 2;
>>>  	if (tmp < end)
>>>  		tmp += PAGE_SIZE;
>>>  
>> Any idea on what is this code for ?
>> It seems that a minimum gap is needed betweend the end of kernel
>> code and initrd but I don't see why...
> 
> Perhaps because current tools put initrd image at that place.
> 
> For example:
> 
> arch/mips/boot/addinitrd.c:92:
> 	loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)
> 			+ MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8;
> 	if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)))
> 		loadaddr += MIPS_PAGE_SIZE;
> 	initrd_header[0] = SWAB(0x494E5244);
> 	initrd_header[1] = SWAB(st.st_size);
> 

thanks but it doesn't explain anything either...Anyways what about this
patch on top of the previous one ?

-- >8 --

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 811a8fd..0e61e18 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -177,15 +177,13 @@ static unsigned long __init init_initrd(
 	if (initrd_end > initrd_start)
 		goto sanitize;
 
-	end = (unsigned long)&_end;
-	tmp = PAGE_ALIGN(end) - sizeof(u32) * 2;
-	if (tmp < end)
-		tmp += PAGE_SIZE;
-
+	/*
+	 * FIXME: a good comment would be nice here...
+	 */
+	initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + sizeof(u32) * 2 + 1));
 	initrd_start = 0;
 	initrd_end = 0;
 	end = 0;
-	initrd_header = (u32 *)tmp;
 	if (initrd_header[0] == 0x494E5244) {
 		initrd_start = (unsigned long)&initrd_header[2];
 		initrd_end = initrd_start + initrd_header[1];

  reply	other threads:[~2006-10-16  8:48 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13 12:38 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #2] Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 1/7] page.h: remove __pa() usages Franck Bui-Huu
2006-10-13 16:27   ` Atsushi Nemoto
2006-10-14  9:22     ` Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 2/7] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels Franck Bui-Huu
2006-10-13 16:27   ` Atsushi Nemoto
2006-10-14  8:39     ` Franck Bui-Huu
2006-10-19  4:01   ` Atsushi Nemoto
2006-10-19  6:20     ` Franck Bui-Huu
2006-10-19  6:41     ` Yoichi Yuasa
2006-10-19  7:01       ` Atsushi Nemoto
2006-10-19  7:23         ` Yoichi Yuasa
2006-10-19  7:43         ` Franck Bui-Huu
2006-10-19  7:59           ` Atsushi Nemoto
2006-10-13 12:39 ` [PATCH 3/7] setup.c: get ride of CPHYSADDR() Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 4/7] Introduce __pa_symbol() Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 5/7] setup.c: use __pa_symbol() where needed Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 6/7] setup.c: clean up initrd related code Franck Bui-Huu
2006-10-16  8:03   ` Franck Bui-Huu
2006-10-16  8:10     ` Atsushi Nemoto
2006-10-16  8:48       ` Franck Bui-Huu [this message]
2006-10-16  9:07         ` Atsushi Nemoto
2006-10-16  9:54           ` Thiemo Seufer
2006-10-16 10:19             ` Atsushi Nemoto
2006-10-16 14:42           ` Franck Bui-Huu
2006-10-16 14:51             ` Franck Bui-Huu
2006-10-16  9:09     ` Thiemo Seufer
2006-10-16 14:23       ` Franck Bui-Huu
2006-10-16 14:49         ` Franck Bui-Huu
2006-10-19  4:13   ` Atsushi Nemoto
2006-10-19  6:37     ` Franck Bui-Huu
2006-10-19  6:51       ` Atsushi Nemoto
2006-10-19  7:29         ` Franck Bui-Huu
2006-10-19  7:51           ` Atsushi Nemoto
2006-10-19  8:30             ` Franck Bui-Huu
2006-10-19  8:39     ` Franck Bui-Huu
2006-10-19  9:15       ` Atsushi Nemoto
2006-10-19  9:54         ` Franck Bui-Huu
2006-10-19 10:30           ` Atsushi Nemoto
2006-10-19 10:51             ` Franck Bui-Huu
2006-10-19 11:00               ` Atsushi Nemoto
2006-10-19 11:12                 ` Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 7/7] Make free_init_pages() arguments to be physical addresses Franck Bui-Huu
2006-10-13 13:31   ` Franck Bui-Huu
  -- strict thread matches above, loose matches on Subject: below --
2006-10-16 16:12 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #3] Franck Bui-Huu
2006-10-16 16:12 ` [PATCH 6/7] setup.c: clean up initrd related code Franck Bui-Huu
2006-10-19 11:19 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #4] Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 6/7] setup.c: clean up initrd related code Franck Bui-Huu

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=45334765.6000805@innova-card.com \
    --to=vagabon.xyz@gmail.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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