• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Research transplanting method of embedded linux kernel based on arm platform
 

Research transplanting method of embedded linux kernel based on arm platform

on

  • 748 views

for more projects visit @ www.nanocdac.com

for more projects visit @ www.nanocdac.com

Statistics

Views

Total Views
748
Views on SlideShare
748
Embed Views
0

Actions

Likes
0
Downloads
13
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Research transplanting method of embedded linux kernel based on arm platform Research transplanting method of embedded linux kernel based on arm platform Document Transcript

    • Research transplanting method of embedded linux kernel based on ARM platformHU Jie ZHANG Gen-baoEE Dept.SUSTXi’an, China, 710021hujieyx@163.com zhanggb@sust.edu.cnAbstract—A novel transplanting method for embedded linuxkernel is presented in this work. Linux kernel as well as itscut,compile and porting process under ARM platform areintroduced.Transplantation of the operating system can bedivided into configuration, cutting the source code, crosscompiler and so on. The article gives a more detaileddescription of the above steps, including the concreterealization of cutting and the compilationprocess.Transplantation of linux kernel is the prerequisite andbasis for the development of embedded system,giving a greatsignificance for the development of embedded system.Keywords—ARM; Linux kernel; cross-compiler; transplantI. INTRODUCTIONWith the wide application of embedded systems inconsumer electronics, industrial control, aerospace,automotive electronics, health care, network communicationsand other fields ,embedded system has been familiar topeople all walks of life, embedded systems have been intopeoples lives, it is changing peoples production andlifestyles in a variety of forms. Linux offers a very attractiveoption for embedded operating system, it is a Unix-like andcore-based, full memory protection, multitasking, multi-process operating system. It can support a wide range ofcomputer hardware, including most of the existing chipssuch as X86, Alpha, Sparc, MIPS, PPC, ARM, NEC,MOTOROLA, etc. Linux source code of the program ispublic, anyone can cut the kernel according to their ownneeds to adapt its own system. The economic advantages ofopen-source Linux operating system ,which brings a widerange of applications increasingly. Linux operating systemcan support different devices and different configurations.Linux on the vendor not only independent, but also the costis very low, which is quickly becoming the operating systemfor a variety of devices. Embedded Linux is a general trend,and its huge market potential and business opportunities arebound to attract a large number of companies to enter thisfield.II. LINUX SYSTEMS AND LINUX KERNEL DESCRIPTIONA complete system consists of five components:hardware,bootloader, the operating system kernel, operating systemservices and user applications, as shown in Figure 1.User application refers to those word-processingprogram,internet applications, or other user-prepared in avariety of applications; Operating system services providedby the program is pointing to the user interface program suchas system calls;Bootloader mainly take charge of completingthe hardware detection and system boot. The operatingsystem kernel is the main core of the operating system,whichis the soul of the whole system. The operating system serviceprogram, the operating system kernel and Bootloader be seenas part of the operating system [1].Linux kernel mainly constituted by the five modules,namely: the process of scheduling module, memorymanagement module, the virtual file system module, inter-process communication module and network interfacemodules. Figure 2 illustrates an important part of Linuxkernel, as well as the relationships between them.Process scheduling module is responsible for controllingthe process for the use of CPU resources, using a schedulingstrategy to enable the process can be fair and reasonableaccess to the CPU, while ensuring the timely implementationof the core hardware operation; Memory managementmodule is used to ensure the safety of all processes share themachine main memory area. It also supports virtual memorymanagement, so that the process of Linux can use morememory than the actual memory capacity, and take use of thefile system for temporary data in memory to exchange to anexternal storage device, when needed and then exchangeback; The file system module used to support external drivesand storage devices; Inter-process communication moduleused to support the multi-way exchange of informationbetween processes; Network interface module providesaccess to a variety of network communication standards andsupport many network hardwares[2].Figure 1. Linux system components2010 International Conference of Information Science and Management Engineering978-0-7695-4132-7/10 $26.00 © 2010 IEEEDOI 10.1109/ISME.2010.19135
    • Linux is open source, and Linux operating system notonly were designed to have portability between differentplatforms, but also the required storage space is small. Linuxkernel is the most bottom and core part of the Linux, andLinux operating system grows up based on Linux kernel,while the transplantation of Linux core is the most criticalpart for the development of any embedded Linux. All thekernel source code can be found in the /usr/src/Linux,andmost application softwares are also designed to follow theGPL, while many of the Linux enthusiasts and the Linuxdevelopers around the world is a powerful technicalsupport[3].In the kernel of Linux2.6 mainly contains the followingdirectory:/arch: one of the subdirectories contains all the portingcode of kernel associated with the hardware architecture.Each directory represents a hardware platform, and eachplatform should include several parts like boot, kernel, lib,mm, mach-xxx and so on./documentation: one of the subdirectories contains manydetailed documents associated with the kernel./block: include block device drivers./drivers: one of the subdirectories that contains the kernelall the device drivers./fs: one of the subdirectories contains all the file systemcode./include: one of the subdirectories which contains theestablishment of kernel code required most of the libraryheader files, the module use other modules to rebuild thekernel. At the same time, also includes the needs of libraryfiles on different platforms./init: one of the subdirectories that contains the kernelinitialization code, and the kernel from this directory to work./ipc: one of the subdirectories that contains the kernelinter-process communication code./kernel: one of the subdirectories that contains the mainkernel code, such as process scheduling and so on./lib: one of the subdirectories contains the common codefor library functions./mm: one of the subdirectories that contains the kernelmemory management code./net: one of the subdirectories that contains the kernel ofthe network-related code./scripts: one of the subdirectories that contains a numberof script files to configure the kernel.Generally speaking, there is one depend file and onemakefile file in each directory. When compiling the files,these two documents are used for supporting documentation.Therefore, the focus of the work is to transplant the files inarch directory.III. AN OVERVIEW OF LINUX KERNEL TRANSPLANTATIONThe so-called Linux transplantation is to rewrite Linuxoperating system source code aimed at specific targetplatform,then install it to the target platform and make it runright. In the Linux transplantation process, it can be cut,modified source code and so on to enhance the real-timenature of the new system or reduce the size of the newsystem[4]. Different fields and different levels of users caneasily transform the kernel according to their applicationneeds, so it is of great significance in the embeddeddevelopment.The basic contents are: First of all,access to aversion of the Linux kernel source code, according to ourspecific target platform to make necessary rewrite to thesource code (mainly modify the relevant parts of thearchitecture), and then add some peripheral drivers, create anew operating system suitable for our target platform (whichFigure 2. Linux Kernel Architecture36
    • can be embedded portable device may also be otherarchitecture PC).As the development process, mostly in Intels x86 familyof general-purpose CPU on a computer, while the processorchip in the target environment, most of them are the ARM,MIPS, PowerPC, DragonBa series of microprocessors, whichrequires the establishment of a good cross - developmentenvironment for cross-compile and link, and then build akernel image file and finally through some means to load theimage file(installed) to our target platform[5].ARM company constantly made breakthroughs in thefield of development for 32-bit RISC (Reduced InstructionSet Computer) CPU, which structure has been developedfrom V3 to V6. ARM cores designed with significantadvantages such as low power consumption and low cost ,attained a large number of semiconductor manufacturerssupport. So far, ARM microprocessor and technologyapplication almost has been expanded in various fields,including industrial control, wireless communications,network applications, consumer electronics, imaging andsecurity products,32-bit SIM card of the mobile phone alsoused the ARM technology, which currently accounts formore than 75% of the 32-bit RISC embedded market,established market leadership in the field of embeddedapplications[6].Rewrite of the Linux source code is usually moredifficult, it requires you should be not only very familiarwith the Linux kernel structure, but also requires you shouldbe very familiar with the hardware architecture of the targetplatform, and proficient in assembly language, this part ofthe work is usually provided by the platform developer.In summary, Linux kernel transplantation is usuallydivided into the following steps:1) Download the Linux source code from the network andthe ARM platform patch;2) Patch the Linux source code in line with ARMs systemarchitecture;3) Linux configuration and tailoring;4) The establishment of cross-compiler environment;5) Cross - compile and link;6) Finally, through some means to load the imagefile(installed) to our target platform.IV. LINUX KERNEL CONFIGURATION AND TAILORINGTo the ARM website ftp://ftp.arm.linux.org.uk downloadthe Linux kernel and the patch on the ARM platform.Download to directory of Linux, /usr/src, generally the filename is Patch-xxx-rmkx.gz (eg: Patch-2.6.24.gz). To patchLinux2.6.24.gz: use the command zcat .. / patch-2.6.24.gz |patch-pl (.. / represents patch file was put in front of thekernel file level directory).There are several versions on Linux kernel configurationand tailoring menu command,run:1) make config: the most traditional text-basedconfiguration interface, enter the command line, you canconfigure the line by line, that it is hard to use and is verycumbersome;2) make menuconfig: text-based configuration menuinterface, is a common way under the character terminal;3) make xconfig: Window mode configuration based ona graphical interface, under the Xwindow recommended.These three commands, make xconfig interface is themost friendly, and if the machine can be used Xwindow,recommended to use this command, if you can not useXwindow, then you can use make menuconfig. Makemenuconfig interface, although nearly better than the above,better than make config interface. All the kernelconfiguration menu through Config.in via a different scriptinterpreter generated .config, the kernel configuration will becompleted in the current directory to generate a .configconfiguration file, of course, you can directly modify this fileto configure the kernel.Select the appropriate configuration, there are threeoptions that represent the following meaning:Y the function compiled into the kernel;N not compile the function into the kernel;M the function can be compiled into a moduledynamically inserted into the kernel when needed.In the shell command, enter the commands to configurethe kernel:cp arch/arm/configs /smdk2410_defconfig.config$ make menuconfigIn the configuration, the majority of options you can useits default values, only a small part of the need to chooseaccording to the different needs of the user. The principle ofchoice is the distant relationship with other parts of thekernel and does not frequently used functions of the codecompiled into a loadable module, to reduce the length of thekernel and the consumption of kernel memory, to simplifythe impact for the kernel when the corresponding changes inthe environment; unwanted function is not to choice, andclose to the kernel and frequently used part of the functioncode directly compiled into the kernel. Primarily thefollowing configurations:select the processor type, board-level support of the RAM disk, device drivers and filesystem support[7].Are:1) configuration MTD.<Y> Memory Technology Device (MTD) support<Y> Direct char device access to MTD devices<Y> Caching block device access to MTD devices<Y> SMC Device Support<M> Simple Block Device for Nand Flash (BONFS)<Y> SMC device on S3C2410 SMDK<Y> Use MTD From SMC2) configuration file system.<Y> Kernel automounter version 4 support<Y> DOS FAT fs support<Y> VFAT (Windows-95) fs support<Y> Yaffs filesystem on NAND<Y> Compressed ROM file system support<M> Simple RAM-based file system support<Y> proc file system support<Y> /dev file system support EXPERIMENTAL<Y> Automatically mount at boot37
    • <Y> NFS file system support3) configure the system type, mainly CPU type.<M> S3C2410 USB function support<Y> ARM920T CPU idle<Y> ARM920T I-Cache onV. ESTABLISH THE CROSS-COMPILER ENVIRONMENT ANDCOMPILE THE KERNELA. The establishment of cross-compiling environmentCompiler functions regardless of how powerful, but itsessence is the same, transforming a series of numbers andsymbols as the content of the high-level programminglanguage into machine language instruction set. The so-called cross-compilation is: the use of certain types ofmachines running on the compiler to compile a sourceprogram and generate object code run on anothermachine[8], shown in Figure 3:At present, the popular cross-development environmentis primarily an open and business types. An open cross-development environment is a typical representative of theGNU tool chain (Toolschain), now supports x86, ARM,MIPS, PowerPC and other processors. Cross-developmentenvironment for business mainly MetrowerksCodeWarrior,ARM Software Development Toolkit, SDSCross compiler,WindRiver Tornado, Microsoft Embedded Visual C++ andso on.Linux using the GNU tools, community developers havebeen compiled the common architecture of the crosscompiler tool chain. Cross-compiler tool chain generallyincludes arm-gcc, binutils (including AS assembler, LDlinker, etc.), glibc and so on. arm-Linux-gcc is a cross-compiler, arm-Linux-ld is a cross-linker. Glibc is the Clanguage library, they both run on the current system, alsocan generate the process documents on the objective system.The preparation of a good embedded software through thecross-compiling and cross-link, typically generates two typesof executable file: executable file for debugging and for thecuring of the executable file.B. cross-compilingOnce configured with the make command to compile thekernel, the kernel compilation is a very simple process.Implementation:1) # make cleanThis command is to compile your kernel in a formalenvironment, to clean up environment before compile ensurethat there is no reliance incorrect file exists.2) # make depDue to most of the files depend on a number of headerfiles in the kernel source tree, you should build dependenciesfor each subdirectory "depend" file generated in the kernelsource tree.3) # make zImageBuild a compressed Linux kernel image. Compilation iscompleted, the arch/arm/boot directory will generate ARMLinux kernel image file zImage, which is to be transplantedto the target machines kernel image file.4) # make modulesThis command is compiled as a module in theconfiguration options, that before the option is [M]. If youhave a choice in the kernel configuration options to compileas module, you need this command.If in the future would like to re-compile the kernel, youneed the command "makedistclean", remove the dependencyand remove previously compiled the documents produced,and then repeat the above steps.The kernel image is divided into a compressed kernelimage and uncompressed kernel image, the compressedkernel image is usually called zImage, located atarch/arm/boot directory. Without compressed kernel image isusually called vmLinux, located in the root directory ofsource tree. Download this image file to the developmentboard, the development board provides a more completecommon system peripherals, configure bootloader startupparameters can be up and running Linux2.6 of the kernel.VI. CONCLUSIONIn this paper,taking the Linux transplant to the S3C2410processor chips of ARM920T core for example, introducescutting the embedded Linux kernel, as well as the process oftransplantation, and gives a detailed description of keytechnologies and important step in transplant process. Aftertransplantation Linux system can stable run with goodperformance on the development of the board. This processof embedded Linux operating system in the other processorstransplant also has reference value.REFERENCES[1] Wei Zhong, Cai Yong, Lei Hongwei. Embedded Development XiangJie. Beijing: Electronic Industry Press, 2003.[2] Wu Guowei, Li Zhang, Ren Guangchen. Linux kernel analysis andhigh-level programming. Beijing: Electronic Industry Press, 2008,1.[3] Liu Zhengrong, Zhang Chichao. Embedded Linux applicationdevelopment xiang jie. Beijing: Mechanical Industry Press, 2004.[4] Zou qiu. “ARM2410-based embedded Linux kernel compiled withthe transplantation,”Computer Engineering Applied Technology,2008 (3): pp. 1157-1159.[5] Chen Lijun. In-depth understanding of Linux kernel. Beijing: ChinaElectric Power Press, 2001.[6] Sun Qiong. Embedded Linux application programme developmentxiang jie. Beijing: Peoples Posts & Telecom Press, 2006,7.[7] Ma Zhong-mei. Structures and application basis of ARM embeddedprocessors. eijing: Beijing University of Aeronautics and AstronauticsPress, 2002.[8] Zhang Xiaolin, Cui Yingwei. Embedded System Design and Practice.Beijing: Beijing University of Aeronautics and Astronautics Press,2006.[9] Joseph Praneich.The wonderful world of Linux2.6 kernel.IBMdeveloperWorks,http://www-128.ibm.com/developerworks/cn/linux.Figure 3. cross-compiler development model38