Linux启动问题——记Virtex-II Pro(PPC405)Linux内核移植

最近又开始重新拿起以前做东西——试着将Linux内核移植在Virtex-II Pro的开发板上,不过用了很新的内核2.6.29和2.6.33的版本。

基本的平台信息

# Target Board:  Xilinx XUP Virtex-II Pro Development System Rev C
# Family:    virtex2p
# Device:    xc2vp30
# Package:   ff896
# Speed Grade:  -7
# Processor: ppc405_0
# Processor clock frequency: 200.00 MHz
# Bus clock frequency: 100.00 MHz
# On Chip Memory :  32 KB
# Total Off Chip Memory : 256 MB
# – DDR_SDRAM = 256 MB
    

图1. Base System的组成

 内核版本
 
linux-2.6-xlnx 2.6.29

device Tree(dts file)

/* Device Tree Generator version: 1.3
*
* (C) Copyright 2007-2008 Xilinx, Inc.
* (C) Copyright 2007-2009 Michal Simek
*
* Michal SIMEK <monstr@monstr.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* CAUTION: This file is automatically generated by libgen.
* Version: Xilinx EDK 10.1.03 EDK_K_SP3.6
*
* XPS project directory: Linux_port_UART16550
*/

/dts-v1/;
{
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,virtex405", "xlnx,virtex";
model = "testing";
DDR_SDRAM: memory@0 {
device_type = "memory";
reg = < 0x0 0x10000000 >;
} ;
aliases {
ethernet0 = &Ethernet_MAC;
serial0 = &RS232_Uart_1;
} ;
chosen {
bootargs = "console=ttyS0 root=/dev/ram";
linux,stdout-path = "/plb@0/serial@83e00000";
} ;
cpus {
#address-cells = <1>;
#cpus = <0x1>;
#size-cells = <0>;
ppc405_0: cpu@0 {
clock-frequency = <200000000>;
compatible = "PowerPC,405", "ibm,ppc405";
d-cache-line-size = <0x20>;
d-cache-size = <0x4000>;
dcr-access-method = "native";
dcr-controller ;
device_type = "cpu";
i-cache-line-size = <0x20>;
i-cache-size = <0x4000>;
model = "PowerPC,405";
reg = <0>;
timebase-frequency = <200000000>;
xlnx,dcr-resync = <0x0>;
xlnx,deterministic-mult = <0x0>;
xlnx,disable-operand-forwarding = <0x1>;
xlnx,fastest-plb-clock = "DPLB0";
xlnx,generate-plb-timespecs = <0x1>;
xlnx,mmu-enable = <0x1>;
} ;
} ;
plb0: plb@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,plb-v46-1.03.a", "xlnx,plb-v46-1.00.a", "simple-bus";
ranges ;
DDR_SDRAM: mpmc@84800000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,mpmc-4.03.a";
reg = < 0x84800000 0x10000 >;
} ;
DIPSWs_4Bit: gpio@81420000 {
compatible = "xlnx,xps-gpio-1.00.a";
reg = < 0x81420000 0x10000 >;
xlnx,all-inputs = <0x1>;
xlnx,all-inputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,family = "virtex2p";
xlnx,gpio-width = <0x4>;
xlnx,interrupt-present = <0x0>;
xlnx,is-bidir = <0x1>;
xlnx,is-bidir-2 = <0x1>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
Ethernet_MAC: ethernet@81000000 {
compatible = "xlnx,xps-ethernetlite-2.00.b", "xlnx,xps-ethernetlite-1.00.a";
device_type = "network";
interrupt-parent = <&xps_intc_0>;
interrupts = < 1 0 >;
local-mac-address = [ 00 0a 35 8e 08 00 ];
reg = < 0x81000000 0x10000 >;
xlnx,duplex = <0x1>;
xlnx,family = "virtex2p";
xlnx,rx-ping-pong = <0x1>;
xlnx,tx-ping-pong = <0x1>;
} ;
LEDs_4Bit: gpio@81400000 {
compatible = "xlnx,xps-gpio-1.00.a";
reg = < 0x81400000 0x10000 >;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,family = "virtex2p";
xlnx,gpio-width = <0x4>;
xlnx,interrupt-present = <0x0>;
xlnx,is-bidir = <0x0>;
xlnx,is-bidir-2 = <0x1>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
PushButtons_5Bit: gpio@81440000 {
compatible = "xlnx,xps-gpio-1.00.a";
reg = < 0x81440000 0x10000 >;
xlnx,all-inputs = <0x1>;
xlnx,all-inputs-2 = <0x0>;
xlnx,dout-default = <0x0>;
xlnx,dout-default-2 = <0x0>;
xlnx,family = "virtex2p";
xlnx,gpio-width = <0x5>;
xlnx,interrupt-present = <0x0>;
xlnx,is-bidir = <0x1>;
xlnx,is-bidir-2 = <0x1>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xffffffff>;
xlnx,tri-default-2 = <0xffffffff>;
} ;
RS232_Uart_1: serial@83e00000 {
clock-frequency = <100000000>;
compatible = "xlnx,xps-uart16550-2.00.b", "xlnx,xps-uart16550-2.00.a", "ns16550";
current-speed = <9600>;
device_type = "serial";
interrupt-parent = <&xps_intc_0>;
interrupts = < 2 2 >;
reg = < 0x83e00000 0x10000 >;
reg-offset = <0x1003>;
reg-shift = <2>;
xlnx,family = "virtex2p";
xlnx,has-external-rclk = <0x0>;
xlnx,has-external-xin = <0x0>;
xlnx,is-a-16550 = <0x1>;
} ;
SysACE_CompactFlash: sysace@83600000 {
compatible = "xlnx,xps-sysace-1.00.a";
interrupt-parent = <&xps_intc_0>;
interrupts = < 0 2 >;
reg = < 0x83600000 0x10000 >;
xlnx,family = "virtex2p";
xlnx,mem-width = <0x10>;
} ;
xps_bram_if_cntlr_1: xps-bram-if-cntlr@ffff8000 {
compatible = "xlnx,xps-bram-if-cntlr-1.00.a";
reg = < 0xffff8000 0x8000 >;
xlnx,family = "virtex2p";
} ;
xps_intc_0: interrupt-controller@81800000 {
#interrupt-cells = <0x2>;
compatible = "xlnx,xps-intc-1.00.a";
interrupt-controller ;
reg = < 0x81800000 0x10000 >;
xlnx,kind-of-intr = <0x2>;
xlnx,num-intr-inputs = <0x3>;
} ;
} ;
ppc405_0_dplb1: plb@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,plb-v46-1.03.a", "xlnx,plb-v46-1.00.a", "simple-bus";
ranges ;
} ;
;

硬件系统的的配置和Linux内核的配置基本是是按照参考4做的。

 Linux内核启动

通过编译好的内核文件simpleImage.initrd.virtex405-yao.elf文件通过XMD工具下载到板子上进行测试.

XMD%dow simpleImage.initrd.virtex-yao.elf

在串口终端显示如下内容:

zImage starting: loaded at 0x00400000 (sp: 0x00857fb0)
Allocating 0x345810 bytes for kernel ...
gunzipping (0x00000000 <- 0x0040d000:0x00591000)...done 0x3260c8 bytes
Attached initrd image at 0x00591000-0x008560b7
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0 ip=on root=/dev/ram
Finalizing device tree... flat tree at 0x864300

后来通过修改arch/powerpc/boot/main.c来打印出一些调试信息,确定程序停止在第210行,运行kentry函数,见图2。

图2. arch/powerpc/boot/main.c 部分代码

Ref

1. Linux Operating System Software Debugging Techniques with Xilinx Embedded Development Platforms

http://www.xilinx.com/support/documentation/application_notes/xapp1137.pdf

2. Debugging Kernel Boot Problems  from Xilinx Open Source Wiki

http://xilinx.wikidot.com/debugging-kernel-boot-problems

3."Finalizing device tree… flat tree at 0x5a4300" —- Linux booting problem on custom board. (virtex4fx140)

from Xilinx Forums

http://forums.xilinx.com/xlnx/board/message?message.uid=41289

4. Tutorials for Running Linux on Xilinx FPGAs

http://www.aclevername.com/articles/linux-xilinx-tutorial/index.html

5.Linux kernel git from Xilinx and device trees

http://git.xilinx.com

Post a comment or leave a trackback: Trackback URL.

留下评论