Re: finding kernel jump address after "decompressing linux"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/6/30 Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>:
> On Wed, Jun 29, 2011 at 20:05, Christopher Harvey
> <chris@xxxxxxxxxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux