checking atags for boot parameters

Gavin Guo tuffkidtt at gmail.com
Thu Jun 30 19:53:49 EDT 2011


>  It's not an error message, but with difficulty I was able to trace some
>  of the code and it ends up in a prefetch exception handler. I am not
>  able to find out from where however, and the line stepping is a bit
>  sketchy. No major patches to the kernel, and it runs in QEMU without
>  error. Adding uboot to QEMU then booting the same kernel yields the
>  problems.

To see what's happened, you can check the register about exceptional
virtual address in your platform, then up to the instruction caused
the exception. As to the atags parameter, searching MACHINE_START
under the platform you use, then the struct member, named boot_params,
below the MACHINE_START should be found. According to the assigned
value of boot_params, the address which uboot stick the parameter in
can be examine to see if the value is the same as the one assigned in
uboot.

>  It would be nice to find out what physical address the kernel is
>  uncompressed to as well, I'm as of yet unable to properly trace after
>  decompression.

Referring to what I replied in another thread:
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
Andestech



More information about the Kernelnewbies mailing list