Linux Kernel Porting Guide
一 Affected directories while porting Linux kernel
1. Documentation/
Documentation of the kernel – good place to find a lot of useful informations
2. arch/
Contains architecture specific code. Each supported architecture contains a sub
directory, ppc, arm etc. Each of this architecture subdirectory has four major
subdirectories of interest
o arch/arm/kernel/
Architecture specific kernel code.
arch/arm/kernel/head.S
Contains kernel entry, the entry point of the kernel. The file also
contains the exception handling of the kernel. The file sets up the
stack, clears BSS, loads MMU, and call the start_kernel() (located in
init/main.c), which is in fact the first C function the kernel executes.
arch/arm/kernel/setup.c
setup_arch() function in this file calls the board-specific setup
function. The command line string and memory start and memory end
are passed over to the caller of this function. The start and end
addresses for the linked-in ramdisk image are also updated here.
o arch/arm/mm
Architecture specific memory management code
o arch/arm/lib
Architecture specific library code, vsprintf and so on.
o arch/arm/mach-mx3/
Platform specific code. Most of the changes will be here when you do a
board level kernel porting.
arch/arm/mach-mx3/setup.c (also named with board name)
Contains the platform-specific setup function. The various chip selects
configuration, interrupts initialization, are done here.
arch/arm/mach-mx3/irq.c
Contains code to handle the platform specific interrupt controller.
3. drivers/
Contains device driver code. You might need to modify/add code here.
4. include/asm-arm
Include directory that contains architecture specific includes.
5. init/
Contains kernel initialization code. Can modify if there are any specific activities
to be done while initializing.
二 Porting procedure of Linux kernel
1. Create a directory for your target, (say my_arm11_board) under directory
arch/arm/.
This directory should contain the interrupt handling, timer, initialization, and
setup routines for your specific platform
2. Copy the files from the platform, which is closest to this new platform.
3. Create a directory (my_arm11_board) for your target under include/asm-
arm/ directory-
This directory will hold include files specific to your platform
4. Modify the files of the above mentioned directories to suit the target
5. Modify files in the directories mentioned above under section, directories of
interest, to custom scenarios.
6. Hook the new platform to the build system, by modifying the Config files and
the Makefiles under the arch/arm/ directory
7. Make defconfig (to select default configuration of the board)
8. Make
=================================================================
阅读(1066) | 评论(0) | 转发(0) |