All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Kernel loading and memory layout
@ 2009-01-21  0:09 Vinay Venkataraghavan
  2009-01-21  3:24 ` Roman Mashak
  2009-01-21 12:34 ` Jerry Van Baren
  0 siblings, 2 replies; 6+ messages in thread
From: Vinay Venkataraghavan @ 2009-01-21  0:09 UTC (permalink / raw)
  To: u-boot

Greetings,

I am new to using uboot but have gone through the code to a certain degree but still have some questions. 

1. Where does uboot transfer control to the linux kernel. By this I mean which file in the source code would I look for this.

    Would it for example be in :  arch/powerpc/boot and in one of the assembly language files?

2. I went through and did a lot of reading on how grub loads a linux kernel. 

    Is the memory layout of uboot similar to that of grub. If not, how and where do I find more information on how does uboot layout the memory and
    where is the real-mode portion of the kernel loaded and where is the protected mode portion of the kernel loaded etc.

   Any pointers to the source code would greatly help.

Any other information to get me started along these lines would be of great help.

Thank you.
Vinay



      

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Kernel loading and memory layout
  2009-01-21  0:09 [U-Boot] Kernel loading and memory layout Vinay Venkataraghavan
@ 2009-01-21  3:24 ` Roman Mashak
  2009-01-21 12:34 ` Jerry Van Baren
  1 sibling, 0 replies; 6+ messages in thread
From: Roman Mashak @ 2009-01-21  3:24 UTC (permalink / raw)
  To: u-boot

Hello

2009/1/21 Vinay Venkataraghavan <raghavanvinay@yahoo.com>:
> I am new to using uboot but have gone through the code to a certain degree but still have some questions.
>
> 1. Where does uboot transfer control to the linux kernel. By this I mean which file in the source code would I look for this.
>
>    Would it for example be in :  arch/powerpc/boot and in one of the assembly language files?

Look at $(uboot)/common/cmd_bootm.c, cmd_boot.c. On ARM the process
also involves $(uboot)/lib_arm/bootm.c, I guess should be something
similar on PPC.

-- 
Roman Mashak

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Kernel loading and memory layout
  2009-01-21  0:09 [U-Boot] Kernel loading and memory layout Vinay Venkataraghavan
  2009-01-21  3:24 ` Roman Mashak
@ 2009-01-21 12:34 ` Jerry Van Baren
  2009-01-21 19:03   ` Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Jerry Van Baren @ 2009-01-21 12:34 UTC (permalink / raw)
  To: u-boot

Vinay Venkataraghavan wrote:
> Greetings,
> 
> I am new to using uboot but have gone through the code to a certain
> degree but still have some questions.
> 
> 1. Where does uboot transfer control to the linux kernel. By this I
> mean which file in the source code would I look for this.
> 
> Would it for example be in :  arch/powerpc/boot and in one of the
> assembly language files?

You could start with the "bootm" command in common/cmd_bootm.c and read 
its logic and comments (just skim the code and comments till you get to 
the end where it does the transfer to the loaded program).

> 2. I went through and did a lot of reading on how grub loads a linux kernel. 
> 
> Is the memory layout of uboot similar to that of grub. If not, how
> and where do I find more information on how does uboot layout the
> memory and where is the real-mode portion of the kernel loaded and
> where is the protected mode portion of the kernel loaded etc.

It is totally different from grub.  Grub is a second++ stage bootloader 
that runs after the PC-BIOS does the first stage initialization and 
loads grub.

U-Boot is generally the first and only bootloader (booting from NAND 
flash requires a very compact, simple first stage bootloader, which 
makes u-boot a second stage bootloader).

U-Boot loads the linux kernel in RAM where ever you tell it to and then 
jumps to the linux kernel entry point.  The linux kernel, on start up, 
relocates itself to where *it* wants to live and then proceeds.

>    Any pointers to the source code would greatly help.
> 
> Any other information to get me started along these lines would be of great help.
> 
> Thank you.
> Vinay

Best regards,
gvb

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Kernel loading and memory layout
  2009-01-21 12:34 ` Jerry Van Baren
@ 2009-01-21 19:03   ` Wolfgang Denk
  2009-01-21 22:12     ` Vinay Venkataraghavan
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2009-01-21 19:03 UTC (permalink / raw)
  To: u-boot

Dear Jerry Van Baren,

In message <49771642.1050705@ge.com> you wrote:
>
> U-Boot loads the linux kernel in RAM where ever you tell it to and then 
> jumps to the linux kernel entry point.  The linux kernel, on start up, 
> relocates itself to where *it* wants to live and then proceeds.

This is not correct. You load the kernel to some memory  address  (in
RAM  or  flash or SRAM etc.). U-Boot will then copy (or "load") it to
the address givenm in the "load address" parameter of the image file,
and then jumpt to the entry point address given in the  "entry  point
address" parameter of the image file. Normally (at leats on PowerPC),
Linux  will NOT relocate itself (it may set up the MMU later, but the
initial execution starts exactly at the "entry point address").


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The sooner our happiness together begins, the longer it will last.
	-- Miramanee, "The Paradise Syndrome", stardate 4842.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Kernel loading and memory layout
  2009-01-21 19:03   ` Wolfgang Denk
@ 2009-01-21 22:12     ` Vinay Venkataraghavan
  2009-01-21 23:20       ` Roman Mashak
  0 siblings, 1 reply; 6+ messages in thread
From: Vinay Venkataraghavan @ 2009-01-21 22:12 UTC (permalink / raw)
  To: u-boot

Thank you all for your responses. Has definitely got me going. Another really quick question. I notice that there are a lot of debug switches in the uboot code.

How do I turn on debugs in uboot. Is there a compile time flag or is there and #define that needs to be turned on. I looked in the code and could not find how all the debugs are related and can be switched on?

Thank you.
Regards,
Vinay



----- Original Message ----
From: Wolfgang Denk <wd@denx.de>
To: Jerry Van Baren <gerald.vanbaren@ge.com>
Cc: Vinay Venkataraghavan <raghavanvinay@yahoo.com>; u-boot at lists.denx.de
Sent: Wednesday, January 21, 2009 11:03:39 AM
Subject: Re: [U-Boot] Kernel loading and memory layout

Dear Jerry Van Baren,

In message <49771642.1050705@ge.com> you wrote:
>
> U-Boot loads the linux kernel in RAM where ever you tell it to and then 
> jumps to the linux kernel entry point.  The linux kernel, on start up, 
> relocates itself to where *it* wants to live and then proceeds.

This is not correct. You load the kernel to some memory  address  (in
RAM  or  flash or SRAM etc.). U-Boot will then copy (or "load") it to
the address givenm in the "load address" parameter of the image file,
and then jumpt to the entry point address given in the  "entry  point
address" parameter of the image file. Normally (at leats on PowerPC),
Linux  will NOT relocate itself (it may set up the MMU later, but the
initial execution starts exactly at the "entry point address").


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The sooner our happiness together begins, the longer it will last.
    -- Miramanee, "The Paradise Syndrome", stardate 4842.6



      

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Kernel loading and memory layout
  2009-01-21 22:12     ` Vinay Venkataraghavan
@ 2009-01-21 23:20       ` Roman Mashak
  0 siblings, 0 replies; 6+ messages in thread
From: Roman Mashak @ 2009-01-21 23:20 UTC (permalink / raw)
  To: u-boot

Hello

2009/1/22 Vinay Venkataraghavan <raghavanvinay@yahoo.com>:
>
> How do I turn on debugs in uboot. Is there a compile time flag or is there and #define that needs to be turned on. I looked in the code and could not find how all the debugs are related and can be switched on?

You may define DEBUG right in your board's configuration file. Will
provide you with lots of useful debug messages.

-- 
Roman Mashak

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-21 23:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-21  0:09 [U-Boot] Kernel loading and memory layout Vinay Venkataraghavan
2009-01-21  3:24 ` Roman Mashak
2009-01-21 12:34 ` Jerry Van Baren
2009-01-21 19:03   ` Wolfgang Denk
2009-01-21 22:12     ` Vinay Venkataraghavan
2009-01-21 23:20       ` Roman Mashak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.