Porting VIVI Based on S3C2410

Source: Internet
Author: User
HOST: ubuntu10.04lts, tool chain: Arm-Linux-GCC 2.95, installation directory:/usr/local/ARM/2.95.3/bin target board: edukit-III, description of the S3C2410 sub-board problem: Because the edukit-III experiment box of intime comes with Linux version 2.4, in view of the popularity of the Linux kernel, we want to port linux2.6.18 on edukit-III, before porting the Linux kernel, we should first port Vivi. After the transplantation, Vivi can start Linux in NAND Flash. Below we will record the porting process briefly. [1. obtain Vivi source code] As mizi was acquired by Wind River, the VIVI source code download link provided previously on the internet is invalid, and the VIVI Source Code cannot be found at the FTP download site, so this time we used the VIVI source code provided on the edukit-III experimental box for transplantation. [2. NAND Flash partitioning: In general, NAND Flash is divided into four zones, namely Vivi, Param, kernel, and root, respectively. vivi is the compiled Vivi binary file; param is the parameter passed to Linux kernel. kernel is the Linux kernel and root is the root file system. Generally, this file system is a read-only cramfs file system, which cannot be written, therefore, such a file system is not convenient to download applications to the Development Board. Therefore, we hope to add a jffs2 File System (the name of this partition is user) to the NAND Flash partition ), in this way, you can write your own applications to the jffs2 file system. In the end, NAND Flash is divided into five zones: Vivi, Param, kernel, root, and user. The starting addresses and sizes of these five zones in NAND Flash are shown in the following table.

Name

Offset

Size

Size

Vivi

0

Zero X 00020000 128 K
Param Zero X 00020000 Zero X 00010000 64 K
Kernel Zero X 00030000 0x002d0000 2 m + 832 K
Root Zero X 00300000 Zero X 00300000 3 m
User Zero X 00600000 0x00a00000 10 m
Note: edukit-III uses the NAND Flash type k9f5608u0 and Embest onlie flash programmer provided by edukit-III to enable the VIVI configuration document (S3C2410 & nandflash_vivi.cfg) during NAND flash writing ), as you can see, the NAND Flash has a total of 1025 sector, each of which is 16 K. Therefore, when planning the NAND Flash partition size, the partition size should be an integer multiple of 16 K. According to this partition plan, if the size of the created Linux kernel or file system is larger than that of the partition, you must adjust the partition and re-compile Vivi, you can also adjust the Linux kernel and file system to make it suitable for the partition size. The size of each partition is taken into consideration in this way. The size of each partition is usually 70 KB after VIVI is compiled. Therefore, the first Vivi partition is set to 128 kb, which is enough for vivi. Param is used to pass parameters to the Linux kernel, the 64 K size of this partition should be sufficient. The kernel partition is used to store the linux2.6.18 kernel, which is usually about 2 m after compilation. Therefore, the size of 2 m + 8 32 K is enough to store the linux2.6.18 kernel, root stores the cramfs file system. The cramfs file system is a high-compression file system. After the system is created, it generally takes about 2 MB. All the remaining partitions are allocated to the user's jffs2 file system. 3.vivien the source code (vivi-20030929.tar.bz2) is first extracted to the/usr/src directory.

root@VMUBUNTU:/usr/src# tar xjvf vivi-20030929.tar.bz2

Go to the VIVI source code directory.

root@VMUBUNTU:/usr/src# cd vivi
root@VMUBUNTU:/usr/src/vivi#

(1) modify the MAKEFILE file in this directory,

Change row 17th to linux_include_dir =/usr/local/ARM/2.95.3/include. This path is the include directory of the Cross-compilation tool chain.

Change row 25th to cross_compile =/usr/local/ARM/2.95.3/bin/ARM-Linux-. This path is the path of the Cross-compilation toolchain.

Change row 88th to arm_gcc_libs =/usr/local/ARM/2.95.3/lib/GCC-lib/ARM-Linux/2.95.3. The path is the directory where the library of the Cross-compilation toolchain is located. save and exit

(2) Modify ARCH/S3C2410/smdk. C and set the NAND Flash partition information. According to the partition planning of the NAND Flash in the table above, modify the following:

#ifdef CONFIG_S3C2410_NAND_BOOT
mtd_partition_t default_mtd_partitions[] = {
        {
                name: "vivi",
                offset: 0,
                size: 0x00020000,
                flag: 0
        }, {
                name: "param",
                offset: 0x00020000,
                size: 0x00010000,
                flag: 0
        }, {
                name: "kernel",
                offset: 0x00030000,
                size: 0x002d0000,
                flag: 0
        }, {
                name: "root",
                offset: 0x00300000,
                size: 0x00300000,
                flag: MF_BONFS
        },{
                name: "user",
                offset: 0x00600000,
                size: 0x00a00000,
                flag: MF_JFFS2
        }
};

Here flash indicates the partition identifier, which indicates the partition usage. You can see from source insight that these flags are defined in vivi/include/priv_data.h.

#define MF_LOCKED 0x00000001
#define MF_MUSTERASE 0x00000002
#define MF_BONFS 0x00000004
#define MF_JFFS2 0x00000008
#define MF_ISRAM 0x00000010

[4. Configure and compile and run Vivi]

After the migration is complete, execute the configuration and compilation Vivi command in the VIVI directory to generate the VIVI binary file.

root@VMUBUNTU:/usr/src/vivi#make distclean
root@VMUBUNTU:/usr/src/vivi#make menuconfig
root@VMUBUNTU:/usr/src/vivi#make

The Vivi binary file is generated in the VIVI directory and can be viewed using the LS command.

root@VMUBUNTU:/usr/src/vivi# ls
arch COPYING CVS Documentation drivers include init lib    Makefile Rules.make scripts test util vivi vivi-elf vivi.map

Open the Flash program Embest online flash programmer supporting euukit-III, first load the flash configuration document (S3C2410 & nandflash_vivi.cfg) for Vivi, and write Vivi to NAND Flash. Note: before writing, you must short the sw104 jumper of the S3C2410 sub-board. After the installation is complete, restart the development board. You can view the following startup information about Vivi on the Windows Super Terminal.

VIVI version 0.1.4 (root@VMUBUNTU) (gcc version 2.95.3 20010315 (release)) #0.1.
4 Sat Oct 23 15:33:59 CST 2010
MMU table base address = 0x33DFC000
Succeed memory mapping.
NAND device: Manufacture ID: 0xec, Chip ID: 0x75 (Samsung KM29U256T)
Could not found stored vivi parameters. Use default vivi parameters.
Press Return to start the LINUX now, any other key for vivi
type "help" for help.

At the VIVI prompt, enter the part show command. The flash partition information is as follows:

vivi> part show
mtdpart info. (5 partitions)
name offset size flag
------------------------------------------------
vivi : 0x00000000 0x00020000 0 128k
param : 0x00020000 0x00010000 0 64k
kernel : 0x00030000 0x002d0000 0 2M+832k
root : 0x00300000 0x00300000 4 3M
user : 0x00600000 0x00a00000 8 10M
vivi>

Indicates that VIVI is successfully transplanted. The next step is to port the Linux kernel 2.6.18. HOST: ubuntu10.04lts, tool chain: Arm-Linux-GCC 2.95, installation directory:/usr/local/ARM/2.95.3/bin target board: edukit-III, description of the S3C2410 sub-board problem: Because the edukit-III experiment box of intime comes with Linux version 2.4, in view of the popularity of the Linux kernel, we want to port linux2.6.18 on edukit-III, before porting the Linux kernel, we should first port Vivi. After the transplantation, Vivi can start Linux in NAND Flash. Below we will record the porting process briefly. [1. obtain Vivi source code] As mizi was acquired by Wind River, the VIVI source code download link provided previously on the internet is invalid, and the VIVI Source Code cannot be found at the FTP download site, so this time we used the VIVI source code provided on the edukit-III experimental box for transplantation. [2. NAND Flash partitioning: In general, NAND Flash is divided into four zones, namely Vivi, Param, kernel, and root, respectively. vivi is the compiled Vivi binary file; param is the parameter passed to Linux kernel. kernel is the Linux kernel and root is the root file system. Generally, this file system is a read-only cramfs file system, which cannot be written, therefore, such a file system is not convenient to download applications to the Development Board. Therefore, we hope to add a jffs2 File System (the name of this partition is user) to the NAND Flash partition ), in this way, you can write your own applications to the jffs2 file system. In the end, NAND Flash is divided into five zones: Vivi, Param, kernel, root, and user. The starting addresses and sizes of these five zones in NAND Flash are shown in the following table.

Name

Offset

Size

Size

Vivi

0

Zero X 00020000 128 K
Param Zero X 00020000 Zero X 00010000 64 K
Kernel Zero X 00030000 0x002d0000 2 m + 832 K
Root Zero X 00300000 Zero X 00300000 3 m
User Zero X 00600000 0x00a00000 10 m
Note: edukit-III uses the NAND Flash type k9f5608u0 and Embest onlie flash programmer provided by edukit-III to enable the VIVI configuration document (S3C2410 & nandflash_vivi.cfg) during NAND flash writing ), as you can see, the NAND Flash has a total of 1025 sector, each of which is 16 K. Therefore, when planning the NAND Flash partition size, the partition size should be an integer multiple of 16 K. According to this partition plan, if the size of the created Linux kernel or file system is larger than that of the partition, you must adjust the partition and re-compile Vivi, you can also adjust the Linux kernel and file system to make it suitable for the partition size. The size of each partition is taken into consideration in this way. The size of each partition is usually 70 KB after VIVI is compiled. Therefore, the first Vivi partition is set to 128 kb, which is enough for vivi. Param is used to pass parameters to the Linux kernel, the 64 K size of this partition should be sufficient. The kernel partition is used to store the linux2.6.18 kernel, which is usually about 2 m after compilation. Therefore, the size of 2 m + 8 32 K is enough to store the linux2.6.18 kernel, root stores the cramfs file system. The cramfs file system is a high-compression file system. After the system is created, it generally takes about 2 MB. All the remaining partitions are allocated to the user's jffs2 file system. 3.vivien the source code (vivi-20030929.tar.bz2) is first extracted to the/usr/src directory.

root@VMUBUNTU:/usr/src# tar xjvf vivi-20030929.tar.bz2

Go to the VIVI source code directory.

root@VMUBUNTU:/usr/src# cd vivi
root@VMUBUNTU:/usr/src/vivi#

(1) modify the MAKEFILE file in this directory,

Change row 17th to linux_include_dir =/usr/local/ARM/2.95.3/include. This path is the include directory of the Cross-compilation tool chain.

Change row 25th to cross_compile =/usr/local/ARM/2.95.3/bin/ARM-Linux-. This path is the path of the Cross-compilation toolchain.

Change row 88th to arm_gcc_libs =/usr/local/ARM/2.95.3/lib/GCC-lib/ARM-Linux/2.95.3. The path is the directory where the library of the Cross-compilation toolchain is located. save and exit

(2) Modify ARCH/S3C2410/smdk. C and set the NAND Flash partition information. According to the partition planning of the NAND Flash in the table above, modify the following:

#ifdef CONFIG_S3C2410_NAND_BOOT
mtd_partition_t default_mtd_partitions[] = {
        {
                name: "vivi",
                offset: 0,
                size: 0x00020000,
                flag: 0
        }, {
                name: "param",
                offset: 0x00020000,
                size: 0x00010000,
                flag: 0
        }, {
                name: "kernel",
                offset: 0x00030000,
                size: 0x002d0000,
                flag: 0
        }, {
                name: "root",
                offset: 0x00300000,
                size: 0x00300000,
                flag: MF_BONFS
        },{
                name: "user",
                offset: 0x00600000,
                size: 0x00a00000,
                flag: MF_JFFS2
        }
};

Here flash indicates the partition identifier, which indicates the partition usage. You can see from source insight that these flags are defined in vivi/include/priv_data.h.

#define MF_LOCKED 0x00000001
#define MF_MUSTERASE 0x00000002
#define MF_BONFS 0x00000004
#define MF_JFFS2 0x00000008
#define MF_ISRAM 0x00000010

[4. Configure and compile and run Vivi]

After the migration is complete, execute the configuration and compilation Vivi command in the VIVI directory to generate the VIVI binary file.

root@VMUBUNTU:/usr/src/vivi#make distclean
root@VMUBUNTU:/usr/src/vivi#make menuconfig
root@VMUBUNTU:/usr/src/vivi#make

The Vivi binary file is generated in the VIVI directory and can be viewed using the LS command.

root@VMUBUNTU:/usr/src/vivi# ls
arch COPYING CVS Documentation drivers include init lib    Makefile Rules.make scripts test util vivi vivi-elf vivi.map

Open the Flash program Embest online flash programmer supporting euukit-III, first load the flash configuration document (S3C2410 & nandflash_vivi.cfg) for Vivi, and write Vivi to NAND Flash. Note: before writing, you must short the sw104 jumper of the S3C2410 sub-board. After the installation is complete, restart the development board. You can view the following startup information about Vivi on the Windows Super Terminal.

VIVI version 0.1.4 (root@VMUBUNTU) (gcc version 2.95.3 20010315 (release)) #0.1.
4 Sat Oct 23 15:33:59 CST 2010
MMU table base address = 0x33DFC000
Succeed memory mapping.
NAND device: Manufacture ID: 0xec, Chip ID: 0x75 (Samsung KM29U256T)
Could not found stored vivi parameters. Use default vivi parameters.
Press Return to start the LINUX now, any other key for vivi
type "help" for help.

At the VIVI prompt, enter the part show command. The flash partition information is as follows:

vivi> part show
mtdpart info. (5 partitions)
name offset size flag
------------------------------------------------
vivi : 0x00000000 0x00020000 0 128k
param : 0x00020000 0x00010000 0 64k
kernel : 0x00030000 0x002d0000 0 2M+832k
root : 0x00300000 0x00300000 4 3M
user : 0x00600000 0x00a00000 8 10M
vivi>

Indicates that VIVI is successfully transplanted. The next step is to port the Linux kernel 2.6.18.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.