linux3.4.2 编译ko,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.编译

make100ask24x0_configmake

编译完成后生成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 0x260000failed

Could not read entire image due to bad blocks4194304bytes read: ERROR

## Booting image at 30007fc0 ...

Image Name: Linux-3.4.2Created:2020-04-27 14:49:25UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size:2402344 Bytes = 2.3MB

Load Address:30008000Entry Point:30008000Verifying 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:[email protected](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 0x400000Reading datafrom 0x45f800 -- 100%complete.4194304bytes read: OK

## Booting image at 30007fc0 ...

Image Name: Linux-3.4.2Created:2020-04-27 15:26:41UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size:2402344 Bytes = 2.3MB

Load Address:30008000Entry Point:30008000Verifying Checksum ... OK

XIP Kernel Image ... OK

Starting kernel ...

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

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

在uboot里设置启动参数:

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

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

原文:https://www.cnblogs.com/wanglouxiaozi/p/12791102.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值