Booting Linux Kernel without bootloader

7 messages, 6 authors, 2006-08-02 · open the first message on its own page

Booting Linux Kernel without bootloader

From: Clint Thomas <hidden>
Date: 2006-07-25 22:43:00

Hey guys,

I have gone through the Linuxppc embedded and dev lists for information
related to what I am trying to do, but was unable to find exactly what
i'm looking for.

Basically, the system I want linux running on does not require the
initialization of hardware that U-boot provides, or at least it does not
need it to boot the linux kernel. I want to load an uncompressed linux
kernel into memory and start the execution of the kernel, without using
any kind of bootloader. Is this possible? Or does linux need some kind
of firmware or other software to tell it to start executing? Thanks for
any info you might have.
 
Clinton Thomas
cthomas@soneticom.com
 

Re: Booting Linux Kernel without bootloader

From: bennett78 <hidden>
Date: 2006-07-25 23:57:56

Clint Thomas wrote:
Hey guys,

I have gone through the Linuxppc embedded and dev lists for 
information related to what I am trying to do, but was unable to find 
exactly what i'm looking for.

Basically, the system I want linux running on does not require the 
initialization of hardware that U-boot provides, or at least it does 
not need it to boot the linux kernel. I want to load an uncompressed 
linux kernel into memory and start the execution of the kernel, 
without using any kind of bootloader. Is this possible? Or does linux 
need some kind of firmware or other software to tell it to start 
executing? Thanks for any info you might have.
You seem to be looking for a striped down U-boot functionality:
    o copy flash to ram and run code
but to do this:
    o processor registers need to be initilized
    o caches need to be flushed
    o interrupts need to be disabled
    o C environment (stack) needs to be setup
U-boot is fairly small compared to a x86 BIOS which has to find
multiple boot device choices, yet supports multiple architectures.

I'm using a BDI2000 to load/debug u-boot running in SDRAM
for a new PPC hardware design.  U-boot is probably easier to
debug than the kernel!
U-boot has other features that help with initial H/W turnon:
    o it's a debug/monitor
          o ram test
          o ram/register read/modify
    o u-boot environment
          o IP address, mac address
          o Linux boot options - NFS verses flash
          o Ethernet/NFS option using a server enables:
             o debugging kernel changes
             o debugging kernel driver modules
             o quick change of application processes
             o cross compile target code on server to local target
             o telnet to embedded H/W
    o knows how to flash partitions
          o u-boot (/dev/mtd0) (well I use the BDI to flash here)
          o can flash kernel (/dev/mtd1)
          o can flash root fs (/dev/mtd2)
          o can flash config data (/dev/mtd3)
          o this partitioning will help with future F/W updates
          o kind of required if your flash is soldered to the board
          o to read/write flash requires u-boot to relocate itself to ram
 
Clinton Thomas
cthomas@soneticom.com
 _______________________________________________

Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
Frank Bennett

*/Technical Contractor/*

/Triad Systems Engineering
200 West Mountain Avenue, Suite 103C
Ft. Collins, CO 80521
/http://www.traidsyseng.com <http://www.triadsyseng.com>
frank.bennett@triadsyseng.com <mailto:frank.bennett@triadsyseng.com>/
/
"I think there's a world market for about five computers."
        -- attr. Thomas J. Watson (Chairman of the Board, IBM), 1943


Re: Booting Linux Kernel without bootloader

From: Kalle Pokki <hidden>
Date: 2006-07-26 06:15:50

On 7/26/06, Clint Thomas [off-list ref] wrote:

Basically, the system I want linux running on does not require the
initialization of hardware that U-boot provides, or at least it does not
need it to boot the linux kernel. I want to load an uncompressed linux
kernel into memory and start the execution of the kernel, without using any
kind of bootloader. Is this possible? Or does linux need some kind of
firmware or other software to tell it to start executing? Thanks for any
info you might have.
Once the hardware is initialised,  it is pretty straightforward to boot the
linux kernel. All you have to have is the kernel at address zero, struct
bd_info filled in some place in memory, kernel command line stored in
memory, and registers r3 ... r7 containing pointers to these.

For reference, look
1) include/asm-ppc/ppcboot.h for example struct bd_info
2) arch/ppc/syslib/m8260_setup.c for the registers

If you have some custom hardware, you need to create (basically empty)
platform code, since the existing ones would try to touch some board control
registers you don't have.

But remember, you need to initialise the memory controller and all sorts of
things yourself somehow - with a JTAG debugger or a custom boot loader.

Re: Booting Linux Kernel without bootloader

From: Andrei Konovalov <hidden>
Date: 2006-07-26 10:42:23

Hi Clint,

You may want to look at the arch/ppc/boot/simple bootwrapper.
This wrapper links together with the compressed kernel image
into single file. One just needs to load this file into memory
and pass control to the wrapper. The bootwrapper uncompresses
the kernel into memory and passes the board information in bd_t structure.

As an example, Xilinx ML300 or ML403 boards (without any firmware)
can be booted this way: load zImage.elf into RAM (e.g. using JTAG
debugger) and jump to the the wrapper entry point.

This stuff is not in arch/powerpc yet, but recently Mark Greer
has posted the patches to fix that:
[PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches

Thanks,
Andrei

Clint Thomas wrote:
Hey guys,

I have gone through the Linuxppc embedded and dev lists for information 
related to what I am trying to do, but was unable to find exactly what 
i'm looking for.

Basically, the system I want linux running on does not require the 
initialization of hardware that U-boot provides, or at least it does not 
need it to boot the linux kernel. I want to load an uncompressed linux 
kernel into memory and start the execution of the kernel, without using 
any kind of bootloader. Is this possible? Or does linux need some kind 
of firmware or other software to tell it to start executing? Thanks for 
any info you might have.
 
Clinton Thomas
cthomas@soneticom.com
 


------------------------------------------------------------------------

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Re: Booting Linux Kernel without bootloader

From: David H. Lynch Jr. <hidden>
Date: 2006-07-28 08:04:01

Clint Thomas wrote:
Hey guys,

I have gone through the Linuxppc embedded and dev lists for
information related to what I am trying to do, but was unable to find
exactly what i'm looking for.

Basically, the system I want linux running on does not require the
initialization of hardware that U-boot provides, or at least it does
not need it to boot the linux kernel. I want to load an uncompressed
linux kernel into memory and start the execution of the kernel,
without using any kind of bootloader. Is this possible? Or does linux
need some kind of firmware or other software to tell it to start
executing? Thanks for any info you might have.
    You system powers on. It starts executing whatever is at the reset
vector, Something has to get you from the ppc powering up and going to
never never land, to starting to execute Linux.
    The steps to get from Power on to booting Linux may not be that
complicated, Much of what needs to be done can likely be included as
part of the code for your board in arch/ppc/boot/simple.
    But something still has to be done.

    In my instance I am dealing with a Xilinx V4 (not an ML403). A small
"monitor" program is automatically loaded as part of the FPGA .bit
image. On power on it starts executing.
    It sets up the CPU, cache, and very minimal hardware configuration,
and then loads Linux out of flash and executes it.
   
    Linux does not have to have alot setup to boot. But something has to
to some minimal initial setup, get Linux into the memory of your system,
and jump to it.


   



 
Clinton Thomas
cthomas@soneticom.com
 
------------------------------------------------------------------------

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

Re: Booting Linux Kernel without bootloader

From: bennett78 <hidden>
Date: 2006-07-28 14:03:15

David H. Lynch Jr. wrote:
Clint Thomas wrote:
quoted
Hey guys,

I have gone through the Linuxppc embedded and dev lists for 
information related to what I am trying to do, but was unable to find 
exactly what i'm looking for.

Basically, the system I want linux running on does not require the 
initialization of hardware that U-boot provides, or at least it does 
not need it to boot the linux kernel. I want to load an uncompressed 
linux kernel into memory and start the execution of the kernel, 
without using any kind of bootloader. Is this possible? Or does linux 
need some kind of firmware or other software to tell it to start 
executing? Thanks for any info you might have.

    You system powers on. It starts executing whatever is at the reset 
vector, Something has to get you from the ppc powering up and going to 
never never land, to starting to execute Linux.
    The steps to get from Power on to booting Linux may not be that 
complicated, Much of what needs to be done can likely be included as 
part of the code for your board in arch/ppc/boot/simple.
    But something still has to be done.

    In my instance I am dealing with a Xilinx V4 (not an ML403). A 
small "monitor" program is automatically loaded as part of the FPGA 
.bit image. On power on it starts executing.
Curious, how long does the V4 take to load up it's brain? (using a 
serial EEprom?)
    It sets up the CPU, cache, and very minimal hardware 
configuration, and then loads Linux out of flash and executes it.
   
    Linux does not have to have alot setup to boot. But something has 
to to some minimal initial setup, get Linux into the memory of your 
system, and jump to it.
quoted
 
Clinton Thomas
cthomas@soneticom.com
 

------------------------------------------------------------------------

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein
 

------------------------------------------------------------------------

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
Frank Bennett

*/Technical Contractor/*

/Triad Systems Engineering
200 West Mountain Avenue, Suite 103C
Ft. Collins, CO 80521
/http://www.traidsyseng.com <http://www.triadsyseng.com>
frank.bennett@triadsyseng.com <mailto:frank.bennett@triadsyseng.com>/
/office: 970-493-7586
cell:   970-402-9269

"I think there's a world market for about five computers."
        -- attr. Thomas J. Watson (Chairman of the Board, IBM), 1943


Re: Booting Linux Kernel without bootloader

From: Grant Likely <hidden>
Date: 2006-08-02 04:17:44

On 7/25/06, Clint Thomas [off-list ref] wrote:

Hey guys,

I have gone through the Linuxppc embedded and dev lists for information
related to what I am trying to do, but was unable to find exactly what i'm
looking for.

Basically, the system I want linux running on does not require the
initialization of hardware that U-boot provides, or at least it does not
need it to boot the linux kernel. I want to load an uncompressed linux
kernel into memory and start the execution of the kernel, without using any
kind of bootloader. Is this possible? Or does linux need some kind of
firmware or other software to tell it to start executing? Thanks for any
info you might have.
Loading a kernel into memory and starting execution *is* a boot loader.  :)

You could use the bootwrapper that is in the kernel source tree
(zImage).  If a zImage's entry point is at the execution entry point,
then it will start the Linux kernel correctly.  However, it is still a
compressed image.

If you *really* need an uncompressed image, I would start with the
bootwrapper and hack it to work with an non-gzipped kernel image.
However, why do you want to do it this way?  You probably won't gain
much in boot time and it will be more difficult to maintain.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help