linux-kernel – 如何在解压缩失败时找到ARM Linux入口点?

前端之家收集整理的这篇文章主要介绍了linux-kernel – 如何在解压缩失败时找到ARM Linux入口点?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图通过U-boot在i.MX6的自定义板上启动 Linux(cpu内核是ARM Cortex A9)

我们似乎成功移植了Das U-Boot(2009.08).但是在最后的U-Boot消息中启动Linux失败:“启动内核……”

这是我的相关环境:

bootargs=console=ttymxc1,115200 vmalloc=400M root=/dev/mmcblk0p1 rootwait consoleblank=0 earlyprintk video=mxcfb0:dev=lcd,LCD-ORTUS,if=RGB24 video=mxcfb1:dev=hdmi,1280x720M@60,if=RGB24 calibration tsdev=tsc2004 fbmem=10M,28M
bootcmd=ext2load mmc 0:1 10800000 /boot/uImage ; bootm 10800000

启动输出

Loading file "/boot/uImage" from mmc device 0:1 (xxa1)  
4043552 bytes read  
## Booting kernel from Legacy Image at 10800000 ...  
   Image Name:   Linux-3.0.35  
   Image Type:   ARM Linux Kernel Image (uncompressed)  
   Data Size:    4043488 Bytes =  3.9 MB  
   Load Address: 10008000  
   Entry Point:  10008000  
   Verifying Checksum ... OK  
   Loading Kernel Image ... OK  
OK  

Starting kernel ...

当我objdump内核时,在地址80008000处,我看到了arch / arm / kernel / head.S的入口点,而不是arch / arm / boot / compressed / head.S.

我看到的是,内核甚至没有解压缩.我尝试添加一些寄存器操作代码来发送压缩/ head.S中的GPIO信号,但没有响应.

我的问题是,我怎样才能确保U-Boot正在调用正确的入口点?

完全相同的内核二进制文件使用相同的U-Boot命令在飞思卡尔的参考板上成功启动.

编辑:我在U-Boot中添加了一些痕迹.在调用内核之前,指针theKernel是10008000而不是10800000.这是否意味着U-boot在错误的位置跳转

解决方法

We seem to have ported Das U-Boot successfully.

有证据表明这是一个错误的假设.

Just before calling the kernel,the pointer theKernel is 100

We seem to have ported Das U-Boot successfully.

and not 1

We seem to have ported Das U-Boot successfully.

00.

您使用的是哪个版本的U-Boot?
在2012.10和2013.04版本的U-Boot中,变量theKernel仅由AVR32和MIPS等拱门的代码声明和使用.
没有应该使用内核的ARM代码.

u-boot-2012.10$find . -print | xargs grep theKernel
./arch/avr32/lib/bootm.c:   void    (*theKernel)(int magic,void *tagtable);
./arch/avr32/lib/bootm.c:   theKernel = (void *)images->ep;
./arch/avr32/lib/bootm.c:          theKernel,params_start);
./arch/avr32/lib/bootm.c:   theKernel(ATAG_MAGIC,params_start);
./arch/microblaze/lib/bootm.c:  void    (*theKernel) (char *,ulong,ulong);
./arch/microblaze/lib/bootm.c:  theKernel = (void (*)(char *,ulong))images->ep;
./arch/microblaze/lib/bootm.c:      (ulong) theKernel,rd_data_start,(ulong) of_flat_tree);
./arch/microblaze/lib/bootm.c:  theKernel (commandline,(ulong) of_flat_tree);
./arch/mips/lib/bootm.c:    void (*theKernel) (int,char **,int *);
./arch/mips/lib/bootm.c:    theKernel = (void (*)(int,int *))images->ep;
./arch/mips/lib/bootm.c:        (ulong) theKernel);
./arch/mips/lib/bootm.c:    theKernel(linux_argc,linux_argv,linux_env,0);
./arch/mips/lib/bootm_qemu_mips.c:  void (*theKernel) (int,int *);
./arch/mips/lib/bootm_qemu_mips.c:  theKernel = (void (*)(int,int *))images->ep;
./arch/mips/lib/bootm_qemu_mips.c:      (ulong) theKernel);
./arch/mips/lib/bootm_qemu_mips.c:  theKernel(0,NULL,0);
./arch/nds32/lib/bootm.c:   void    (*theKernel)(int zero,int arch,uint params);
./arch/nds32/lib/bootm.c:   theKernel = (void (*)(int,int,uint))images->ep;
./arch/nds32/lib/bootm.c:          (ulong)theKernel);
./arch/nds32/lib/bootm.c:   theKernel(0,machid,bd->bi_boot_params);
u-boot-2012.10$

请解释如何跟踪不应在ARM处理器上定义或分配的变量.

U-Boot打印“Starting kernel …”后的下一个输出应该是“Uncompressing Linux …”.
对于飞思卡尔拱门,此文本输出取决于通过U-Boot将机器类型编号(aka arch_id)正确传递给内核.
您需要验证是否在U-Boot中正确定义了此机器类型编号.

U-Boot的配置文件是什么样的?

I tried adding some register manipulation code to signal GPIOs in compressed/head.S with no response.

您是否理智检查此代码以确保其按预期工作?
您是否从U-Boot命令行尝试了GPIO操作?

My question is,how can I make sure U-Boot is calling the correct entry point?

对于ARM arch,它是跳转到bootm命令中指定的地址.
由于uImage加载地址和bootm指定相同的0x1

We seem to have ported Das U-Boot successfully.

00地址,因此应该是好的(假设U-Boot已正确配置并为ARM构建).

Just before calling the kernel,the pointer theKernel is 100

We seem to have ported Das U-Boot successfully.

and not 1

We seem to have ported Das U-Boot successfully.

00. Does this mean U-boot is jumping at the wrong location?

是.
如果检查源代码(对于AVR32或MIPS),您会发现从映像头分配了内核,特别是入口点值.然后U-Boot会跳转到这个位置.
但真正的问题是你的ARM Cortex A9不应该使用这个代码或这个变量.
似乎没有为正确的拱门配置U-Boot和/或可能无法正确定义机器类型.

更正:

正如OP指出的那样,旧版本的U-Boot确实使用了变量theKernel,甚至用于ARM拱门.

U-Boot输出行:

Loading Kernel Image ... OK

表示U-Boot已经(成功)将内核映像(没有映像信息头)从0x1

We seem to have ported Das U-Boot successfully.

00的bootm地址(加上报头长度的偏移量0x40)复制到加载地址0x100

We seem to have ported Das U-Boot successfully.

.此内存移动操作由common / cmd_bootm.c中的过程bootm_load_os()执行.

因此,您报告的0x100

We seem to have ported Das U-Boot successfully.

的值对于内核是正确的.
没有迹象表明U-Boot跳到了错误的位置.

如前所述,您应该验证是否正确定义了机器类型.该值将在arch/arm/plat-mxc/include/mach/uncompress.h中的__arch_decomp_setup()中使用,以便在内核引导之前的解压缩期间输出文本.

原文链接:https://www.f2er.com/linux/393395.html

猜你在找的Linux相关文章