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:
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications