beyond291 发表于 2008-6-2 22:47:39

请教一下MPC8560的linux编译问题,谢谢!

根据powerpc的linux介绍,ARCH=ppc的分支不再维护了,ARCH=powerpc是以后的发展方向。
只是目前ppc往powerpc的转移还没有完成,所以编译powerpc的linux存在两种方式。
我在公司移植过linux2.6.24到MPC8349的单板上,只能使用ARCH=ppc来编译才可以,用ARCH=powerpc
则编译后无法运行,经过初步定位在setup_32.s里边的CPU初始化就失败了,可能转移还没有完成吧。
最近特想玩玩MPC8560,没有硬件环境,只能在模拟器里玩,skyeye支持MPC8560,所以想尝试一下,
但是遇到了些问题:
我用ARCH=powerpc的方式编译出来的内核,用skyeye运行,出现如下情况:
jason@Slackware:~/linux-2.6.24/mpc8560$ skyeye -e vmlinux
big_endian is true.
arch: ppc
mach info: name mpc8560, mach_init addr 0x80b0f30
uart_mod:0, desc_in:, desc_out:, converter:
malloc succ for dpram, dpram=0x8224250
Load initrd.img to 0x2000000...
exec file "vmlinux"'s format is elf32-big.
load section .text: addr = 0xc0000000size = 0x001ca000.
load section .rodata: addr = 0xc01ca000size = 0x000452ec.
load section __param: addr = 0xc020f2ecsize = 0x000001cc.
load section __ex_table: addr = 0xc0210000size = 0x00001178.
load section __bug_table: addr = 0xc0211178size = 0x00002b90.
load section .init.text: addr = 0xc0214000size = 0x00019fa8.
load section .exit.text: addr = 0xc022dfa8size = 0x000009a4.
load section .init.data: addr = 0xc022e950size = 0x00002812.
load section .init.setup: addr = 0xc0231170size = 0x000002d0.
load section .initcall.init: addr = 0xc0231440size = 0x000001d4.
load section .con_initcall.init: addr = 0xc0231614size = 0x00000008.
load section __ftr_fixup: addr = 0xc0231620size = 0x000000a0.
load section .init.ramfs: addr = 0xc0232000size = 0x00000086.
load section .machine.desc: addr = 0xc0233000size = 0x000000d0.
load section .data: addr = 0xc0234000size = 0x000194d8.
load section .data.init_task: addr = 0xc024e000size = 0x00002000.
load section .data.page_aligned: addr = 0xc0250000size = 0x00003000.
load section .data.cacheline_aligned: addr = 0xc0253000size = 0x000006c0.
load section .data.read_mostly: addr = 0xc02536c0size = 0x000009fc.
not load section .bss: addr = 0xc0255000size = 0x00016a30 .
not load section .stab: addr = 0x00000000size = 0x000002f4 .
not load section .PPC.EMB.apuinfo: addr = 0x00000000size = 0x00000020 .
not load section .stabstr: addr = 0x00000000size = 0x00000448 .
not load section .comment: addr = 0x00000000size = 0x000025f8 .
call ARMul_InitSymTable,kernel filename is vmlinux.
start addr is set to 0xc0000000 by exec file.
Unimplement exception type 6, pc=0xc021c914.
jason@Slackware:~/linux-2.6.24/mpc8560$
如果我用ARCH=ppc编译,则编译不通过,信息如下:
ppc_85xx-objcopy -O elf32-powerpc \
                --add-section=.image=arch/ppc/boot/images/vmlinux.gz \
                --set-section-flags=.image=contents,alloc,load,readonly,data \
                arch/ppc/boot/simple/dummy.o arch/ppc/boot/simple/image.o
ppc_85xx-ld -m elf32ppc -T /home/jason/linux-2.6.24/arch/ppc/boot/ld.script -Ttext 0x00800000 -Bstatic -o arch/ppc/boot/simple/zvmlinux arch/ppc/boot/simple/head.o arch/ppc/boot/simple/relocate.o arch/ppc/boot/simple/misc.o arch/ppc/boot/simple/image.o arch/ppc/boot/common/lib.a arch/ppc/boot/lib/lib.a
arch/ppc/boot/common/lib.a(misc-common.o): In function `puts':
misc-common.c:(.text+0x7d0): undefined reference to `serial_putc'
misc-common.c:(.text+0x848): undefined reference to `serial_putc'
arch/ppc/boot/common/lib.a(misc-common.o): In function `putc':
misc-common.c:(.text+0xb20): undefined reference to `serial_putc'
misc-common.c:(.text+0xbe4): undefined reference to `serial_putc'
arch/ppc/boot/common/lib.a(misc-common.o): In function `tstc':
misc-common.c:(.text+0xc34): undefined reference to `serial_tstc'
arch/ppc/boot/common/lib.a(misc-common.o): In function `getc':
misc-common.c:(.text+0xc64): undefined reference to `serial_tstc'
misc-common.c:(.text+0xc74): undefined reference to `serial_getc'
make: *** Error 1
make: *** Error 2
make: *** Error 2
jason@Slackware:~/linux-2.6.24$
所有的配置都没有修改,直接用mpc8560_ads_defconfig配置文件。
不知道skyeye的testcase里mpc8560的linux内核是怎么生成的?还请skyeye的高手们指导一下,谢谢!!!

ksh 发表于 2008-6-3 09:51:58

使用ARCH=ppc ,你碰到的错误可以忽略,运行结果如下:

ksh@server:/opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560> make ARCH=ppc CROSS_COMPILE=powerpc-linux-gnuspe-
make -C /opt/testsuite/linux/mpc8560/linux-2.6.22 O=/opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560
Using /opt/testsuite/linux/mpc8560/linux-2.6.22 as source for kernel
GEN   /opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560/Makefile
CHK   include/linux/version.h
CHK   include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-ppc
CALL    /opt/testsuite/linux/mpc8560/linux-2.6.22/scripts/checksyscalls.sh
CHK   include/linux/compile.h
MODPOST vmlinux
UIMAGEarch/ppc/boot/images/uImage
"mkimage" command not found - U-Boot images will not be built
Image: arch/ppc/boot/images/uImage not made
AS      arch/ppc/boot/simple/head.o
AS      arch/ppc/boot/simple/relocate.o
CC      arch/ppc/boot/simple/misc.o
powerpc-linux-gnuspe-objcopy -O elf32-powerpc \
                --add-section=.image=arch/ppc/boot/images/vmlinux.gz \
                --set-section-flags=.image=contents,alloc,load,readonly,data \
                arch/ppc/boot/simple/dummy.o arch/ppc/boot/simple/image.o
powerpc-linux-gnuspe-ld -m elf32ppc -T /opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/ld.script -Ttext 0x00800000 -Bstatic -o arch/ppc/boot/simple/zvmlinux arch/ppc/boot/simple/head.o arch/ppc/boot/simple/relocate.o arch/ppc/boot/simple/misc.o arch/ppc/boot/simple/image.o arch/ppc/boot/common/lib.a arch/ppc/boot/lib/lib.a
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x30): In function `tstc':
/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:89: undefined reference to `serial_tstc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x5c): In function `getc':
/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:102: undefined reference to `serial_tstc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x6c):/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:103: undefined reference to `serial_getc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0xfc): In function `puts':
/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:170: undefined reference to `serial_putc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x158):/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:171: undefined reference to `serial_putc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x1c0): In function `putc':
/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:120: undefined reference to `serial_putc'
arch/ppc/boot/common/lib.a(misc-common.o)(.text+0x278):/opt/testsuite/linux/mpc8560/linux-2.6.22/arch/ppc/boot/common/misc-common.c:122: undefined reference to `serial_putc'
make: *** Error 1
make: *** Error 2
make: *** Error 2
make: *** Error 2
make: *** Error 2
ksh@server:/opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560> ls vmlinux
vmlinux
ksh@server:/opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560> ../trunk_snapshot/skyeye -e vmlinux
Your elf file is big endian.
arch: ppc
mach info: name mpc8560, mach_init addr 0x4574b9
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
failed to setup_module (name:net, type:rtl8019_16)
tapif_init: icotl TUNSETIFF erroruart_mod:0, desc_in:, desc_out:, converter:
malloc succ for dpram, dpram=0x7766d0
Load initrd.img to 0x2000000...
exec file "vmlinux"'s format is elf32-big.
load section .text: addr = 0xc0000000size = 0x001d58e8.
load section .rodata: addr = 0xc01d6000size = 0x0002afab.
load section .pci_fixup: addr = 0xc0200facsize = 0x00000540.
not load section .rio_route: addr = 0xc02014ecsize = 0x00000000 .
not load section __ksymtab: addr = 0xc02014ecsize = 0x00000000 .
not load section __ksymtab_gpl: addr = 0xc02014ecsize = 0x00000000 .
not load section __ksymtab_unused: addr = 0xc02014ecsize = 0x00000000 .
not load section __ksymtab_unused_gpl: addr = 0xc02014ecsize = 0x00000000 .
not load section __ksymtab_gpl_future: addr = 0xc02014ecsize = 0x00000000 .
not load section __kcrctab: addr = 0xc02014ecsize = 0x00000000 .
not load section __kcrctab_gpl: addr = 0xc02014ecsize = 0x00000000 .
not load section __kcrctab_unused: addr = 0xc02014ecsize = 0x00000000 .
not load section __kcrctab_unused_gpl: addr = 0xc02014ecsize = 0x00000000 .
not load section __kcrctab_gpl_future: addr = 0xc02014ecsize = 0x00000000 .
load section __param: addr = 0xc02014ecsize = 0x00000190.
load section __ex_table: addr = 0xc0202000size = 0x00001480.
load section __bug_table: addr = 0xc0203480size = 0x00003508.
load section .data: addr = 0xc0207000size = 0x00017690.
load section .data.page_aligned: addr = 0xc021f000size = 0x00003000.
load section .data.cacheline_aligned: addr = 0xc0222000size = 0x00000100.
load section .data.init_task: addr = 0xc0224000size = 0x00002000.
load section .init.text: addr = 0xc0226000size = 0x0001a5b8.
load section .exit.text: addr = 0xc02405b8size = 0x00000a38.
load section .init.data: addr = 0xc0240ff0size = 0x000023d0.
load section .init.setup: addr = 0xc02433c0size = 0x00000288.
load section .initcall.init: addr = 0xc0243648size = 0x000001a8.
load section .con_initcall.init: addr = 0xc02437f0size = 0x00000004.
not load section .security_initcall.init: addr = 0xc02437f4size = 0x00000000 .
load section __ftr_fixup: addr = 0xc02437f4size = 0x00000060.
load section .init.ramfs: addr = 0xc0244000size = 0x00000086.
not load section .bss: addr = 0xc0245000size = 0x00023518 .
not load section .stab: addr = 0x00000000size = 0x00000360 .
not load section .PPC.EMB.apuinfo: addr = 0x00000000size = 0x00000020 .
not load section .stabstr: addr = 0x00000000size = 0x000004d1 .
not load section .comment: addr = 0x00000000size = 0x0000260a .
not load section .debug_aranges: addr = 0x00000000size = 0x00005540 .
not load section .debug_pubnames: addr = 0x00000000size = 0x0001b94f .
not load section .debug_info: addr = 0x00000000size = 0x00fa8b0c .
not load section .debug_abbrev: addr = 0x00000000size = 0x0008abf1 .
not load section .debug_line: addr = 0x00000000size = 0x001335f4 .
not load section .debug_frame: addr = 0x00000000size = 0x0003d5d4 .
not load section .debug_str: addr = 0x00000000size = 0x0005ab4c .
not load section .debug_ranges: addr = 0x00000000size = 0x0002d298 .
not load section .note.GNU-stack: addr = 0x00000000size = 0x00000000 .
call ARMul_InitSymTable,kernel filename is vmlinux.
start addr is set to 0xc0000000 by exec file.
in ppc_write_effective_word, error when write to PCI_ATMU.offset=0x8df0,pc=0xc022f944
Memory CAM mapping: CAM0=64Mb, CAM1=0Mb, CAM2=0Mb residual: 0Mb
Linux version 2.6.22 (ksh@server) (gcc version 3.4.3) #38 Sun May 25 21:23:15 CST 2008
Zone PFN ranges:
DMA             0 ->    16384
Normal      16384 ->    16384
early_node_map active PFN ranges
    0:      0 ->    16384
Built 1 zonelists.Total pages: 16256
Kernel command line: root=/dev/ram0 console=ttyCPM0 mem=64M
OpenPIC Version 1.2 (1 CPUs and 60 IRQ sources) at fcf7d000
PID hash table entries: 256 (order: 8, 1024 bytes)
cpm_uart: console: compat mode
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 61440k available (1880k kernel code, 464k data, 124k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
PCI: Probing PCI hardware
Generic PHY: Registered new driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 3, 40960 bytes)
TCP bind hash table entries: 2048 (order: 3, 40960 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
Freeing initrd memory: 1024k freed
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Generic RTC Driver v1.07
Serial: CPM driver $Revision: 0.02 $
cpm_uart: WARNING: no UART devices found on platform bus!
cpm_uart: the driver will guess configuration, but this mode is no longer supported.
ttyCPM0 at MMIO 0xfdfd1a00 (irq = 40) is a CPM UART
ttyCPM1 at MMIO 0xfdfd1a20 (irq = 41) is a CPM UART
RAMDISK driver initialized: 16 RAM disks of 32768K size 1024 blocksize
loop: module loaded
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 2048KiB into ram disk... done.
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 124k init
>
ls
/> ls
bin
dev
etc
helloworld
lost+found
proc
sbin
usr
/> mount -t proc none /proc
/> cat /proc/cpuinfo
processor       : 0
cpu             : unknown (00000000)
revision      : 0.0 (pvr 0000 0000)
bogomips      : 25.60
chipset         :
Vendor          : Freescale Semiconductor
Machine         : mpcads
clock         : 524MHz
PVR             : 0x0
SVR             : 0x0
PLL setting   : 0x0
Memory          : 64 MB
/>
ksh@server:/opt/testsuite/linux/mpc8560/build-2.6.20_mpc8560>

ksh 发表于 2008-6-3 09:56:13

回复 #1 beyond291 的帖子

另外,我们对powerpc的模拟又fix了一些bug,如果你使用最新版本,则可以运行不加修改kernel任何代码的image文件。相关信息请看:http://lists.gro.clinux.org/pipermail/skyeye-developer/2008-June/001817.html

我们在六月中旬开始模拟powerpc双核的mpc8572,也希望对powerpc有一定基础的,并且感兴趣的朋友一起参与。

[ 本帖最后由 ksh 于 2008-6-8 11:05 编辑 ]

hudiejiee 发表于 2009-5-18 22:46:25

我运行的时候还是像楼主一模一样的情况啊(ppc)

出来,运行的时候还是像楼主一模一样的情况啊,还是停在那里,我用的initrd.img是test case 里面直接拷过来的,因为我没有这个文件,请问,可以这样吗?
页: [1]
查看完整版本: 请教一下MPC8560的linux编译问题,谢谢!