1

I am trying to load and boot a linux kernel through JTAG on the AM3517 evaluation board. My debugger is BDI3000. I am not using openocd, since according to the documentation of the debugger it is not required. So far I think I am able to load the vmlinux image onto the memory, but once it is done "cont" gdb command does not boot linux. I do not get any messages on the serial console.

I am following the instructions given in this link http://elinux.org/Debugging_The_Linux_Kernel_Using_Gdb

trying to get the address of the log_buffer as mentioned in the link gives me following output

(gdb) p (char*) &__log_buf[log_start]
$1 = 0xc04cd460 <Address 0xc04cd460 out of bounds>

I have searched a lot on the internet but could not find a proper answer. Not sure what I am doing wrong.

Flexo
  • 87,323
  • 22
  • 191
  • 272
harsha
  • 11
  • 2

1 Answers1

2

The Linux kernel cannot just be loaded and then executed.
Before the Linux kernel can be executed, the ARM architecture requires that a bootloader:

  • Configure the memory system.
  • Load the kernel image at the correct memory address.
  • Optionally load an initial RAM disk at the correct memory address.
  • Initialize the boot parameters to pass to the kernel (aka the kernel command line).
  • Obtain the ARM Linux machine type (and other info for ATAGs)
  • Enter the kernel with the appropriate register values.

Most of these steps are common to all architectures, but the ATAGs list of system information is unique to ARM.
All of these booting requirements are mentioned in "Booting ARM Linux".
Typically the bootloader (e.g. U-Boot) performs these tasks.
And the tutorial you mentioned tells you to use the bootloader to initialize your board:

The most practical way of doing this is to set a hardware breakpoint at the start of the kernel
and reset your board using the JTAG reset signal.
Your boot loader will initialize your board and the execution will stop at the start of the kernel.
After that you can load a kernel into memory and run it.

sawdust
  • 16,103
  • 3
  • 40
  • 50
  • Hi, Thanks for your reply. I am a newbie to kernel programming so please be kind in case of a stupid question. – harsha Feb 25 '13 at 12:35
  • Hi, Thanks for your reply. I am a newbie to kernel programming so please be kind in case of a stupid question. Is it not possible to do the necessary things, like configuring the memory system and passing kernel command line and other information, through the gdb(a gdb script perhaps). I guess loading the kernel at the correct memory address is taken care of by the gdb via load command. So I am guessing other things should also be possible. But I have no clue how to do that. – harsha Feb 25 '13 at 12:42
  • If you have no clue how to initialize the hardware (memory, clocks, GPIO, UART) or provide ATAG and kernel command line buffers, then you should follow convention and use bootloaders to do these tasks. There's no one here that is going to write a book for you on how to do this. Besides, in the end you have to have bootloaders for a viable system. So most (or probably all) board developers have working bootloaders before the kernel testing begins. It's possible to setup the system for Linux using gdb, but *any mistake* will cause the kernel to not boot, and then you have to start over. – sawdust Feb 28 '13 at 05:26