uboot版本:u-boot-xlnx-xilinx-v2016.4
内核版本:linux-xlnx-xilinx-v2016.4
1、在linux 启动后出现以下信息:
uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.6.0-xilinx (hyy@hyy-virtual-machine) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-50) ) #31 SMP PREEMPT Thu Jun 15 09:18:39 CST 2017
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Zynq ZC702 Development Board
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x3f000000
Memory policy: Data cache writealloc
hyy_debug setup_arch
hyy_debug unflatten_device_tree satrt
-> unflatten_device_tree()
Unflattening device tree: fe5d2000
Unable to handle kernel paging request at virtual address fe5d2000
pgd = c0004000
[fe5d2000] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.6.0-xilinx #31
Hardware name: Xilinx Zynq Platform
task: c0a065c0 ti: c0a00000 task.ti: c0a00000
PC is at __unflatten_device_tree+0x34/0x174
LR is at __unflatten_device_tree+0x34/0x174
pc : [] lr : [] psr: 600000d3
sp : c0a01f48 ip : c0a00000 fp : 00000000
r10: c0116660 r9 : 413fc090 r8 : c0a64110
r7 : c091d6e0 r6 : efffc280 r5 : c0a59b48 r4 : fe5d2000
r3 : c0a01f3c r2 : c0786011 r1 : c0786011 r0 : 00000022
Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 0000404a DAC: 00000051
Process swapper (pid: 0, stack limit = 0xc0a00210)
Stack: (0xc0a01f48 to 0xc0a02000)
1f40: c07862ef c0a01f6c 00000001 c018b32c c07862ef c0a01f6c
1f60: c0929b90 c0a59b48 efffc280 c0a076c4 c0a01fd4 c091e268 c0a01f74 c0903f40
1f80: ffffffff 18c5387d 00000000 c0151030 c0739a2a c0a01fb4 00000001 c018b32c
1fa0: c0739a2a 00000000 c0a39c40 ffffffff c0a077ec 00000001 00000000 c09008cc
1fc0: 00000000 00000000 00000000 00000000 00000000 c0930a30 00000000 c0a39ed4
1fe0: c0a02480 c0930a2c c0a077ec 0000406a 00000000 0000807c 00000000 00000000
[] (__unflatten_device_tree) from [] (unflatten_device_tree+0x20/0x48)
[] (unflatten_device_tree) from [] (setup_arch+0x738/0x9c8)
[] (setup_arch) from [] (start_kernel+0x50/0x364)
[] (start_kernel) from [<0000807c>] (0x807c)
Code: 0a000042 e1a01004 e59f0114 ebf32bed (e5943000)
---[ end trace cb88537fdc8fa200 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!
看PC 指针和LR指针发现在内核的fdt_check_header 函数后 __unflatten_device_tree函数前出现崩溃。可以看到都是和设备树有关,原先以为是设备树的问题,后来发现不是这样。
在linux 内核配置时:
在 Kernel Features->Memory split 中选择1G/3G user/kernel
split
问题解决。
2、
Uboot启动时出现
Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid
提示加载文件系统的格式错误。
使用 mkimage -n 'Ramdisk Image'
-A arm -O linux -T ramdisk -C gzip -d ramdisk.image.gz
ramdisk.image.gz_test
将原先的ramdisk.image.gz 转换以后,得到的新文件可以正常使用。
mkimage 为自己使用的uboot编译出来的工具。
总结
xxx_defconfig为默认的内核配置文件(修改其中的CONFIG_VMSPLIT_*),也可通过make menuconfig配置,与Prelink相关的主要是指定用户空间和内核空间内存如何分配4G的虚拟内存空间(Memory split),一般有三种方式:3G/1G,2G/2G,1G/3G(user/kernel),一般默认的是用户空间3G(0x0-0xBFFFFFFF),内核空间1G(0xC0000000 - 0xFFFFFFFF)
内存分析示例,以3G/1G为例(见build/core/prelink-linux-arm.map)
0xC0000000 - 0xFFFFFFFF Kernel
0xB0100000 - 0xBFFFFFFF Thread 0 static
0xB0000000 - 0xB00FFFFF Linker
0xA0000000 - 0xBFFFFFFF Prelinked System Libraries
0x90000000 - 0x9FFFFFFF Prelinked App Libraries
0x80000000 - 0x8FFFFFFF Non-prelinked Libraries
0x40000000 - 0x7FFFFFFF mmap’s stuff
0x10000000 - 0x3FFFFFFF Thread Stacks
0x00000000 - 0x0FFFFFFF .text / .data / heap