pcduino的linux移植二内核是启动了,但是还存在问题,先分析启动信息,再移植根文件系统
问题一:**Unable to "from mmc0:1**
部分启动信息:
**Unable to "from mmc0:1**
Loading "from mmc device0:1
很明显不到,是设置启动参数的,生成过程d——>boot.src——&
1.创建d设置启动参数。d:
setenv bootargs console=ttyS0,115200noinitrd root=/dev/mmcblk0p2init=/sbin/init rootwait panic=10${extra} fatload mmc00x43000000boot/script.bin
fatload mmc00x48000000boot/uImage
bootm0x48000000
2.根据d生成u-boot能够读取的boot.src文件
mkimage-C none-A arm-T d boot.scr
3.据说老版本的u-boot能读取boot.scr,新版本的不能直接读取。为了验证这个,我先只用boot.scr,不行再通过 读取boot.scr:
bootenv=boot.scr
loaduimage=fatload mmc${mmcdev}${loadaddr}${bootenv}
mmcboot=echo Running boot.scr script ;source${loadaddr}
4.烧写实验
直接用boot.scr:
change@change:~/Si/A10/pcduino$d
setenv bootargs console=ttyS0,115200noinitrd root=/dev/mmcblk0p2init=/sbin/init rootwait panic=10${extra} fatload mmc00x43000000boot/script.bin
fatload mmc00x48000000boot/uImage
bootm0x48000000
保存退出
change@change:~/Si/A10/pcduino$mkimage-C none-A arm-T d boot.scr
Image Name:
Created:Sat Apr2021:41:432013
Image Type:ARM Linux Script(uncompressed)
Data Size:225Bytes=0.22kB=0.00MB
Load Address:00000000
Entry Point:00000000
Contents:
Image0:217Bytes=0.21kB=0.00MB
若干这里mkimage报错或移植二中make uImage报错,需要将编译u-boot是生成的tools目录下的mkimage拷贝到/usr/local/bin,即可解决问题
change@change:~/Si/A10/pcduino$sudo mount/dev/sdb1/mnt/
[sudo]password for change:
change@change:~/Si/A10/pcduino$cp boot.scr/mnt/
放到pcduino tf卡槽,设置串口1152008n1启动信息还是
U-Boot SPL2012.10(Apr192013-18:46:44)
DRAM:1024MB
SUNXI SD/MMC:0
U-Boot2012.10(Apr192013-18:46:44)Allwinner Technology
CPU:SUNXI Family
Board:pcDuino
I2C:ready
DRAM:1GiB
MMC:SUNXI SD/MMC:0
***Warning-bad CRC,using default environment
In:serial
Out:serial
Err:serial
Hit any key to stop autoboot:0
**Unable to "from mmc0:1**
Loading "from mmc device0:1
Failed to
**Bad ext2partition or disk-mmc0:1**
ext2load-load binary file from a Ext2filesystem
看来还是得用读取boot.scr
change@change:~/Si/A10/pcduino$
bootenv=boot.scr
loaduimage=fatload mmc${mmcdev}${loadaddr}${bootenv}
mmcboot=echo Running boot.scr script ;source${loadaddr}
保存,退出,tf卡插到UBUNTU变/dev/sdc
change@change:~/Si/A10/pcduino$sudo mount/dev/sdc1/mnt/ change@change:~/Si/A10/pcduino$/mnt/
change@change:~/Si/A10/pcduino$sudo umount/dev/sdc1/mnt/ umount:/mnt:not mounted
tf卡插到pcduino卡槽,连接串口设置1152008n1,启动信息如下:
U-Boot2012.10(Apr192013-18:46:44)Allwinner Technology
CPU:SUNXI Family
Board:pcDuino
I2C:ready
DRAM:1GiB
MMC:SUNXI SD/MMC:0
***Warning-bad CRC,using default environment
In:serial
Out:serial
Err:serial
Hit any key to stop autoboot:0
144bytes read
Loaded environment
reading boot.scr
289bytes read
Jumping to boot.scr
##Executing script at44000000
Wrong image format for"source"command
reading script.bin
44900bytes read
reading uImage
4693132bytes read
##Booting kernel from Legacy
Image Name:Linux-3.0.62
Image Type:ARM Linux Kernel Image(uncompressed)
Data Size:4693068Bytes=4.5MiB
Load Address:40008000
Entry Point:40008000
OK
Loading OK
OK
<6>Initializing cgroup subsys cpuset
<5>Linux version3.0.62(change@change)(gcc version4.4.1(Sourcery G++Lite2009q3-67))#1PREEMPT Sat Apr 2018:32:39CST2013
CPU:ARMv7Processor[413fc082]revision2(ARMv7),cr=10c5387d
CPU:VIPT nonaliasing data cache,VIPT aliasing instruction cache
Machine:sun4i
<6>Memory cut off:
<6>MALI:0x5c000000-0x5fffffff(64MB)
<4>Ignoring unrecognised tag0x00000000
<6>Memory Reserved:
<6>SYS:0x43000000-0x4300ffff(64kB)
<6>VE:0x44000000-0x48ffffff(80MB)
<6>G2D:0x49000000-0x49ffffff(16MB)
<6>LCD:0x5a000000-0x5bffffff(32MB)
Memory policy:ECC disabled,Data cache writeback
<6>chip-id:A10(AW1623revision C)
<7>On node0totalpages:245760
<7>free_area_init_node:node0,pgdat c0887ea0,node_mem_map c094e000
<7>Normal zone:1280pages used for memmap
<7>Normal zone:0pages reserved
<7>Normal zone:146176pages,LIFO batch:31
<7>HighMem zone:768pages used for memmap
<7>HighMem zone:97536pages,LIFO batch:31
<7>pcpu-alloc:s0r0d32768u32768alloc=1*32768
<7>pcpu-alloc:[0]0
Built1zonelists in Zone order,mobility grouping on.Total pages:243712
<5>Kernel command line:console=ttyS0,115200root=/dev/mmcblk0p2rootwait loglevel=8panic=10
<6>PID hash table entries:4096(order:2,16384bytes)
<6>Dentry cache hash table entries:131072(order:7,524288bytes)
<6>Inode-cache hash table entries:65536(order:6,262144bytes)
<6>Memory:448MB512MB=960MB total
<5>Memory:833852k/833852k available,149188k reserved,393216K highmem
<5>Virtual kernel memory layout:
vector:0xffff0000-0xffff1000(4kB)
fixmap:0xfff00000-0xfffe0000(896kB)
.........太长了此处省略若干,通过上面的启动信息发现读取正常
<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(0xe783bee8to0xe783bf30)
[  2.770000]Exception stack(0xe783bee8to0xe783bf30)
bee0:29c5c734000000001137666c f1c208000000000155866a9a
[  2.780000]bee0:29c5c734000000001137666c f1c208000000000155866a9a
bf00:c003935800000000000000016239831b c0944588113766641137665c e783bf30
[  2.790000]bf00:c003935800000000000000016239831b c0944588113766641137665c e783bf30
bf20:f8a905a8c0059aac20000013ffffffff
[  2.810000]bf20:f8a905a8c0059aac20000013ffffffff
[<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)
unable[<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 in10seconds..[  2.920000]Rebooting in10seconds..
这下内核启动算成功了,由于还没有文件系统,不到进程init,故kill init
问题二:<0>Kernel panic-not syncing:Attempted to kill init!
上面分析了,其实就是不到init进程,而文件系统提供这些进程。先写到这,明天开始移植文件系统
下面开始移植根文件系统:
change@change:~/Si/A10/pcduino$mkdir rootfs
1.编译、安usybox
获取busybox源码www.busybox/点击BusyBox1.21.0下载源码,解压到工作目录并进入该目录
change@change:~/Si/A10/pcduino/busybox-1.21.0$make menuconfig
先采用默认配置,不行回来再改。回来把builid option把Build BusyBox as a static binary(no shared libs)把这个选上change@change:~/Si/A10/pcduino/busybox-1.21.0$vim Makefile
修改:
164:CROSS_COMPILE?=arm-none-linux-gnueabi-
190:ARCH?=arm
保存退出,开始编译
change@change:~/Si/A10/pcduino/busybox-1.21.0$make
........//过程有点长,省略若干
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.1
DOC BusyBox.html
编译结束,开始安装到指定目录
change@change:~/Si/A10/pcduino/busybox-1.21.0$make CONFIG_PREFIX=../rootfs install
--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。