finding kernel jump address after "decompressing linux"
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
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
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
participants (3)
-
Christopher Harvey -
Gavin Guo -
Mulyadi Santosa