[Cbe-oss-dev] BSD loader port to PS3

Geoff Levand geoffrey.levand at am.sony.com
Thu Nov 8 07:19:25 EST 2007


Edward O'Callaghan wrote:
> That's a good start to get a working kernel underway though kboot.
> However, we plan to have a '1st stage' loader that I can flash into well
> flash :) .That is, my loader is going to be the otheros.bld gunziped image.


OK, sorry I misunderstood what you are trying to do.


> I can't seem to find any docs on the required HV calls and the required
> parameters to pass. 


The lv1 loader supports loading gzipped binary images from flash
rom (ldr_size bytes at ldr_area_offset * OS_AREA_SEGMENT_SIZE)
to ram addr zero. The lv1 loader starts executing in real mode
and sends both processor threads to addr 0x100.  You need to make
sure your entry at 0x100 can handle being entered by both threads
simultaneously.

The 1st stage image is actually a 'bootwrapper program', a small 32 bit
program that prepares the execution environment for the linux kernel.
The linux kernel is just data bytes in section .kernel:vmlinux.bin, which
is located at the proper address by the bootwrapper program's linker script
arch/powerpc/boot/zImage.ps3.lds.

Studying the bootwrapper program should be enough to understand how the
lv1 loader loads an image from flash.

The boot wrapper is 32 bits so that virtual addresses and real addresses
are aliased (c000_0000_0000_0000 => 0).  You do not need to make your
loader 32 bit, as it is difficult to interface to the lv1's
64 bit C calling convention from a 32 bit program.

See the comments in the file 

  http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux.git;a=blob;f=arch/powerpc/boot/ps3-head.S;hb=HEAD

and the script that creates the bootwrapper here:

  http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux.git;a=blob;f=arch/powerpc/boot/wrapper;hb=HEAD

The layout of flash memory is given here:

   http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux.git;a=blob;f=arch/powerpc/platforms/ps3/os-area.c;hb=HEAD


> Would it be possible to make available some documentation for what I am
> describing ?


Just the docs here will be released:

  http://www.kernel.org/pub/linux/kernel/people/geoff/cell/CELL-Linux-CL_20071023-ADDON/doc/


> I have started a project: http://sourceforge.net/projects/ps3-bsd-loader/
> I welcome anyone with free time on there hands.


Good luck with it!  I recommend you join the #ps3dev IRC channel on freenode.
Others there have done similar work.

-Geoff


> On 08/11/2007, *Geoff Levand* <geoffrey.levand at am.sony.com
> <mailto:geoffrey.levand at am.sony.com>> wrote:
> 
>     Hi,
> 
>     Edward O'Callaghan wrote:
>     > Dear All,
>     >
>     > I am working porting the BSD loader to the PS3 and while doing so
>     I am
>     > having problems finding the right docs on how the Linux Kernel/kboot
>     > bootstraps.
>     > Could you please give me a overview of how this is so or the relevant
>     > docs/code to that I can figure it out.
>     > Also; Do you know what the requirements of kboot/kexec are on ELF
>     image
>     > layout, where it will put the loader in memory, what the context is on
>     > handoff etc ?
> 
>     We have two kernel entry types for PS3, which we call 1st stage and
>     2nd stage.
>     1st stage kernels are programmed into flash memory, and 2nd stage
>     kernels are
>     loaded via kexec.  It seems you are asking about the 2nd stage
>     entry, in other
>     words, kboot loads your BSD kernel image.








More information about the cbe-oss-dev mailing list