Linux 2.6.32.2 kernel porting (mini2440) Steps

Source: Internet
Author: User

1. Get the source code for Kernel Transplantation

Http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.2.tar.bz2

2. decompress the kernel source code

(1).bzip2-d linux-2.6.32.2.tar.bz2

(22.16.tar-xvf linux-2.6.32.2.tar

3. Modify the Makefile in the directory

Original:

Export KBUILD_BUILDHOST: =$ (SUBARCH)
ARCH? = $ (SUBARCH)
CROSS_COMPILE? =

Change
Export KBUILD_BUILDHOST: =$ (SUBARCH)
ARCH? = Arm
CROSS_COMPILE? = Arm-linux-
Among them, ARCH specifies the target platform as arm, and CROSS_COMPILE specifies the cross compiler. Here the default cross compiler is specified. If you want to use other, write the full path of the compiler here.

4. Test whether linux compilation can pass

# Make s3c2410_defconfig; use the default Kernel configuration file. s3c2410_defconfig is the default configuration file of SMDK2440.
# Make; long Compilation Time

5. Clone and build your own platform

5.1 linux-2.6.32.2/arch/arm/mach-s3c2440 under the directory has a mach-mini2440.c file, it is actually foreign fans for mini2440 transplant added the main content, but we do not need, directly Delete.

5.2 copy the linux-2.6.32.2 under the mach-s3c2440/ARCH/ARM/mach-smdk2440.c/directory. Name it mach-mini2440.c, find machine_start (S3C2440, "smdk2440"), modify it
Machine_start (mini2440, "friendlyarm mini2440 Development Board ")

5.3 modify clock source frequency

Mach-mini2440.c (we just got through the reset mach-smdk2440.c) in the 160th line static void _ init smdk2440_map_io (void) function, change the 16934400 (representing the 16.9344 MHz crystal oscillator on the smdk2440 target board) to the 12000000 (representing the 12 MHz crystal oscillator on the mini2440 Development Board and the X2 component)

Because we want to make our own mini2440 platform system, so the mach-mini2440.c all smdk2440 words changed to mini2440, you can use the batch processing command to modify, in VIM command mode input:
% S/smdk2440/mini2440/g
In the above sentence, replace all the strings that match "smdk2440" with "mini2440", and the preceding "% s" indicates string matching, the final "G" represents global, which means global.
In addition, there is another need to be changed. In the mini2440_machine_init (void) function, comment out the call of the smdk_machine_init () function, because we will write our own initialization function later, you do not need to call the original smdk2440.

6. Run the command in the Linux source code root directory.
# Make mini2440_defconfig; Use the mini2440 configuration officially provided by Linux
# Make zimage; Compile the kernel for a long time. zimage will be generated at the end.
Re-compile and run the generated Kernel File zimage (in the arch/ARM/boot directory) to the board. We can see that the kernel can be started properly.

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.