Previous section S3C2440 transplant linux3.4.2 Introduction and simple modification of kernel framework We simply configured the kernel , This section continues to modify the kernel according to .

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

Boot kernel

The print information of kernel startup is shown in the figure below
 Insert picture description here

You can see that the kernel has 8 Zones , And ours uboot Only 4 Zones .

0x00000000-0x00040000 : "bootloader"            // Deposit uboot0x00040000-0x00060000 : "params"                // Store environment variables 0x00060000-0x00260000 : "kernel"                // Store the kernel 0x00260000-0x10000000 : "rootfs"                  // The file system 

So next, let's modify the kernel partition

Modify the kernel partition

stay si Search the image above for ”S3C2410 flash partition” Field , Found in the common-smdk.c in , There's an array in it smdk_default_nand_part[], The contents are shown below :
 Insert picture description here
modify smdk_default_nand_part[] Array ( be located arch/arm/mach-s3c24xx/common-smdk.c)
It is amended as follows :

static struct mtd_partition smdk_default_nand_part[] = { [0] = {   .name         = "bootloader",            //0x00000000-0x00040000     .size  = SZ_256K,                      
                   .offset         = 0, }, [1] = {   .name         = "params",                 //0x00040000-0x00060000   .offset = MTDPART_OFS_APPEND, 
                   .size  = SZ_128K, }, [2] = {   .name         = "kernel",                  //0x00060000-0x00260000   .offset = MTDPART_OFS_APPEND,   .size  = SZ_2M, }, [3] = {   .name         = "rootfs",                 //0x00260000-0x10000000   .offset         = MTDPART_OFS_APPEND,   .size  = MTDPART_SIZ_FULL, }};

The above part of the definition of macro , As shown below :
MTDPART_OFS_RETAIN: Fill in offset in , It means how much to keep in succession size The size
MTDPART_OFS_NXTBLK: Fill in offset in , Start with the next block
MTDPART_OFS_APPEND: Fill in offset in , Indicates that the location of the partition is attached to the address at the end of the previous partition
MTDPART_SIZ_FULL: Fill in size in , Represents the remaining memory size All belong to this division
If you need mini2440 Machine ID, It needs to be modified mini2440 Single board corresponding to mach-mini2440.c
Because the board's mtd The partition is not right either , The inside mini2440_default_nand_part[] Change the content to the same as above , Copy files to ubuntu Recompile and download the kernel
 Insert picture description here

burning yaffs2 file system

burning /work/nfs_root fs_mini_mdev.yaffs2 file system

nfs 30000000
nand erase.part rootfs
nand write.yaffs 30000000 260000  889bc0

Start the file system

set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=yaffs2 
nfs 32000000
bootm 32000000

 Insert picture description here
The printed information indicates that the kernel does not support yaffs file system , Then try to use ext3 ext2 cramfs vfat msdos iso9660 Wait to mount it

burning jffs2 file system

stay .config Mid search JFFS2, Find support for JFFS2 file system
 Insert picture description here
Download the file system

nfs 30000000
nand erase.part rootfs
nand write.jffs2 30000000 260000  $filesize
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2

After startup, as shown in the figure
 Insert picture description here
Express jffs2 Mounted , But I can't find init Program , Because this file system is glibc Libraries are cross compiling 3.4 Version of , because 3.4 The kernel cross compilation is 4.3 edition , So I don't support , And then we're going to remake the file system

Construct the root file system

Please refer to Build the root file system

install busybox

Compile and install first busybox( Refer to the previous busybox Installation section ) Get into download busybox 1.20.0tar -xjf busybox-1.20.0.tar.bz2
cd busybox-1.20.0make menuconfig          // Set the cross compile prefix to enter Busybox Settings --->Build Options --->() Cross Compiler prefix
Write... In the pop-up dialog box :arm-linux-

make          // compile mkdir   /work/nfs_root/fs_mini_mdev_new            // Create the file system directory to install       make install CONFIG_PREFIX=/work/nfs_root/fs_mini_mdev_new   // Specify the installation location 

After the installation, there are various directories
 Insert picture description here

install glibc library

Input $PATH Find the cross compiler at /work/tools/arm-linux-gcc-4.3.2/usr/local/arm/4.3.2 Location ,
adopt find -name lib, We found the following lib
 Insert picture description here
because ARM9 Belong to ARMv4T framework , So copy the third, the fourth lib To fs_mini_mdev_new in

mkdir /work/nfs_root/fs_mini_mdev_new/lib
mkdir /work/nfs_root/fs_mini_mdev_new/usr/lib -p  
cp arm-none-linux-gnueabi/libc/armv4t/usr/lib/*.so* /work/nfs_root/fs_mini_mdev_new/usr/lib -d           /* -d: Keep the link  */cp arm-none-linux-gnueabi/libc/armv4t/lib/*.so* /work/nfs_root/fs_mini_mdev_new/lib -d

structure etc Catalog

cp  The original etc  fs_mini_mdev_new  -rf

Construct other files / Catalog

1) Create a terminal file (dev/console and dev/null)

sudo mknod –m 660  dev/console c 5 1sudo mknod –m 660 dev/null c 1 3

2) Create other directories

mkdir mnt tmp root proc  sys root

Make jffs2 Image file

because mkfs.jffs2 The tool has been installed before , So use it directly mkfs.jffs2 command :

cd /work/nfs_root/                 // Go back to the previous Directory mkfs.jffs2 -n  -s 2048  -e 128KiB  -d fs_mini_mdev_new  -o fs_mini_mdev_new.jffs2//-n: Indicates that no clear mark is added to each block ,-s:NAND Each page of is 2k,-e: NAND Each piece of is 128kb//-d fs_mini_mdev_new: Represents the root file system file to make //-o fs_mini_mdev_new.jffs2: Represents the generated image file 

burning jffs2, Boot kernel

nfs 30000000
nand erase.part rootfs
nand write.jffs2 30000000 260000  $filesize
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2
nfs 32000000
bootm 32000000

Boot kernel
Print as shown in the figure below :
 Insert picture description here

To configure EABI

Get into si, Search for exitcode, find 0x00000004 The corresponding macro definition is SIGILL, It means illegal instruction , Because arm-linux-gcc-4.3.2 It is used. EABI Interface , The kernel is not configured , So it's illegal
Configure kernel support EABI
Input make menuconfig, Search for EABI, Found in the :

kernel feature->[*] Use the ARM EABI to compile the kernel         
make uImage

It's OK to recompile and burn the kernel .
Next section S3C2440 transplant linux3.4.2 Kernel support YAFFS file system We will modify kernel support yaffs file system .