How to port ppc-linux to new custom boards? (virtexII)
Hi,
I'm trying to port Linux to a custom board built around a virtexII-fpga which features a PPC-405 cpu.
I've downloaded the Montavista 2_4_devel tree, which already has some platform and driver support for the ml300 eval board, and made a few changes to the xilinx specific header files to reflect our FPGA design. Then I changed the tophys macro in include/asm/ppc_asm.h to have a sensible initial mmu.
#define MY_PHYS_RAM 0x90000000
#define tophys(rd,rs) addis rd,rs,(MY_PHYS_RAM-KERNELBASE)@h;
#define tovirt(rd,rs) addis rd,rs,(KERNELBASE-MY_PHYS_RAM)@h;
My kernel gets past the initial mmu setup, enters the C code and freezes in the middle of early_init in arch/ppc/kernel/setup.c when (after?) memset_io is called to zero the BSS region.
I've some experience with porting ARM-Linux but, unfortunately, the PPC port seems to be significantly different (there are no mach-types and ATAG lists, for example).
1) Is there any comprehensive documentation / tutorial on how to port the ppc-linux to new machines? Where does my board specific fixup stuff go (for example, memory and IRQ declarations and such).
2) What requirements and responsibilities are imposed on the bootloader? I suspect that I can't use u-boot or something like that, because we have our own "company-specific" bootloader so that all our products use the same protocol for firmware updates.
3) Is there a way to get a self-decompressing kernel image? ARM linux provides a zImage which the cpu just has to jump into (with some registers initialized) and then decompresses vmlinux by itself. Now I have to use a vmlinux file and write it to flash directly, because zImage on powerpc lacks decompressor code (at least with my configuration). But the 1.3meg vmlinux file makes for pretty long turnaround times (I can only upload at 115k at the moment).
Any help is greatly appreciated ;)
Regards,
Patrick
--
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR* Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Patrick Huesmann <[email protected]> wrote��
Quoted 4 lines
I'm trying to port Linux to a custom board built around a virtexII-fpga which features a PPC-405 cpu.
I've downloaded the Montavista 2_4_devel tree, which
Where did you download the Montavista 2_4_devel? Recently, I need to upgrade the kernel on RPXlite DW.
Quoted 1 line
already has some platform and driver support for the ml300 eval
[snip]
Quoted 3 lines
1) Is there any comprehensive documentation / tutorial on how to port the ppc-linux to new machines? Where does my board specific fixup stuff go (for example, memory and IRQ declarations and such).
See the following two valuable docs:
http://www.denx.de/twiki/bin/view/PPCEmbedded/Introduction
http://www.denx.de/twiki/bin/view/DULG/Manual
Quoted 4 lines
2) What requirements and responsibilities are imposed on the bootloader? I suspect that I can't use u-boot or something like that, because we have our own "company-specific" bootloader so that all our products use the same protocol for firmware updates.
Maybe this is your next problem exits.
Quoted 4 lines
3) Is there a way to get a self-decompressing kernel image? ARM linux provides a zImage which the cpu just has to jump into (with some registers initialized) and then decompresses vmlinux by itself. Now I have to use a
ARM Linux can do like this. PPC Liunx also can make it. :-)
Quoted 4 lines
vmlinux file and write it to flash directly, because zImage on powerpc lacks decompressor code (at least with my configuration). But the 1.3meg vmlinux file makes for pretty long turnaround times (I can only upload at 115k at the moment).
AFAIK, the key point of decompressing is boot loader itself. It has NOTHING to do with ppc linux. Both U-Boot and PlanetCore can do this job well.
Best regards,
Sam
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
You might want to have a look at
http://direct.xilinx.com/bvdocs/appnotes/xapp765.pdf
It explains on how to get started with Xilinx EDK and MontaVista Linux Preview Kit on the ML300 board. The steps are pretty much the same for a custom board.
- Peter
Quoted 39 lines · Patrick Huesmann
Hi,
I'm trying to port Linux to a custom board built around a virtexII-fpga which features a PPC-405 cpu.
I've downloaded the Montavista 2_4_devel tree, which already has some platform and driver support for the ml300 eval board, and made a few changes to the xilinx specific header files to reflect our FPGA design. Then I changed the tophys macro in
include/asm/ppc_asm.hto have a sensible initial mmu.
#defineMY_PHYS_RAM0x90000000
#definetophys(rd,rs)addis rd,rs,(MY_PHYS_RAM-KERNELBASE)@h;
#definetovirt(rd,rs)addis rd,rs,(KERNELBASE-MY_PHYS_RAM)@h;My kernel gets past the initial mmu setup, enters the C code and freezes in the middle of
early_initinarch/ppc/kernel/setup.cwhen (after?)memset_iois called to zero the BSS region.I've some experience with porting ARM-Linux but, unfortunately, the PPC port seems to be significantly different (there are no mach-types and ATAG lists, for example).
1) Is there any comprehensive documentation / tutorial on how to port the ppc-linux to new machines? Where does my board specific fixup stuff go (for example, memory and IRQ declarations and such).
2) What requirements and responsibilities are imposed on the bootloader? I suspect that I can't use u-boot or something like that, because we have our own "company-specific" bootloader so that all our products use the same protocol for firmware updates.
3) Is there a way to get a self-decompressing kernel image? ARM linux provides a zImage which the cpu just has to jump into (with some registers initialized) and then decompresses vmlinux by itself. Now I have to use a vmlinux file and write it to flash directly, because zImage on powerpc lacks decompressor code (at least with my configuration). But the 1.3meg vmlinux file makes for pretty long turnaround times (I can only upload at 115k at the moment).
Quoted 16 lines
Any help is greatly appreciated ;)
Regards,
Patrick
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 12 lines · Patrick Huesmann
I'm trying to port Linux to a custom board built around a virtexII-fpga which features a PPC-405 cpu.
I've downloaded the Montavista 2_4_devel tree, which already has some platform and driver support for the ml300 eval board, and made a few changes to the xilinx specific header files to reflect our FPGA design. Then I changed the tophys macro in
include/asm/ppc_asm.hto have a sensible initial mmu. #defineMY_PHYS_RAM0x90000000#definetophys(rd,rs)addis rd,rs,(MY_PHYS_RAM-KERNELBASE)@h; #definetovirt(rd,rs)addis rd,rs,(KERNELBASE-MY_PHYS_RAM)@h;
Quoted 3 lines
My kernel gets past the initial mmu setup, enters the C code and freezes in the middle of
early_initinarch/ppc/kernel/setup.cwhen (after?)memset_iois called to zero the BSS region.
That's a problem. A lot of the 405 specific kernel code relies on the fact that main memory is mapped at address 0. It would require quite some work to make it work on other addresses too.
Quoted 3 lines
I've some experience with porting ARM-Linux but, unfortunately, the PPC port seems to be significantly different (there are no mach-types and ATAG lists, for example).
Indeed. Although this is supposed to change some day...
Quoted 3 lines
1) Is there any comprehensive documentation / tutorial on how to port the ppc-linux to new machines? Where does my board specific fixup stuff go (for example, memory and IRQ declarations and such).
I haven't seen one. Most of the board specific fixup stuff resides in platforms/boardname.[ch]. Look at arch/ppc/platforms/insightv2pro.[ch] for an example how we did this for the insight V2Pro board.
Quoted 4 lines
2) What requirements and responsibilities are imposed on the bootloader? I suspect that I can't use u-boot or something like that, because we have our own "company-specific" bootloader so that all our products use the same protocol for firmware updates.
The bootloader should load the kernel at address 0 and initialize the registers as follows :
r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.) r4 - Starting address of the init RAM disk
r5 - Ending address of the init RAM disk
r6 - Start of kernel command line string (e.g. "mem=96m") r7 - End of kernel command line string
(See also arch/ppc/kernel/head_4xx.S). The board info structure is defined in asm-ppc/ppcboot.h (struct bd_info).
Quoted 7 lines
3) Is there a way to get a self-decompressing kernel image? ARM linux provides a zImage which the cpu just has to jump into (with some registers initialized) and then decompresses vmlinux by itself. Now I have to use a vmlinux file and write it to flash directly, because zImage on powerpc lacks decompressor code (at least with my configuration). But the 1.3meg vmlinux file makes for pretty long turnaround times (I can only upload at 115k at the moment).
Yes. look at arc/ppc/boot/simple for some targets which have a self-decompressing kernel. (Amongst which is our port to the Insight V2PRO board).
Quoted 1 line
Any help is greatly appreciated ;)
You're welcome.
Cheers,
Peter (p2).
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Hi,
Quoted 3 lines
A lot of the 405 specific kernel code relies on the
fact that main memory is mapped at address 0. It would require quite some work to make it work on other addresses too.
You mean that RAM has to start at *physical* address zero? Well, then perhaps I can convince the hardware guy to change the memory layout. It's a softcore SDRAM controller, after all ;))
Quoted 7 lines
Quoted 3 lines
Where does my board specific fixup stuff go
(for
example, memory and IRQ declarations and such).Most of the board specific fixup stuff resides in platforms/boardname.[ch]. Look at arch/ppc/platforms/insightv2pro.[ch] for an example how we did this for the insight V2Pro board.
Thanks for the suggestions. I'll be looking into that, once I've handled the low-level stuff.
Quoted 6 lines
Quoted 1 line
2) What requirements and responsibilities are imposed on the bootloader?
The bootloader should load the kernel at address 0 and initialize the registers as follows (...)
(See alsoarch/ppc/kernel/head_4xx.S). The board info structure is defined inasm-ppc/ppcboot.h(structbd_info).
Thanks, I've already seen that one. Are there any other requirements (cache flushing, cache turned on/off, interrupts disabled, etc.)?
Quoted 5 lines
Quoted 1 line
3) Is there a way to get a self-decompressing kernel image?
Yes. look at arc/ppc/boot/simple for some targets which have a self-decompressing kernel. (Amongst which is our port to the Insight V2PRO board).
Hmm. The denx tutorial states that the bootloader *must* decompress the kernel. If that's not true (anymore), then I might not have to use u-boot as second stage bootloader.
Thanks,
Patrick
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 8 lines · Patrick Huesmann
Quoted 4 lines
A lot of the 405 specific kernel code relies on the fact that main memory is mapped at address 0. It would require quite some work to make it work on other addresses too.
You mean that RAM has to start at *physical* address zero? Well, then perhaps I can convince the hardware guy to change the memory layout. It's a softcore SDRAM controller, after all ;))
Yes. That's what I mean. Changing the hardware is probably easier in this case then adapting the kernel yes :)
Quoted 2 lines
Thanks, I've already seen that one. Are there any other requirements (cache flushing, cache turned on/off, interrupts disabled, etc.)?
Interrupts should be disabled. There is no real cache disable on the
405. You can only mark pages (or 128MB regions when running in untranslated mode), cacheable or uncacheable. Caches are normally flushed by the linux startup code, but it doesn't hurt to flush them in the bootloader.
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
3) Is there a way to get a self-decompressing kernel image?
Yes. look at arc/ppc/boot/simple for some targets which have a self-decompressing kernel. (Amongst which is our port to the Insight V2PRO board).
Hmm. The denx tutorial states that the bootloader *must* decompress the kernel. If that's not true (anymore), then I might not have to use u-boot as second stage bootloader.
Cheers,
Peter (p2).
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Patrick Huesmann <[email protected]> wrote��
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
3) Is there a way to get a self-decompressing kernel image?
Yes. look at arc/ppc/boot/simple for some targets which have a self-decompressing kernel. (Amongst which is our port to the Insight V2PRO board).
Hmm. The denx tutorial states that the bootloader *must* decompress the kernel. If that's not true (anymore), then I might not have to use u-boot as second stage bootloader.
There isn't *MUST* decompress in U-Boot because U-Boot can boot compressed and unconpressed kernel respectively.In addition, if using U-Boot as second stage bootloader,the process couldn't easier than porting U-Boot on your custom board. I never thought a so-called boot loader couldn't boot a standard linux kernel.:-)
Good luck!
Sam
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Peter 'p2' De Schrijver <[email protected]> wrote��
Quoted 6 lines · Patrick Huesmann
Quoted 4 lines
3) Is there a way to get a self-decompressing kernel image? ARM linux provides a zImage which the cpu just has to jump into (with some registers initialized) and then decompresses vmlinux by itself.
[snip]
Quoted 3 lines
Yes. look at arc/ppc/boot/simple for some targets which have a self-decompressing kernel. (Amongst which is our port to the Insight V2PRO board).
OK, new things learned. But still one point I'd like to add, that's both U-Boot and PlanetCore convert linux kernel zImage.embedded image before booting. U-Boot use mkimage, PlanetCore with dd. This depends on bootloader.
Best regards,
Sam
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/