Recently, I have been learning to transplant the kernel to the TQ2440 board, porting the driver. I really feel that this knowledge has a lot of difficulty. But from another point of view, the greater the difficulty, the greater the ability to enhance the space!!
1. Extracting Source code
To download a Linux kernel from the Internet, I use Linux-2.6.20.4. Then unzip it with a command. It is recommended to unzip to the "/home/User name" directory. My kernel source is stored in:
2. Add support for Arm
Because the TQ2440 Development Board is used, it belongs to the ARM9. Therefore, support for ARM is added to the system.
Method: Enter the kernel source directory,
Modify the "Makefile" file to 193 lines of "ARCH?" = (Subarch) "With 194 lines" Cross_compile? = "Modify it to ()
You can also use make Arch=arm cross_compile=arm-linux-menuconfig in place of the first time you use "Make Menuconfig". Remember one time to forget to modify the support arm, the results in the configuration of the time a lot of options are not, the first thought is the kernel reason, and then re-download the kernel, the result is the same. Stupid mistake!!! Post it and stimulate yourself!
Pre-Modified Configuration menu:
The Modified Configuration menu:
3, cross-compiler environment construction 4, clock frequency modification
TQ2440 is using an external clock source of 12MHz, and the corresponding configuration file is 16.9344MHz, open the following file:
Modify the following function:
5, modify the machine code
The machine code set in the Uboot used by TQ2440 is 168, so the kernel needs to change the machine code, otherwise it will not start. This parameter is stored in the kernel source "Arch/arm/tools/mach-tupes". When the first kernel is compiled, the kernel can be successfully downloaded to the Development Board, but it cannot be started. At first it was thought that the kernel was compiling too much, and after cutting a lot of things, it was still impossible to start. After a teammate prompted "whether to change the machine code", I am also very confident that "has been changed", to the last look at the file, machine code wood has changed AH ~~~~~~~~~~~
6. Nand Flash Drive porting
Enter the kernel source "arch/arm/plat-s3c24xx/common-smdk.c", modify the following two location code (modified)
Such as:
(1)
(2)
Then open
Modify the code for line No. 752:
7. Add support for Yaffs
You can get Yaffs's source code by command: Git clone git://www.alcphl.co.uk/yaffs2
Then go to the YAFFS2 directory, patch to the kernel, and use the following command:
./patch-ker.sh c m/home/xg/linux_arm/linux-2.6.30.4/(the directory where the kernel resides)