[p=26, null, left][color=#333333][font=Arial]经过一周的尝试,我的pcduino mini linux系统跑起来了。下面可以专心做驱动开发,以及移植自己的Android系统。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]准备一张tf卡,我用的1G Kingstorm。准备文件:sunxi-spl.bin、u-boot.bin、script.bin、uImage、boot.scr、uEnv.txt、rootfs[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]linux最小系统制作过程(详细过程见linux移植一二三)如下:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ ls /dev/sdb
sdb sdb1 [/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo sfdisk -R /dev/sdb[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo cat <<EOT | sudo sfdisk --in-order -uM /dev/sdb
> 1,16,c
> ,,L
> EOT[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.7 (24 Dec 2009)
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo mkfs.ext4 /dev/sdb2[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo mount /dev/sdb1 /mnt/[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo cp ../linux-sunxi-sunxi-3.0/arch/arm/boot/uImage /mnt/
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo cp ../sunxi-tools-master/script.bin /mnt/
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo cp ../boot.scr /mnt/
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo cp ../uEnv.txt /mnt/
change@change:~/Si/A10/pcduino/u-boot-sunxi-sunxi$ sudo umount /dev/sdb1[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]/dev/sdb1 最后包括文件:script.bin、uImage、boot.scr、uEnv.txt[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]change@change:~/Si/A10/pcduino$ sudo umount /dev/sdb2
change@change:~/Si/A10/pcduino$ sudo mount /dev/sdc2 /mnt/
change@change:~/Si/A10/pcduino$ sudo cp -pR rootfs/* /mnt/ -d
change@change:~/Si/A10/pcduino$ sudo umount /dev/sdc2[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]/dev/sdb2 最后包括rootfs中所以文件,如下:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]bin dev etc home lib linuxrc mnt proc run sbin sys tmp usr var[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]最后取下tf卡,插到pcDuino,设置串口115200 8 n 1,单板默认从tf卡启动。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]启动界面如下:[/font][/color][/p]
[p=26, null, left][color=#333333][font=Arial]U-Boot 2012.10 (Apr 19 2013 - 18:46:44) Allwinner Technology[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]CPU: SUNXI Family
Board: pcDuino
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
reading uEnv.txt[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]144 bytes read
Loaded environment from uEnv.txt
reading boot.scr[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]289 bytes read
Jumping to boot.scr
## Executing script at 44000000
Wrong image format for "source" command
reading script.bin[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]44900 bytes read
reading uImage[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]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[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]Starting kernel ...[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]<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)[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]........//太长了,省略若干[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]<6>mmc0: new high speed SD card at address 1234
[ 4.140000] mmc0: new high speed SD card at address 1234
<6>mmcblk0: mmc0:1234 SA01G 942 MiB
[ 4.160000] mmcblk0: mmc0:1234 SA01G 942 MiB
<6> mmcblk0: p1 p2
[ 4.170000] mmcblk0: p1 p2
<6>Console: switching to colour frame buffer device 160x45
[ 4.290000] Console: switching to colour frame buffer device 160x45
<4>regulator_init_complete: axp20_buck3: incomplete constraints, leaving on
[ 4.330000] regulator_init_complete: axp20_buck3: incomplete constraints, leaving on
<4>regulator_init_complete: axp20_buck2: incomplete constraints, leaving on
[ 4.350000] regulator_init_complete: axp20_buck2: incomplete constraints, leaving on
<4>regulator_init_complete: axp20_ldo4: incomplete constraints, leaving on
[ 4.360000] regulator_init_complete: axp20_ldo4: incomplete constraints, leaving on
<4>regulator_init_complete: axp20_ldo3: incomplete constraints, leaving on
[ 4.380000] regulator_init_complete: axp20_ldo3: incomplete constraints, leaving on
<4>regulator_init_complete: axp20_ldo2: incomplete constraints, leaving on
[ 4.390000] regulator_init_complete: axp20_ldo2: incomplete constraints, leaving on
<4>regulator_init_complete: axp20_ldo1: incomplete constraints, leaving on
[ 4.410000] regulator_init_complete: axp20_ldo1: incomplete constraints, leaving on
<6>sunxi-rtc sunxi-rtc: sunxi_rtc_gettime
[ 4.420000] sunxi-rtc sunxi-rtc: sunxi_rtc_gettime
<6>sunxi-rtc sunxi-rtc: read time 2010-1-1 0:0:10
[ 4.430000] sunxi-rtc sunxi-rtc: read time 2010-1-1 0:0:10
<6>sunxi-rtc sunxi-rtc: setting system clock to 2010-01-01 00:00:10 UTC (1262304010)
[ 4.440000] sunxi-rtc sunxi-rtc: setting system clock to 2010-01-01 00:00:10 UTC (1262304010)
<3>EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
[ 4.460000] EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
<3>EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (244)
[ 4.480000] EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (244)
<6>EXT4-fs (mmcblk0p2): recovery complete
[ 5.840000] EXT4-fs (mmcblk0p2): recovery complete
<6>EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 6.060000] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
<6>VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 6.080000] VFS: Mounted root (ext4 filesystem) on device 179:2.
<6>devtmpfs: mounted
[ 6.090000] devtmpfs: mounted
<6>Freeing init memory: 164K
[ 6.090000] Freeing init memory: 164K
mount: mounting devpts on /dev/pts failed: No such file or directory
mount: mounting /dev/mmcblk0p1 on /boot failed: No such file or directory
Please press Enter to activate this console.
Processing /etc/profile... Done
/ # ls
bin home lost+found run tmp
dev lib mnt sbin usr
etc linuxrc proc sys var[/font][/color][/p][color=rgb(0, 102, 0)][font=Arial]/ # ifconfig eth0
eth0 Link encap:Ethernet HWaddr 12:5B:BD:7D:C4:75
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:55 Base address:0x8000
/ # ifconfig eth0 172.16.1.133
<4>wemac wemac.0: WARNING: no IRQ resource flags set.
[ 2360.950000] wemac wemac.0: WARNING: no IRQ resource flags set.
<6>wemac wemac.0: eth0: link down
[ 2361.060000] wemac wemac.0: eth0: link down
<6>ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 2361.070000] ADDRCONF(NETDEV_UP): eth0: link is not ready
/ # [/font][/color]
[p=26, null, left][color=#333333][font=Arial]详细移植过程见linux移植一、二、三。花了不少时间啊,这是移植心得。pcduino linux移植期间遇到了不少问题,总结如下:[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]1.pkg-config可以解决明明在自己机器上编译好好的,在别人电脑上编译就不行问题,它能为已安装的库时提供统一接口。了解pkg-config解决Package libusb-1.0 was not found in the pkg-config search path[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]2.用busybox制作文件系统时,要注意文件的属性。包括动态链接、执行权限等。通过sudo cp -pR file1 file2 -d,保留文件属性,否则系统跑步起来。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]cp命令选项含义如下:
- a 该选项通常在拷贝目录时使用。它保留链接、文件属性,并递归地拷贝目录,其作用等于dpR选项的组合。
- d 拷贝时保留链接。
- f 删除已经存在的目标文件而不提示。
- i 和f选项相反,在覆盖目标文件之前将给出提示要求用户确认。回答y时目标文件将被覆盖,是交互式拷贝。
- p 此时cp除复制源文件的内容外,还将把其修改时间和访问权限也复制到新文件中。
- r 若给出的源文件是一目录文件,此时cp将递归复制该目录下所有的子目录和文件。此时目标文件必须为一个目录名。
- l 不作拷贝,只是链接文件。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]3.ubuntu下烧写tf卡命令,这里容易出问题,发现杂牌子的tf卡就不行,卡了一段时间,最后果断Kingstorm[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]4.Kernel panic - not syncing: No init found. Try passing init= option to kernel,这个问题说了找不到init,而我设置init=/sbin/init,显然没问题。原因何在呢?[/font][/color][/p][p=26, null, left][color=#333333][font=Arial][b]change@change:~/Si/A10/pcduino/rootfs$[/b] ls sbin/ -l
[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]lrwxrwxrwx 1 change change 14 2013-04-28 21:16 init -> ../bin/busybox
[/font][/color][/p][p=26, null, left][color=#333333][font=Arial][b]change@change:~/Si/A10/pcduino/rootfs$ [/b]file linuxrc
linuxrc: symbolic link to `bin/busybox'
[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]发现bin/busybox是一个动态链接库文件,依赖交叉编译链的相应库。而交叉编译链库有很多,试了发现../arm-2009q3/arm-none-linux-gnueabi/libc/armv4t/lib/和 /home/change/tools/arm-2009q3/arm-none-linux-gnueabi/libc/armv4t/usr/lib/ 下的*.so*库可以使用。[/font][/color][/p][p=26, null, left][color=#333333][font=Arial]还有拷贝后linuxrc有1.9M左右,如果拷贝时没加 -d选项,拷贝后只有0字节,启动时也会出现上面问题。[/font][/color][/p]
转自:[url]http://blog.csdn.net/u010216127/article/details/8865451[/url]