kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Aruna Hewapathirane <aruna.hewapathirane@gmail.com>
To: ebashinskii <ebashinskii@proton.me>
Cc: "kernelnewbies@kernelnewbies.org" <kernelnewbies@kernelnewbies.org>
Subject: Re: Is arch/x86/boot/main.c main obsolete?
Date: Sat, 25 Jun 2022 22:05:40 -0400	[thread overview]
Message-ID: <CAFSeFg_-cXJQxK9NbucWDZ0mNcQuU-__j7ouwE6fbkbdBOjRRw@mail.gmail.com> (raw)
In-Reply-To: <zcMypU8DDYjLz2ODqB0N9Pbpv7OHc7PK8ncYNuNj1slaFnA1cGdy-TFKcpScWQs9xOVCcQljUtR94Ed3guRc9hpufe6DyqgvKRhAbR3hU7A=@proton.me>


[-- Attachment #1.1: Type: text/plain, Size: 1324 bytes --]

On Sat, Jun 25, 2022 at 7:35 PM ebashinskii <ebashinskii@proton.me> wrote:

> CPU: Intel x86 KabyLake. I'm using 5.17 Kernel built from upstream and
> GRUB 2.04
>
> When debugging the kernel initialization process I found out that there is
> a function *void main(void)* in the source file *arch/x86/boot/main.c* (source
> link:
> https://elixir.bootlin.com/linux/v5.17/source/arch/x86/boot/main.c#L134) which
> seems to be the entry point which the boot loader is supposed to jump into.
>
> But *objdump*-ing the Kernel image shows that there is no such symbol as
> *main*. GDB attached to QEMU does not know about this symbol either.
>
> The earliest stage of Kernel Initialization I could manage to catch with
> GDB is *x86_64_start_kernel* (source link:
> https://elixir.bootlin.com/linux/v5.17/source/arch/x86/kernel/head64.c#L467
> )
>
> The question is what function GRUB actually jump into passing control to
> the Kernel code and what is the purpose of *arch/x86/boot/main.c::main*?
>

This should answer most of the questions you may have about the kernel boot
process:
https://0xax.gitbooks.io/linux-insides/content/Booting/

:-)



> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

[-- Attachment #1.2: Type: text/html, Size: 2957 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2022-06-26  2:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 23:35 Is arch/x86/boot/main.c main obsolete? ebashinskii
2022-06-26  2:05 ` Aruna Hewapathirane [this message]
2022-06-26 13:38   ` ebashinskii
2022-07-19  2:41 ` jim.cromie

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=CAFSeFg_-cXJQxK9NbucWDZ0mNcQuU-__j7ouwE6fbkbdBOjRRw@mail.gmail.com \
    --to=aruna.hewapathirane@gmail.com \
    --cc=ebashinskii@proton.me \
    --cc=kernelnewbies@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).