本帖最后由 原来如此 于 2013-6-21 16:26 编辑
pcduino的linux移植二内核是启动了,但是还存在问题,先分析启动信息,再移植根文件系统 问题一:** Unable to read "uEnv.txt" from mmc 0:1 ** 部分启动信息: reading uEnv.txt ** Unable to read "uEnv.txt" from mmc 0:1 **
Loading file "uEnv.txt" from mmc device 0:1 很明显找不到uEnv.txt,uEnv.txt是设置启动参数的,生成过程boot.cmd——>boot.src——>uEnv.txt 1.创建boot.cmd设置启动参数。boot.cmd: setenv bootargs console=ttyS0,115200 noinitrd init=/init root=/dev/mmcblk0p2 rootfstype=ext4 rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 boot/script.bin
fatload mmc 0 0x48000000 boot/uImage
bootm 0x48000000 2.根据boot.cmd生成u-boot能够读取的boot.src文件 mkimage -C none -A arm -T script -d boot.cmd boot.scr 3.据说老版本的u-boot能读取boot.scr,新版本的不能直接读取。为了验证这个,我先只用boot.scr,不行再通过uEnv.txt读取boot.scr: bootenv=boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
mmcboot=echo Running boot.scr script from mmc ...; source ${loadaddr} 4.烧写实验 直接用boot.scr: setenv bootargs console=ttyS0,115200 noinitrd init=/init root=/dev/mmcblk0p2 rootfstype=ext4 rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 boot/script.bin
fatload mmc 0 0x48000000 boot/uImage
bootm 0x48000000 保存退出 change@change:~/Si/A10/pcduino$ mkimage -C none -A arm -T script -d boot.cmd boot.scr
Image Name:
Created: Sat Apr 20 21:41:43 2013
Image Type: ARM Linux Script (uncompressed)
Data Size: 225 Bytes = 0.22 kB = 0.00 MB
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 217 Bytes = 0.21 kB = 0.00 MB 若干这里mkimage报错或移植二中make uImage报错,需要将编译u-boot是生成的tools目录下的mkimage拷贝到/usr/local/bin,即可解决问题 放到pcduino tf卡槽,设置串口 115200 8 n 1启动信息还是 U-Boot SPL 2012.10 (Apr 19 2013 - 18:46:44)
DRAM: 1024MB
SUNXI SD/MMC: 0
U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt ** Unable to read "uEnv.txt" from mmc 0:1 **
Loading file "uEnv.txt" from mmc device 0:1
Failed to mount ext2 filesystem...
** Bad ext2 partition or disk - mmc 0:1 **
ext2load - load binary file from a Ext2 filesystem 用uEnv.txt读取boot.scr bootenv=boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
mmcboot=echo Running boot.scr script from mmc ...; source ${loadaddr} 保存,退出,tf卡插到UBUNTU变/dev/sdc tf卡插到pcduino卡槽,连接串口设置115200 8 n 1,启动信息如下: U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt 144 bytes read
Loaded environment from uEnv.txt
reading boot.scr 289 bytes read
Jumping to boot.scr
## Executing script at 44000000
Wrong image format for "source" command
reading script.bin 44900 bytes read
reading uImage 4693132 bytes read
## Booting kernel from Legacy Image at 48000000 ...
Image Name: Linux-3.0.62
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4693068 Bytes = 4.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK Starting kernel ... <6>Initializing cgroup subsys cpuset
<5>Linux version 3.0.62 ( change@change) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 PREEMPT Sat Apr 20 18:32:39 CST 2013
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: sun4i
<6>Memory cut off:
<6> MALI : 0x5c000000 - 0x5fffffff ( 64 MB)
<4>Ignoring unrecognised tag 0x00000000
<6>Memory Reserved:
<6> SYS : 0x43000000 - 0x4300ffff ( 64 kB)
<6> VE : 0x44000000 - 0x48ffffff ( 80 MB)
<6> G2D : 0x49000000 - 0x49ffffff ( 16 MB)
<6> LCD : 0x5a000000 - 0x5bffffff ( 32 MB)
Memory policy: ECC disabled, Data cache writeback
<6>chip-id: A10 (AW1623 revision C)
<7>On node 0 totalpages: 245760
<7>free_area_init_node: node 0, pgdat c0887ea0, node_mem_map c094e000
<7> Normal zone: 1280 pages used for memmap
<7> Normal zone: 0 pages reserved
<7> Normal zone: 146176 pages, LIFO batch:31
<7> HighMem zone: 768 pages used for memmap
<7> HighMem zone: 97536 pages, LIFO batch:31
<7>pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
<7>pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 243712
<5>Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait loglevel=8 panic=10
<6>PID hash table entries: 4096 (order: 2, 16384 bytes)
<6>Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
<6>Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
<6>Memory: 448MB 512MB = 960MB total
<5>Memory: 833852k/833852k available, 149188k reserved, 393216K highmem
<5>Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) .........太长了此处省略若干,通过上面的启动信息发现uEnv.txt读取正常 <0>Kernel panic - not syncing: Attempted to kill init!
[ 2.650000] Kernel panic - not syncing: Attempted to kill init!
[<c003e92c>] (unwind_backtrace+0x0/0x13c) from [<c05fa2ac>] (panic+0x74/0x188)
[ 2.660000] [<c003e92c>] (unwind_backtrace+0x0/0x13c) from [<c05fa2ac>] (panic+0x74/0x188)
[<c05fa2ac>] (panic+0x74/0x188) from [<c006bfd0>] (do_exit+0x6c4/0x788)
[ 2.670000] [<c05fa2ac>] (panic+0x74/0x188) from [<c006bfd0>] (do_exit+0x6c4/0x788)
[<c006bfd0>] (do_exit+0x6c4/0x788) from [<c003c87c>] (die+0x288/0x300)
[ 2.690000] [<c006bfd0>] (do_exit+0x6c4/0x788) from [<c003c87c>] (die+0x288/0x300)
[<c003c87c>] (die+0x288/0x300) from [<c0042cb0>] (__do_kernel_fault+0x74/0x84)
[ 2.700000] [<c003c87c>] (die+0x288/0x300) from [<c0042cb0>] (__do_kernel_fault+0x74/0x84)
[<c0042cb0>] (__do_kernel_fault+0x74/0x84) from [<c0042e40>] (do_page_fault+0x180/0x2e4)
[ 2.720000] [<c0042cb0>] (__do_kernel_fault+0x74/0x84) from [<c0042e40>] (do_page_fault+0x180/0x2e4)
[<c0042e40>] (do_page_fault+0x180/0x2e4) from [<c00312b4>] (do_DataAbort+0x34/0x98)
[ 2.730000] [<c0042e40>] (do_page_fault+0x180/0x2e4) from [<c00312b4>] (do_DataAbort+0x34/0x98)
[<c00312b4>] (do_DataAbort+0x34/0x98) from [<c0037dd0>] (__dabt_svc+0x70/0xa0)
[ 2.750000] [<c00312b4>] (do_DataAbort+0x34/0x98) from [<c0037dd0>] (__dabt_svc+0x70/0xa0)
Exception stack(0xe783bee8 to 0xe783bf30)
[ 2.770000] Exception stack(0xe783bee8 to 0xe783bf30)
bee0: 29c5c734 00000000 1137666c f1c20800 00000001 55866a9a
[ 2.780000] bee0: 29c5c734 00000000 1137666c f1c20800 00000001 55866a9a
bf00: c0039358 00000000 00000001 6239831b c0944588 11376664 1137665c e783bf30
[ 2.790000] bf00: c0039358 00000000 00000001 6239831b c0944588 11376664 1137665c e783bf30
bf20: f8a905a8 c0059aac 20000013 ffffffff
[ 2.810000] bf20: f8a905a8 c0059aac 20000013 ffffffff
[<c0037dd0>] (__dabt_svc+0x70/0xa0) from [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540)
[ 2.810000] [<c0037dd0>] (__dabt_svc+0x70/0xa0) from [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540)
[<c0059aac>] (sunxi_gpio_request_array+0x160/0x540) from [<c040b868>] (alloc_pin+0xc/0x60)
[ 2.830000] [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540) from [<c040b868>] (alloc_pin+0xc/0x60)
[<c040b868>] (alloc_pin+0xc/0x60) from [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144)
[ 2.850000] [<c040b868>] (alloc_pin+0xc/0x60) from [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144)
[<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144) from [<c0031378>] (do_one_initcall+0x34/0x180)
[ 2.860000] [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144) from [<c0031378>] (do_one_initcall+0x34/0x180)
[<c0031378>] (do_one_initcall+0x34/0x180) from [<c00084d4>] (kernel_init+0x108/0x194)
[ 2.880000] [<c0031378>] (do_one_initcall+0x34/0x180) from [<c00084d4>] (kernel_init+0x108/0x194)
[<c00084d4>] (kernel_init+0x108/0x194) from [<c0039358>] (kernel_thread_exit+0x0/0x8)
[ 2.900000] [<c00084d4>] (kernel_init+0x108/0x194) from [<c0039358>] (kernel_thread_exit+0x0/0x8)
<0>Rebooting in 10 seconds..[ 2.920000] Rebooting in 10 seconds.. 这下内核启动算成功了,由于还没有文件系统,找不到进程init,故kill init
问题二:<0>Kernel panic - not syncing: Attempted to kill init! 上面分析了,其实就是找不到init进程,而文件系统提供这些进程。先写到这,明天开始移植文件系统 下面开始移植根文件系统: 1.编译、安装busybox 先采用默认配置,不行回来再改 修改: 164:CROSS_COMPILE ?= arm-none-linux-gnueabi- 190:ARCH ?= arm 保存退出,开始编译 ........//过程有点长,省略若干 AR util-linux/volume_id/lib.a
LINK busybox_unstripped
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Final link with: m
DOC busybox.pod
DOC BusyBox.txt
DOC busybox.1
DOC BusyBox.html 编译结束,开始安装到指定目录 --------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------
安装过程完成,安装在上面新建的rootfs目录 2.创建设备文件 # /etc/inittab
console::askfirst:-/bin/sh
保存退出 4.安装glibc库 5.烧写、测试 插tf到pcduino,系统启动 U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt 144 bytes read
Loaded environment from uEnv.txt
reading boot.scr 289 bytes read
Jumping to boot.scr
## Executing script at 44000000
Wrong image format for "source" command
reading script.bin 44900 bytes read
reading uImage 4693132 bytes read
## Booting kernel from Legacy Image at 48000000 ...
Image Name: Linux-3.0.62
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4693068 Bytes = 4.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK Starting kernel ... <6>Initializing cgroup subsys cpuset
<5>Linux version 3.0.62 ( change@change) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 PREEMPT Sat Apr 20 18:32:39 CST 2013
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: sun4i
<6>Memory cut off:
<6> MALI : 0x5c000000 - 0x5fffffff ( 64 MB)
<4>Ignoring unrecognised tag 0x00000000
<6>Memory Reserved:
<6> SYS : 0x43000000 - 0x4300ffff ( 64 kB)
<6> VE : 0x44000000 - 0x48ffffff ( 80 MB)
<6> G2D : 0x49000000 - 0x49ffffff ( 16 MB)
<6> LCD : 0x5a000000 - 0x5bffffff ( 32 MB)
Memory policy: ECC disabled, Data cache writeback
<6>chip-id: A10 (AW1623 revision C)
<7>On node 0 totalpages: 245760
<7>free_area_init_node: node 0, pgdat c0887ea0, node_mem_map c094e000
<7> Normal zone: 1280 pages used for memmap
<7> Normal zone: 0 pages reserved
<7> Normal zone: 146176 pages, LIFO batch:31
<7> HighMem zone: 768 pages used for memmap
<7> HighMem zone: 97536 pages, LIFO batch:31
<7>pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
<7>pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 243712
<5>Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait loglevel=8 panic=10
<6>PID hash table entries: 4096 (order: 2, 16384 bytes)
<6>Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
<6>Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
<6>Memory: 448MB 512MB = 960MB total
<5>Memory: 833852k/833852k available, 149188k reserved, 393216K highmem
<5>Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) ........//太长了,省略若干 <0>Kernel panic - not syncing: Attempted to kill init!
[ 2.650000] Kernel panic - not syncing: Attempted to kill init!
[<c003e92c>] (unwind_backtrace+0x0/0x13c) from [<c05fa2ac>] (panic+0x74/0x188)
[ 2.660000] [<c003e92c>] (unwind_backtrace+0x0/0x13c) from [<c05fa2ac>] (panic+0x74/0x188)
[<c05fa2ac>] (panic+0x74/0x188) from [<c006bfd0>] (do_exit+0x6c4/0x788)
[ 2.670000] [<c05fa2ac>] (panic+0x74/0x188) from [<c006bfd0>] (do_exit+0x6c4/0x788)
[<c006bfd0>] (do_exit+0x6c4/0x788) from [<c003c87c>] (die+0x288/0x300)
[ 2.690000] [<c006bfd0>] (do_exit+0x6c4/0x788) from [<c003c87c>] (die+0x288/0x300)
[<c003c87c>] (die+0x288/0x300) from [<c0042cb0>] (__do_kernel_fault+0x74/0x84)
[ 2.700000] [<c003c87c>] (die+0x288/0x300) from [<c0042cb0>] (__do_kernel_fault+0x74/0x84)
[<c0042cb0>] (__do_kernel_fault+0x74/0x84) from [<c0042e40>] (do_page_fault+0x180/0x2e4)
[ 2.720000] [<c0042cb0>] (__do_kernel_fault+0x74/0x84) from [<c0042e40>] (do_page_fault+0x180/0x2e4)
[<c0042e40>] (do_page_fault+0x180/0x2e4) from [<c00312b4>] (do_DataAbort+0x34/0x98)
[ 2.730000] [<c0042e40>] (do_page_fault+0x180/0x2e4) from [<c00312b4>] (do_DataAbort+0x34/0x98)
[<c00312b4>] (do_DataAbort+0x34/0x98) from [<c0037dd0>] (__dabt_svc+0x70/0xa0)
[ 2.750000] [<c00312b4>] (do_DataAbort+0x34/0x98) from [<c0037dd0>] (__dabt_svc+0x70/0xa0)
Exception stack(0xe783bee8 to 0xe783bf30)
[ 2.770000] Exception stack(0xe783bee8 to 0xe783bf30)
bee0: 29c5c734 00000000 1137666c f1c20800 00000001 55866a9a
[ 2.780000] bee0: 29c5c734 00000000 1137666c f1c20800 00000001 55866a9a
bf00: c0039358 00000000 00000001 6239831b c0944588 11376664 1137665c e783bf30
[ 2.790000] bf00: c0039358 00000000 00000001 6239831b c0944588 11376664 1137665c e783bf30
bf20: f8a905a8 c0059aac 20000013 ffffffff
[ 2.810000] bf20: f8a905a8 c0059aac 20000013 ffffffff
[<c0037dd0>] (__dabt_svc+0x70/0xa0) from [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540)
[ 2.810000] [<c0037dd0>] (__dabt_svc+0x70/0xa0) from [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540)
[<c0059aac>] (sunxi_gpio_request_array+0x160/0x540) from [<c040b868>] (alloc_pin+0xc/0x60)
[ 2.830000] [<c0059aac>] (sunxi_gpio_request_array+0x160/0x540) from [<c040b868>] (alloc_pin+0xc/0x60)
[<c040b868>] (alloc_pin+0xc/0x60) from [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144)
[ 2.850000] [<c040b868>] (alloc_pin+0xc/0x60) from [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144)
[<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144) from [<c0031378>] (do_one_initcall+0x34/0x180)
[ 2.870000] [<c00209cc>] (sw_hci_sunxi_init+0x3c/0x144) from [<c0031378>] (do_one_initcall+0x34/0x180)
[<c0031378>] (do_one_initcall+0x34/0x180) from [<c00084d4>] (kernel_init+0x108/0x194)
[ 2.880000] [<c0031378>] (do_one_initcall+0x34/0x180) from [<c00084d4>] (kernel_init+0x108/0x194)
[<c00084d4>] (kernel_init+0x108/0x194) from [<c0039358>] (kernel_thread_exit+0x0/0x8)
[ 2.900000] [<c00084d4>] (kernel_init+0x108/0x194) from [<c0039358>] (kernel_thread_exit+0x0/0x8)
<0>Rebooting in 10 seconds..[ 2.920000] Rebooting in 10 seconds.. 还是没有成功启动文件系统,各位大神知道的还望赐教,一起解决这个问题。待续...... 转载自CSDN,感谢我用国芯分享。
|