JZ2440开发板nand flash出现坏块的解决办法

前言:我在JZ2440烧写linux内核镜像(uImage)之后,内核可以正常启动,但是我烧写玩Yaffs2格式的根文件系统之后,内核启动不了,根据我以往的学习和工作经验,可能是nand flash出现了坏块,(nand flash是比较容易出现坏块的),下面是我的解决办法。

CPU   : jz2440
u-boot: u-boot-1.1.6
kernel: linux-4.19-rc3
root  :fs_mini_mdev_new

1. 我在烧写是通过串口打印,可以看出uImage大小、起始地址、结束地址、根据uImage烧写的结束地址,设置根文件系统的起始地址(即使uImage的结束地址)

2. 通过串口打印我知道我的uImage烧写成功的地址在0xlde0000地址处,我在这里偷懒了,我在u-boot里面直接给kernel分配了32M的空间,如下图所示:

JZ2440开发板nand flash出现坏块的解决办法_第1张图片

3. 烧写经过修改的uboot,然后重新烧写kernel、根文件系统烧写然后进行重启,会打印出下面的错误信息,大概的意思

就是根文件系统在nand flash读取失败。

print_req_error: I/O error, dev mtdblock4, sector 0
FAT-fs (mtdblock4): unable to read boot sector
VFS: Cannot open root device "mtdblock4" or unknown-block(31,4): error -5
Please append a correct "root=" boot option; here are the available partitions:
0100           65536 ram0
 (driver?)
0101           65536 ram1
 (driver?)
0102           65536 ram2
 (driver?)
0103           65536 ram3
 (driver?)
0104           65536 ram4
 (driver?)
0105           65536 ram5
 (driver?)
0106           65536 ram6
 (driver?)
0107           65536 ram7
 (driver?)
0108           65536 ram8
 (driver?)
0109           65536 ram9
 (driver?)
010a           65536 ram10
 (driver?)
010b           65536 ram11
 (driver?)
010c           65536 ram12
 (driver?)
010d           65536 ram13
 (driver?)
010e           65536 ram14
 (driver?)
010f           65536 ram15
 (driver?)
1f00             256 mtdblock0
 (driver?)
1f01             128 mtdblock1
 (driver?)
1f02             128 mtdblock2
 (driver?)
1f03            4096 mtdblock3
 (driver?)
1f04          257536 mtdblock4
 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,4)
CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.0-rc3 #1
Hardware name: SMDK2440
[] (unwind_backtrace) from [] (show_stack+0x10/0x18)
[] (show_stack) from [] (dump_stack+0x18/0x24)
[] (dump_stack) from [] (panic+0xc0/0x25c)
[] (panic) from [] (mount_block_root+0x1b4/0x2ac)
[] (mount_block_root) from [] (mount_root+0x114/0x158)
[] (mount_root) from [] (prepare_namespace+0x160/0x1b8)
[] (prepare_namespace) from [] (kernel_init_freeable+0x180/0x1cc)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xf8)
[] (kernel_init) from [] (ret_from_fork+0x14/0x34)
Exception stack(0xc3833fb0 to 0xc3833ff8)
3fa0:                                     00000000 00000000 00000000 00000000
3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,4) ]---
random: crng init done

了解uboot、kernel、根文件系统它们之间的关系可以知道,uboot负责启动kernel,根文件系统的启动是kernel负责的,所以我们需要修改kernel,所以在内核中需要修改各个部分分区的大小,打开linux-4.19-rc3/arch/arm/mach-s3c24xx/common-smdk.c文件,把kernel分区的大小由4M改为32M即可(分配的空间大小要和uboot里面大小和位置保持一致)

JZ2440开发板nand flash出现坏块的解决办法_第2张图片

kernel修改完成之后,重启启动发现kernel、根文件系统都可以正常启动了

JZ2440开发板nand flash出现坏块的解决办法_第3张图片

 

 

 

 

 

 


 

你可能感兴趣的:(学习工作中遇到的问题)