Linux内核移植简记

 
***************************************************************
Linux:2.6.30.4
编译器:4.3.3
硬件平台:S3C2440
***************************************************************
        1.下载Linux内核
                 ftp://ftp.kernel.org/pub/linux/kernel/  ------>V2.6(文件夹)------>linux-2.6.30.4.tar.gz 或者(linux-2.6.30.4.tar.bz2)
        2.解压Linux内核
                tar -zxvf  linux-2.6.30.4.tar.gz -C   /目录
                或者 tar xvfj  linux-2.6.30.4.tar.bz2   -C  /目录
        3.添加对arm的支持
                修改解压后linux源码包中的Makefile文件,(约193行) 修改为:
                ARCH    = arm
                CROSS_COMPILE     = arm-linux-
        4.修改arm的运行时钟(个人觉得不改可能会影响与时钟参数有关设备,如串口等)
                修改 arch/arm/mach-s3c2440/mach-smdk2440.c 文件中第163行  修改为:
                s3c24xx_init_clocks(12000000);     (原始值为:16934400)
        5.修改系统配置
                make menuconfig  弹出配置菜单项(需要启动编译器支持功能:source  /etc/profile   (需先配置profile文件))
                5.1  选择“Load an Alternate Configuration File”---> Enter
                       .config---修改为--->arch/arm/configs/s3c2410_defconfig   (添加s3c2440 的默认配置) --->退出到主菜单           
                5.2 选择“System Type”--->
                        S3C2440 Machines--->配置如下
                            [ ]Simtec Electronic ANUBIS
                            [ ]Simtec IM2440D20(OSIRIS)module
                            [ ]HP iPAQ rx3715
                            [*]SMDK 2440
                            [ ]NexVision NEXCODER 2440 Light Board
                            [*]SMDK2440 With S3C2440 CPU Module
                            [ ]Avantech AT2440EVB development Board
                5.3 选择“General Setup”--->配置如下
                        (-EmbedSky)Local version -append to kernel release(天嵌出的驱动模块在加载时会校验该信息)
                        (17)kernel log buffer size
                5.4 选择“Kernel Feature”--->配置如下(编译器是4.3.3的版本需要添加,低版本不需添加配置)
                        [*]USE the ARM EABI to Compile the kernel
                        [*]Allow old ABI binaries to run with this kern(EXPERIMENTAL)(NEW)
                        [ ]Add LRU List to track non-evictable pages
                5.5 选择“Device Drivers”--->配置如下    (修改NandFlash配置,其他驱动先不管)
                        <*> Memory Technology Device(MTD)Support------>
                                   < >RedBoot partition table parsing
                                    [ ]Command line partition table parsing
                                    <*>NAND Device Support ------>
                                                [ ]S3C2440 NAND Hardware ECC (有的资料建议选择该项,这里先不先Flash校验)
                5.6 选择“Save an Alternate Configuration File”------>
                         保存为 .config文件,保存后退出。
        6.修改机器码
                修改arch/arm/tools/mach-types文件中的第379行,修改后如下(将原始值362修改为168)
                S3C2440  ARCH_S3C2440 S3C2440 168
                注:这里需要将机器码修改和U-boot中的机器码一样,也可将U-boot中修改和这里的一样
        7.修改Flash配置
                修改 arch/arm/plat-s3c24xx/common-smdk.c  (约109行)
                static struct mtd-patition smdk_default_nand_part[ ]={
                        [0] = {   .name = "U-Boot",
                                    .size = 0x00040000,
                                    .offset = 0, }
                        [1] = {   .name = "Kernel",
                                    .size = 0x00300000,
                                    .offset = 0x00200000, }
                        [2] = {   .name = "yaffs2",
                                    .size = MTDPART_SIZ_FULL,    //默认是剩余空间
                                    .offset = 0x00500000, }
                         }        //注:空间分配也可自己定义   [3]\[4]\[5]\[6]\[7]几项可以删除
                修改 NandFlash操作时间,时间可以自己设定(这项可以不改)  (约165行)
        8.修改软件中的NandFlash校验设置
                修改 drivers/mtd/nand/s3c2410.c   (约 752行)  修改为
                chip-ecc.mode = NAND_ECC_NONE;        //原始值 NAND_ECC_SOFT;
        9.编译内核
                make zImage
                之后会在arch/arm/boot目录下面生成 zImage
                到此可以编译支持S3C2440处理器的基本内核(不带驱动,不支持yaffs2文件系统)。
---------------------------------------------------------------------------------------------------------------------------------
        以下是添加Linux对yaffs2文件系统的支持功能
        1.下载yaffs2补丁包
                下载 CVS-root.tar.gz------>解压  tar xvfz cvs-root.tar.gz--->进入解压后的文件,进入到 yaffs2 文件夹下执行
                ./patch-ker.sh c /linux安装目录下面
                执行后在Linux的fs目录下发现多了yaffs2目录,同时fs下面的Kconfig和Makefile文件中添加了对yaffs2的支持
        2.配置Linux对文件系统的支持
                make menuconfig
                File System---> 配置如下
                        < >second Extended fs support 
                        < >Ext3 journalling file system support
                        < >Kernel automounter support
                        < >Kernel automounter version (aslo supports V3)
                        < >FUSE (Filesystem in Userspace) support
                                CD-ROM/DVD Filesystem------>
                                        [ ] Microsoft Joliet CDROM extensions
                                        < >UDF file system support
                                DOS/FAT/NT Filesystems------>
                                        < >NTFS file system support
                                Pseudo filesystems------>
                                        [ ]Tmpfs POSIX Access Control Lists
                                        <*>Userspace-driven configuration filesystem
                        <*> Miscellaneous filesystems------>
                                <*> YAFFS2 file system support(NEM)
                                [ ]Cache short names in RAM (NEW)
                        -*- Native Language support
                                <*> Simplified Chinese charset (CP936,GB2312)
                                <*>NLS UTF-8
            保存设置  “Save an Alternate Configuration File”------>保存为 .config 文件
            make zImage
            即可生成支持 YAFFS2文件系统的Linux内核了!

你可能感兴趣的:(Linux系统,开发环境搭建)