移植Linux4.14.1到JZ2440

声明

驱动目前只支持Nandflash和串口。

 

1. 准备材料

  • 开发主机:Ubuntu18.04 64位
  • Linux内核:4.14.1(下载
  • u-boot,dnw:来自韦东山
  • 交叉编译器:arm-linux-gnueabi(版本:5.4.1 20170404,下载
  • YAFFS2(下载
  • 文件系统:buildroot-2018.08.2

 

2. 编译YAFFS2

由于内核不支持YAFFS2(截至到目前,最新的内核5.5.13仍然不支持YAFFS2),所以只能自己打补丁:

$ ./patch-ker.sh c m "你/的/内/核/路/径"

编译YAFFS2文件系统制作工具mkyaffs2image:

$ cd utils/
$ make
$ sudo cp mkyaffs2image /usr/bin

 

3. 编译内核

3.1. 打上移植补丁

为什么我不用diff而用git diff?因为内核一旦编译过了就会生成一大堆编译文件,你make distclean都清不掉。如果用diff就会把这些东西也算进去,但git diff不会,因为它有.gitignore忽略掉那些文件。

$ git clone https://github.com/David-Croose/jz2440_on_linux4.x.git ~/patch
$ cd "你/的/内/核/目/录"
$ git apply  ~/patch/jz2440.patch    # 确保你的内核目录下是有git仓库的

3.2. 配置

$ make ARCH=arm jz2440_defconfig

3.3. 编译

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage

 

4. 编译文件系统

4.1. 配置

$ make ARCH=arm menuconfig

我暂时只做配置了以下这些:

4.2. 编译

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

4.3. 制作镜像

$ cd output/images/
$ mkdir yaffs2
$ tar -xf rootfs.tar -C yaffs2/
$ mkyaffs2image yaffs2/ jz2440_fs.yaffs2

4.4. 运行

然而,运行起来是这样的:

...
Creating 4 MTD partitions on "NAND":
0x000000000000-0x000000040000 : "bootloader"
0x000000040000-0x000000060000 : "params"
0x000000060000-0x000000260000 : "kernel"
0x000000260000-0x000010000000 : "root"
s3c24xx-nand s3c2440-nand: Tacls=2, 20ns Twrph0=6 60ns, Twrph1=2 20ns
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR Sharp protocol handler initialized
IR MCE Keyboard/mouse protocol handler initialized
IR XMP protocol handler initialized
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing unused kernel memory: 108K
This architecture does not have kernel memory protection.
Kernel panic - not syncing: Requested init /linuxrc failed (error -2).
CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.1-g4050d035-dirty #1
Hardware name: SMDK2440
[<c000ee1c>] (unwind_backtrace) from [<c000d49c>] (show_stack+0x10/0x14)
[<c000d49c>] (show_stack) from [<c0016e50>] (panic+0xb0/0x238)
[<c0016e50>] (panic) from [<c01ecb94>] (kernel_init+0x80/0xf0)
[<c01ecb94>] (kernel_init) from [<c000a428>] (ret_from_fork+0x14/0x2c)
---[ end Kernel panic - not syncing: Requested init /linuxrc failed (error -2).

然后我又试了下韦东山编译好的YAFFS2文件系统,也不行,自己用BUSYBOX源码编译,也不行。

原因未知,但是解决办法是:

  • 文件系统使用韦东山的arm-linux-gcc-4.3.2.tar.bz2编译器编译;
  • 文件系统镜像使用韦东山的mkyaffs2image制作;

另外,我的"Use the ARM EABI to compile the kernel"是勾上的,"Allow old ABI"勾不勾都不影响

 

其他

有时烧录文件系统会产生很多坏块,这些坏块用u-boot的f命令也消不掉,这时可以用我的这个程序把它们全都干掉。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值