kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: apelete@seketeli.org (Apelete Seketeli)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Debugging a custom kernel
Date: Wed, 29 Jun 2011 23:27:41 +0200	[thread overview]
Message-ID: <20110629212741.GG5604@hermes> (raw)
In-Reply-To: <4E0B55BE.7040906@basementcode.com>

On 29-Jun-11, Christopher Harvey wrote:
> On 06/29/11 16:14, Apelete Seketeli wrote:
> > Hello,
> >
> > I am working on a custom kernel, and I would like to add the necessary
> > support to enable it to boot with qemu.
> When you say "debug inside qemu", do you run
> gdb qemu
> or
> gdb vmlinux

"gdb vmlinux" actually. The focus is on the kernel, to know what going
on during the boot process (since it doesn't boot in qemu).

> > In order to achieve that I am
> > trying to debug it inside qemu by attaching a gdb to it.
> you do this by adding -S -s to the qemu boot parameters.
> the from the gdb shell, target remote :1234.

"qemu -S -kernel bzImage", then, using the monitor inside qemu I start
a gdbserver to which I connect to debug the kernel.

>  > I still can't
> > figure where the boot process is getting stuck with step-by-step
> > execution, but it seems that the last function called is "delay_loop"
> > from arch/x86/lib/delay.c.
> Have you run the backtrace (bt) command from the gdb shell? That should 
> tell you what function is calling the __delay.

I didn't, will try that and see if it helps.

> > That function contains some assembly code, does someone know what it
> > is supposed to do ?
> Probably wait a specific amount of time. Since a compiler optimizes C 
> you can't write an accurate delay in C. The compiler wont optimize the 
> inline assembly.

Okay, so I really need to know which function is calling the delay and
go down from there.

> Have you had any luck with a google search along the lines of "qemu gdb 
> kernel"?

Running gdb with qemu caused me some headache, but I got it, as said
before. Thanks for the tips, I'll try and see if I can get something
useful.

-- 
        Apelete

  reply	other threads:[~2011-06-29 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 20:14 Debugging a custom kernel Apelete Seketeli
2011-06-29 16:41 ` Christopher Harvey
2011-06-29 21:27   ` Apelete Seketeli [this message]
2011-06-30 13:12     ` Christopher Harvey
2011-06-29 20:42 ` Jonathan Neuschäfer

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=20110629212741.GG5604@hermes \
    --to=apelete@seketeli.org \
    --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).