JZ2440 linux-3.4.2内核启动报错:Verifying Checksum ... Bad Data CRC

使用的uboot版本是1.1.6,是打过u-boot-1.1.6_jz2440.patch的;

kernel使用的版本是3.4.2, 也是打过linux-3.4.2_camera_jz2440.patch的;

u-boot-1.1.6编译步骤如下(开发环境ubuntu16.04):

1. 添加环境变量

vim /etc/profile
export PATH=/usr/local/gcc-3.4.5-glibc-2.3.6/bin:$PATH

这里需要注意的是u-boot-1.1.6版本使用gcc-3.4.5版本去编译,如果用gcc-4.3版本去编译的话会报错。

2.使环境变量生效

source /etc/profil

3.编译

make 100ask24x0_config 
make  

编译完成后生成u-boot.bin。

kernel-3.4.2编译步骤如下(开发环境ubuntu16.04):

1.添加环境变量

这里需要注意的是上面编译u-boot时把交叉编译工具链设为了gcc-3.4.5,kernel-3.4.2版本编译需要用gcc-4.3.2,需要修改环境变量

vim /etc/profile
export PATH=/usr/local/usr/local/arm/4.3.2/bin:$PATH

2.使环境变量生效

source /etc/profile

3.编译

make uImage

编译完成后uImage生成在arch/arm/boot/目录下。

内核启动报错:Verifying Checksum ... Bad Data CRC

Reading data from 0x25f800 --  50% complete.reading NAND page at offset 0x260000 failed
Could not read entire image due to bad blocks
 4194304 bytes read: ERROR
## Booting image at 30007fc0 ...
   Image Name:   Linux-3.4.2
   Created:      2020-04-27  14:49:25 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2402344 Bytes =  2.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... Bad Data CRC

修改u-boot

查看u-boot-1.1.6/include/configs/100ask24x0.h,第59行:

 56 #define MTDIDS_DEFAULT "nand0=nandflash0"
 57 #define MTDPARTS_DEFAULT "mtdparts=nandflash0:256k@0(bootloader)," \
 58                             "128k(params)," \
 59                             "2m(kernel)," \
 60                             "-(root)"

kernel-3.4.2编译生成的uImage是2.3M, 而u-boot-1.1.6里面设置的是2m,明显分配小了。需要把第59行的2m修改为4m,再次编译u-boot。

修改kernel

查看linux-3.4.2/arch/arm/mach-s3c24xx/common-smdk.c第125行,

122     [2] = {
123         .name   = "kernel",
124         .offset = MTDPART_OFS_APPEND,
125         .size   = SZ_2M,
126     },

kernel分配的空间也是2M,太小了,修改成4M,即:

.size   = SZ_4M,

再次编译kernel。

把u-boot.bin和uImage再次烧录到开发板,在uboot里输入b,成功启动。如下:

NAND read: device 0 offset 0x60000, size 0x400000

Reading data from 0x45f800 -- 100% complete.
 4194304 bytes read: OK
## Booting image at 30007fc0 ...
   Image Name:   Linux-3.4.2
   Created:      2020-04-27  15:26:41 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2402344 Bytes =  2.3 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

kernel启动时串口输出乱码的解决方法

输出乱码的原因可能是串口的波特率实际是38400,并没有设置成115200。

在uboot里设置启动参数:

set bootargs noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200

然后再输入b启动,这时串口输出就正常了。

猜你喜欢

转载自www.cnblogs.com/wanglouxiaozi/p/12791102.html