From: tuffkidtt@gmail.com (Gavin Guo)
To: kernelnewbies@lists.kernelnewbies.org
Subject: finding kernel jump address after "decompressing linux"
Date: Thu, 30 Jun 2011 13:39:25 +0800 [thread overview]
Message-ID: <BANLkTi=OfoqzPuvbN2gY-XaCOVy9QMJxuA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikhVgXNiiGO+ZHAuQ55_CoJO1rWUg@mail.gmail.com>
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
prev parent reply other threads:[~2011-06-30 5:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 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='BANLkTi=OfoqzPuvbN2gY-XaCOVy9QMJxuA@mail.gmail.com' \
--to=tuffkidtt@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).