Previous section S3C2440 transplant linux3.4.2 Modify the partition of the kernel and make the root file system We built the root file system , In this section, we modify kernel support yaffs2 file system

List of articles


transplant Linux3.4.2 Links to other articles :

S3C2440 transplant linux3.4.2 Introduction and simple modification of kernel framework

S3C2440 transplant linux3.4.2 Modify the partition of the kernel and make the root file system

S3C2440 transplant linux3.4.2 Kernel support YAFFS file system

S3C2440 transplant linux3.4.2 Kernel clipping of the kernel

obtain yaffs2 Source code and patch the kernel

First of all get yaffs2 Source code ( Reference resources git Command to use detailed )

cd /work/nfs_root
git clone [email protected]:lifeyx/yaffs2.git// If the download appears error:403, You can try vi /etc/resolv.conf, take nameserver The address is changed to : 114.114.114.114

take yaffs2 Source code to configure into the kernel ( Make the kernel support yaffs2)

vi /work/nfs_root/yaffs2/README-linux

 Insert picture description here
Refer to the above figure :

/* Patch the kernel */cd /work/nfs_root/yaffs2/./patch-ker.sh  c m /work/system/linux-3.4.2//c: take yffs2 Folder copy To linux-3.4.2/fs in , m: Specify multiple versions /* adopt menuconfig, Make the kernel support yaffs2*/cd /work/system/linux-3.4.2/make menuconfig

Search for yaffs, Found in the :

-> File systems      -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y]) <*>   yaffs2 file system support                      // Press Y key , Make the kernel support yaffs2

Compiling the kernel make uImage

As shown in the figure below , There are many mistakes :
 Insert picture description here
Pictured above , The problem is that fs/yaffs2/ Next , quite a lot error All about it : The member name of the call , stay struct mtd_info There's no definition in the structure .

modify yaffs2 Source code

Next we will fs/yaffs2 Add folder to kernel 3.4 Of si In Engineering .
Then enter yaffs2/yaffs_vfs.c, The first 1958 That's ok :
(linux What's shown below is yaffs_vfs.c,vi Can open yaffs_vfs.c. But in si Not found in the project yaffs_vfs.c, So from ubuntu A copy of yaffs_vfs.c Add to si in .)
 Insert picture description here

But it turns out that struct mtd_info *mtd The structure of the body mtd_info Definition is _sync member , As shown in the figure below :
 Insert picture description here
So the next step is to meet with struct mtd_info Relevant error, Add... Before the members : _

such as :
take yaffs_vfs.c file 2514~2515 Yes mtd->sync Change it to : mtd->_sync
take yaffs_vfs.c file 2702 Yes mtd->erase Change it to : mtd->_erase
take yaffs_vfs.c file 2703 Yes mtd->read Change it to : mtd->_read
… …
And will yaffs_vfs.c Of the 2967 Yes root = d_alloc_root(inode); Change it to : root = d_make_root(inode);
 Insert picture description here
After all the changes , take yaffs_vfs.c Upload to ubuntu, Again make uImage,
An error is as follows
 Insert picture description here

The kernel has no definition d_alloc_root
** Bold style **

We're in kernel search s_root See how other file systems work .
 Insert picture description here  Insert picture description here

After all the changes , take yaffs_vfs.c Upload to ubuntu, Again make uImage, An error is as follows
 Insert picture description here

I guess it's the lack of underscores
 Insert picture description here
Recompile after modification
Report errors
 Insert picture description here
Again , Not in the SI Found in the project yaffs_mtdif1.c, from ubuntu Copy it from the library , Add to si In Engineering .
The functions in each file that reported an error in the figure above should be underlined
 Insert picture description here

Compiler error
 Insert picture description here
hold ubuntu Upper yaffs_mtdif2.c Copy the file locally if si engineering , Continue the underline in the above file
 Insert picture description here

The final compilation is successful
 Insert picture description here

Copy

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

Because of the previous chapter - We made the file system , be known as fs_mini_mdev_new, So use it directly mkyaffs2image Tool making :

mkyaffs2image  fs_mini_mdev_new  fs_mini_mdev_new.yaffs2

And then through uboot To burn and write yaffs2、 burning uImage It didn't work , We use substitution to find problems
UBOOT There may be a problem : change 1.1.6 Of UBOOT, File system started successfully
Find out 1.1.6 Of UBOOT That's all right. , So that's the new one we transplanted UBOOT Yes BUG:

drivers\mtd\nand\Nand_util.cif (!need_skip && !(flags & WITH_DROP_FFS)) {

Change it to

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

Finally start yaffs2 success :
 Insert picture description here
Next section S3C2440 transplant linux3.4.2 Kernel clipping of the kernel We're going to crop the kernel .