S3C2440 transplants the linux3.4.2 kernel to support the YAFFS file system

Publisher:EnchantedBreezeLatest update time:2022-11-17 Source: 知乎Keywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Obtain the yaffs2 source code and patch the kernel

First get the yaffs2 source code (refer to the detailed explanation of git command usage)


cd /work/nfs_root


git clone git@github.com:lifeyx/yaffs2.git

//If error:403 occurs during downloading, you can try vi /etc/resolv.conf and change the nameserver address to: 114.114.114.114

Configure the yaffs2 source code into the kernel (make the kernel support yaffs2)


vi /work/nfs_root/yaffs2/README-linux

Refer to the picture above:

/*Patch the kernel*/

cd /work/nfs_root/yaffs2/

./patch-ker.sh cm /work/system/linux-3.4.2//c: copy the yffs2 folder to linux-3.4.2/fs, m: specify multiple versions



/*Enable the kernel to support yaffs2 through menuconfig*/

cd /work/system/linux-3.4.2/

make menuconfig

Search for yaffs and find it located at:


-> File systems

      -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y])

             <*> yaffs2 file system support //Press the Y key to enable the kernel to support yaffs2


Compile kernel make uImage


As shown in the figure below, many errors occur:

As shown in the picture above, the problem all occurs under fs/yaffs2/. Many errors report that the called member name is not defined in the struct mtd_info structure.



Modify yaffs2 source code


Next, we add the fs/yaffs2 folder to the si project of kernel 3.4. Then enter yaffs2/yaffs_vfs.c, line 1958: (yaffs_vfs.c is displayed under Linux, and vi can open yaffs_vfs.c. But in yaffs_vfs.c is not found in the si project, so copy yaffs_vfs.c from ubuntu and add it to si).



However, it was found that the structure mtd_info of struct mtd_info *mtd defines the _sync member, as shown in the following figure:

So if you encounter errors related to struct mtd_info, add them in front of the members: _



For example: Change mtd->sync in line 2514~2515 of the yaffs_vfs.c file to: mtd->_sync Change mtd->erase in line 2702 of the yaffs_vfs.c file to: mtd->_erase Change line 2703 of the yaffs_vfs.c file Change mtd->read to: mtd->_read ... ... and change root = d_alloc_root(inode); in line 2967 of yaffs_vfs.c to: root = d_make_root(inode);

After all modifications, upload yaffs_vfs.c to ubuntu, make uImage again, and the error is as follows



The kernel does not define d_alloc_root



Let's search s_root in the kernel to see how other file systems are used.



After all modifications, upload yaffs_vfs.c to ubuntu, make uImage again, and the error is as follows



I guess it's because of the missing underline.

After modification, recompile and report the same error. yaffs_mtdif1.c is not found in the SI project. Copy it from ubuntu and add it to the si project. The functions in each file in the error message above must be underlined.



Compilation error

Copy the yaffs_mtdif2.c file on ubuntu to the local if si project, continue the underscore in the above file



Finally compiled successfully



copy


cp arch/arm/boot/uIamge /work/nfs_root/uImage_yaffs


Since in the previous chapter, we created a file system named fs_mini_mdev_new, we directly used the mkyaffs2image tool to create it:


mkyaffs2image fs_mini_mdev_new fs_mini_mdev_new.yaffs2


Then we used uboot to burn yaffs2 and uImage and found that it was not successful. We used the alternative method to find the problem. There may be a problem with UBOOT: replaced it with 1.1.6 UBOOT. The file system started successfully and found that there was no problem with 1.1.6 UBOOT, so it was us. The transplanted new UBOOT has BUG:


driversmtdnandNand_util.c
if (!need_skip && !(flags & WITH_DROP_FFS)) {


Change to


if (!need_skip && !(flags & WITH_DROP_FFS) && !(flags & WITH_YAFFS_OOB)) {


Finally, yaffs2 was started successfully:


Keywords:S3C2440 Reference address:S3C2440 transplants the linux3.4.2 kernel to support the YAFFS file system

Previous article:DATASHEET register packaging trap--S3C2440 as an example
Next article:Introduction and simple modification of the kernel framework for S3C2440 transplantation of linux3.4.2 kernel

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号