kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* finding kernel jump address after "decompressing linux"
@ 2011-06-29 13:05 Christopher Harvey
  2011-06-29 17:24 ` Mulyadi Santosa
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Harvey @ 2011-06-29 13:05 UTC (permalink / raw)
  To: kernelnewbies

I'm trying to figure out what physical address the kernel jumps to 
after "Uncompressing Linux... done, booting the kernel.". IIRC, there 
are two parts to a kernel image, one compressed part and one 
uncompressed. The uncompressed code decompresses the compressed part and 
puts it into memory then jumps to it. I'm using an ARM kernel, version 
2.6.38.

thanks,
Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* finding kernel jump address after "decompressing linux"
  2011-06-29 13:05 finding kernel jump address after "decompressing linux" Christopher Harvey
@ 2011-06-29 17:24 ` Mulyadi Santosa
  2011-06-30  5:39   ` Gavin Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Mulyadi Santosa @ 2011-06-29 17:24 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Jun 29, 2011 at 20:05, Christopher Harvey
<chris@basementcode.com> wrote:
> I'm trying to figure out what physical address the kernel jumps to
> after "Uncompressing Linux... done, booting the kernel.". IIRC, there
> are two parts to a kernel image, one compressed part and one
> uncompressed. The uncompressed code decompresses the compressed part and
> puts it into memory then jumps to it. I'm using an ARM kernel, version
> 2.6.38.

try to check the related ld script...for example, in x86 it's in
arch/x86/kernel/vmlinux.lds.S and arch/x86/kernel/vmlinux.lds. The
latter is generated during kernel compilation AFAIK.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* finding kernel jump address after "decompressing linux"
  2011-06-29 17:24 ` Mulyadi Santosa
@ 2011-06-30  5:39   ` Gavin Guo
  0 siblings, 0 replies; 3+ messages in thread
From: Gavin Guo @ 2011-06-30  5:39 UTC (permalink / raw)
  To: kernelnewbies

2011/6/30 Mulyadi Santosa <mulyadi.santosa@gmail.com>:
> On Wed, Jun 29, 2011 at 20:05, Christopher Harvey
> <chris@basementcode.com> wrote:
>> I'm trying to figure out what physical address the kernel jumps to
>> after "Uncompressing Linux... done, booting the kernel.". IIRC, there
>> are two parts to a kernel image, one compressed part and one
>> uncompressed. The uncompressed code decompresses the compressed part and
>> puts it into memory then jumps to it. I'm using an ARM kernel, version
>> 2.6.38.

You can see that in /arch/arm/kernel/head.S, the Kernel startup entry
point is put in "ENTRY(stext)" above that is a line .section
".text.head", "ax" which says that the Kernel startup code is
allocated in .text.head section. And also you can find the following
at the beginning of the /arch/arm/kernel/vmlinux.lds.S:

ENTRY(stext)

#ifndef __ARMEB__
jiffies = jiffies_64;
#else
jiffies = jiffies_64 + 4;
#endif

SECTIONS
{
#ifdef CONFIG_XIP_KERNEL
        . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
#else
        . = PAGE_OFFSET + TEXT_OFFSET;
#endif
        .text.head : {
                _stext = .;
                _sinittext = .;
                *(.text.head)
        }

Obviously, ".text.head" section begins with TEXT_OFFSET + PAGE_OFFSET.
So, what is TEXT_OFFSET? It is defined in arch/arm/Makefile as
TEXT_OFFSET := $(textofs-y) where you can also find that textofs-y is
defined as "textofs-y       := 0x00008000". PAGE_OFFSET is defined
under configs/bcmring_defconfig:CONFIG_PAGE_OFFSET=0xC0000000, here
bcmring_defconfig is just an example. You can find other defconfig
also has CONFIG_PAGE_OFFSET too. The other trick is objdumpping the
vmlinux under kernel root, then you can see the kernel startup address
in the beginning of the first line.

Gavin Guo
OS kernel engineer in Andestech

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-30  5:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 13:05 finding kernel jump address after "decompressing linux" Christopher Harvey
2011-06-29 17:24 ` Mulyadi Santosa
2011-06-30  5:39   ` Gavin Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).