Linux 2.6.32 porting on the arm9-s3c2440 platform-subject length (1)

Source: Internet
Author: User

 

The friendly mini2440 is used on the board. At first, according to the instruction manual provided by the CD, the pictures are as follows ..... the reason is that you have not understood the relationship between makefile and kconfig in each layer directory, the options in the kernel configure menu tree, and the meaning of the nand_flash device struct ,~ So ~

In the http://www.kernel.org/download 2.6.32 source code. The compiler uses arm-Linux-GCC 4.1.2.

 

1

The location where the machine code is defined in the kernel code/uboot code, in/root/linux-2.6.32/ARCH/ARM/tools/Mach-types and uboot/include/ASM-arm/mach_type.h, during startup, bootloader transmits the machine code to the kernel. if the machine code passed by bootloader to the kernel does not match ,,,,,

 

 

2

(1)Modify the crystal earthquake frequency in the _ init smdk2440_map_io function of/linux-2.6.32/ARCH/ARM/mach-s3c2440/mach-smdk2440.c:

Static void _ init smdk2440_map_io (void) <br/>{< br/> s3c24xx_init_io (smdk2440_iodesc, array_size (milliseconds); <br/> s3c24xx_init_clocks (12000000 ); <br/> s3c24xx_init_uarts (smdk2440_uartcfgs, array_size (smdk2440_uartcfgs); <br/>}< br/>

 

(2)Locate the machine_star macro definition and modify the machine code (not modified)

Machine_start (S3C2440, "smdk2440") // change to "mini2440" <br/>/* maintainer: Ben dooks <ben@fluff.org> */<br/>. phys_io = s3c2410_pa_uart, <br/>. io_pg_offst = (u32) s3c24xx_va_uart)> 18) & 0 xfffc, <br/>. boot_params = maid + 0x100, <br/>. init_irq = s3c24xx_init_irq, <br/>. map_io = smdk2440_map_io, <br/>. init_machine = smdk2440_machine_init, <br/>. timer = & s3c24xx_timer, <br/> machine_end <br/>

 

 

(3 )Which option does this mach-smdk2440.c file correspond to in make menuconfig?

Find the makefile: obj-$ (config_arch_s3c2440) + = mach-smdk2440.o for this directory to find the kconfig: config arch_s3c2440 bool "smdk2440" # This is the character displayed in configure: Select cpu_s3c2440 select s3c2440_xtal_16934400 select mach_smdk select initi_dev_usb_host select initi_dev_nand help

 

In the configure menu press/find, the connection condition of the mach-smdk2440.o is in system type-> S3C2440 machines-> smdk2440, If You Want To compile Part Of The mach-smdk2440.c code just modified into the image, you must select this option,

 

The code in the porting process is linked and changed to a specific one. to compile the code of the C file into the image, you must modify the makefile and kconfig file, and select this option in the configure menu tree.

 

 

3

Configuration Options: Run make s3c2410_defconfig and make menuconfig,

(1)The Make s3c2410_defconfig command will find the file named s3c2410_defconfig under the arch/% processor platform %/configs/, copy it to the top-level directory, and rename it. will the config, make s3c2410_defconfig command traverse all subdirectories under ARCH? No, because in the makefile at the top layer,

Arch? = Arm # specify sub-directories under Arch

Cross_compile? = Arm-Linux-# specify the called Compiler

 

(2)The subsequent make menuconfig will read the contents of the linux-2.6.32/. config and display it. The following is a description of more compilation commands:

Make mrproper --- clear all files, including. config and some backup files

Make clean --- clear the generated files, but keep. config and some module files.

Make config --- text-based most traditional configuration interface, which is not recommended

 

Make menuconfig --- text menu-based configuration interface, which is recommended for character Terminals

Make xconfig --- configuration interface based on the graphic window mode, which is recommended in XWindow

 

4

It mainly involves the following structs. In fact, these codes do not fully understand the role of the overall kernel. They are basically copied, so there will be subsequent image errors, such as the role of the struct array.

Static struct platform_device _ initdata * smdk_devs [] =,

Why do I need to register & amp; S _ device_nand in it ,? These are not clear, and they are also the cause of subsequent mistakes.


 

 

 

(1)Change the partition of the onboard NAND Flash, open the file: ARCH/ARM/plat-s3c24xx/common-smdk.c, and change:

Static struct mtd_partition smdk_default_nand_part [] ={< br/> [0] ={< br/>. name = "supervivi", <br/>. size = 0x00040000, <br/>. offset = 0, <br/>}, <br/> [1] = {<br/>. name = "Param", <br/>. offset = 0x00040000, <br/>. size = 0x00020000, <br/>}, <br/> [2] = {<br/>. name = "kernel", <br/>. offset = 0x00060000, <br/>. size = 0x00500000, <br/>}, <br/> [3] = {<br/>. name = "root", <br/>. offset = 0x00560000, <br/>. size = 1024*1024*1024, // <br/>}, <br/> [4] = {<br/>. name = "NAND", <br/>. offset = 0x00000000, <br/>. size = 1024*1024*1024, // <br/>}< br/>}; <br/>


(2)Register the system with the cloud_device_nand service. This is the same here. You do not need to modify this

Static struct platform_device _ initdata * smdk_devs [] ={< br/> & initi_device_nand, // <br/> & smdk_led4, <br/> & smdk_led5, <br/> & smdk_led6, <br/> & smdk_led7, <br/>}; // not changed

 

 

The structure involved in NAND Flash is summarized as follows:

 

Struct mtd_partition default_nand_part [] partition definition in single-chip Flash

Static struct s3c2410_nand_set smdk_nand_sets [] sets of all Flash files on the board

Static struct s3c2410_platform_nand smdk_nand_info

Static struct platform_device _ initdata * smdk_devs []

 

5
Modify Drivers/MTD/NAND/S3C2410. C,

Flash ECC verification is prohibited (this option is not available in friendly manuals). Note that this issue is removed from ECC verification and is not recommended in the kernel, this means that the detection of bad NAND Flash blocks is ignored. but ~ It is said that the ECC verification code generated by Vivi or uboot through the software algorithm is inconsistent with the ECC verification code generated by the S3C2410 NAND Flash Controller. Therefore, the kernel ECC verification is disabled here.
Find the static void s3c2410_nand_init_chip function, and add the following to the last line of the function body:
Chip-> ECC. mode = nand_ecc_none;

 

6 (not now)

Patch 2.6.32 with yaffs2,

Earlier yaffs only supported NAND Flash with small pages (512 byte/page). Most of the current development boards are equipped with larger volumes of NAND Flash, they are generally in the big page mode (2 k/page). With yaffs2, they can support the large page NAND Flash. the procedure is as follows,

(1)Get the yaffs2 code

Mkdir yaffs2-src

CD yaffs2-src

Git clone git: // www. aleph1.co. uk/yaffs2

(2)Download the latest source code of yaffs2 and install the following patches:

./Patch-ker.sh C/root/linux-2.6.32

Now the yaffs2 section in 2.6.32 code has been successfully updated, and a yaffs2 directory is added under the linux-2.6.32.2/fs

Return to/root/linux2.6.32, run make menuconfig, file systems-> miscellaneous-> select yaffs2.

 

 

7 (not now)

 

Added devfs for the 2.6 kernel, and devfs has been removed from linux2.6, to support devfs in the kernel and to automatically mount/dev to the devfs file system at startup and before/sbin/init is run (does the yaffs file system require devfs support ?)
In VI fs/kconfig, find menu "pseudo filesystems" and add the following:
Config devfs_fs # config ID
Bool "/dev File System Support (obsolete )"
Depends on experimental
Help

Config devfs_mount
Bool "automatically mount at Boot"
Depends on devfs_fs # dependent on the above devfs_fs
Help

Config devfs_debug
Bool "Debug devfs"
Depends on devfs_fs # dependent on the above devfs_fs
Help

Re-make menuconfig. In the file systems> pseudo filesystems directory, you can configure devfs as follows:

[*]/Proc file system support

[*]/Dev File System Support (obsolete)

[*] Automatically mount at boot

[*] Debug devfs

[*] Virtual memory file system support (former shm fs)

[] Relayfs File System Support

 

8

Modify the kernel startup option, make menuconfig,
Here the vast majority of options are first using the default settings, to be transplanted successfully after we further cut, the above (3) modified the common-smdk.c, in order to make the modification take effect, must be selected

Also, the boot options ---> default kernel command string: (Note ,)

Noinitrd root =/dev/mtdblock4 console = fig, 115200
That is, mtdblock3 is used to store the partition of the cramfs root file system. Therefore, setting root =/dev/mtdblock3. console = ttysac0 indicates that the information during the startup of the kernel is output to the serial port 1.


 

 

 

 

 

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.