Subject: boot requirements

From: David Kesselring <[email-masked]>
Date: Thu, 24 Jul 2003 10:27:16 -0400 (EDT)

I am trying to determine what has to be included in our boot code to start
linux. I didn't think I needed to port yamon. What does yamon or pmon
provide for starting or debugging(gdb) linux? Does the processor need to
be in a specific state or context before jumping from the boot code to the
linux downloaded image? If someone can point me to a simple example, I
would greatly appreciate it.

David Kesselring
Atmel MMC
[email-masked]
919-462-6587

---

From: Joe George <[email-masked]>
Date: Thu, 24 Jul 2003 09:50:31 -0600

I found Jun's porting howto to be an immense help.

http://linux.junsun.net/porting-howto/

I found it easier to port Linux to my board than
Yamon.  But I guess it probably depends a lot on
the kind of port.

Joe

---

From: Wolfgang Denk <[email-masked]>
Date: Thu, 24 Jul 2003 18:02:04 +0200

> Yamon.  But I guess it probably depends a lot on

It depends on what you want or need to do. Capabilities like  booting
over  the  network  or  storing  configuration  parameters or command
sequences can be extremely useful features of a boot loader.

We use U-Boot on a couple of MIPS boards.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: [email-masked]
One possible reason that things aren't going  according  to  plan  is
that there never was a plan in the first place.

---

From: "Lyle Bainbridge" <[email-masked]>
Date: Thu, 24 Jul 2003 11:32:28 -0500

Hi,

Creating a simple boot loader:

Well firstly, you'll need to at least implement some
initialization code specific to your processor. Typically
for MIPS this would involve initializing CP0, the cache
and TLB. Then perhaps some peripheral initialization such
as clocks, static memory and SDRAM controllers.  Then the
stack pointer needs to be set to a suitable location
being carefull to word align.

Ok, well that's just the reset code for your processor.
What you need to fo for the Linux kernel depends on where it
is stored and whether it is compressed. Loading from a disk
requires a slightly less than trivial bootloader. For the
sake of discussion I'll assume the kernel is located in flash:

For compressed kernel in flash with ELF header:
  a. Uncompress the kernel to RAM.
  b. Read the ELF header to determine layout of sections
     and kernel entry point.
  c. Copy sections to memory as specified in ELF header.
  d. Jump to kernel entry point.
  e. Kernel does the rest :)

If the kernel is not compress then obviously this step can
be skipped. This is a pretty minimal boot loader and easy
to implement.

> I am trying to determine what has to be included in our boot 
> code to start linux. I didn't think I needed to port yamon. 
> What does yamon or pmon provide for starting or 
> debugging(gdb) linux? Does the processor need to be in a 
> specific state or context before jumping from the boot code 
> to the linux downloaded image? If someone can point me to a 
> simple example, I would greatly appreciate it.
> 
> David Kesselring
> Atmel MMC
> [email-masked]
> 919-462-6587
>

---

From: Jun Sun <[email-masked]>
Date: Thu, 24 Jul 2003 10:15:35 -0700

> would greatly appreciate it.

This is a good question.  I am listing what I can think of on top of my
head.  Some items might be missing:

. cold initialize board
. RAM should be ready
. kernel binary is in place
. cache is consistent.
. any kernel command line args are set up (set prom_init() for the 
  "protocol")
. Normally you would enable cache, and jump to the KSEG0 kernel_entry.
  (I have seen exceptions, in which case you need to modified a little
   in kernel)
. Obviously CPU is setup in kernel mode and a few configs are setup correctly
  (such as data path width, timing, etc).  Interrupt should be
  turned off.
 
All the rest bootloader work are negotiable between the linux kernel
and bootloader.  For example, if bootloader assigns PCI resources,
then kenel can skip pci_auto.  In other words, beyond the above
minimum requirement, other bootloader work _can_ be done in Linux board
setup routine.

Jun