×
单片机 > 单片机程序设计 > 详情

S3C-2416 kernel (linux-2.6.35-rc3)编译过程

发布时间:2020-06-06 发布时间:
|

一、        编译错误更改

1.      linux-2.6.35-rc3\arch\arm\mach-s3c2416\kconfig中增加:

 config MACH_SMDK2416

        bool "SMDK2416"

        select CPU_S3C2416

        select S3C_DEV_FB

        select S3C_DEV_NAND  #add by ltls

        select S3C_DEV_USB_HOST  #add by ltls

        select S3C_DEV_SMDK #add by ltls

        select S3C_DEV_HSMMC

        select S3C_DEV_HSMMC1

        help

    Say Y here if you are using an SMDK2416

目的:linux-2.6.35-rc3\arch\arm\mach-s3c2416\makefile 文件:

    obj-$(CONFIG_S3C_DEV_USB_HOST)  += dev-usb.o

  等相应的宏打开

 

2. linux-2.6.35-rc3\arch\arm\plat-s3c24xx\kconfig中增加:

 

config MACH_SMDK

                bool

                default y #add by ltls

                help

              Common machine code for SMDK2410 and SMDK2440

目的:开linux-2.6.35-rc3\arch\arm\plat-s3c24xx\makefile 文件:CONFIG_MACH_SMDK宏打开

obj-$(CONFIG_MACH_SMDK)       += common-smdk.o   

              这个是使针对makefile 文件红控制做相应的更改的:

二、        kernel启动问题

 

1.      内核机器码arch/arm/tools/mach-types 文件中smdk2416 为1685

Uboot 中 borad/Samsung/smdk2416/smdk2416.c中

gd->bd->bi_arch_number = MACH_TYPE;

uboot中也可以通过命令 bdinfo 查找arch_number = 0x00000695 (1685)

这两个要一致

 

 

 

2.      uImage的制作:

a.更改linux-2.6.35-rc3/ 下的makefile文件:

export KBUILD_BUILDHOST := $(SUBARCH)

#ARCH      ?= arm                       #delete by ltls

#CROSS_COMPILE ?= arm-linux-        #delete by ltls

ARCH       = arm                        #add by ltls

CROSS_COMPILE  =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-         #add by ltls 

          b. #cp config_mini2440_a70  .config

c. #make menuconfig  进入界面

d.#make zImage

e.#cd   arch/arm/boot

f. # mkimage –A  arm –O linux –T kerenel –C none –a 0x30008000 –e 30008000 –n linux-2.6.35 –d zImage uImage

注释:

mkimage 命令在uboot生成的/tools 下面有mkimage文件拷到bin文件下就ok; 0x30008000 这个很关键。

 

3.      启动uImage 出错 ,当地在为c0008000 改为32000000则正常。

Eg:

Tftp  0x32000000 uImage

Bootm 0x32000000 

make menuconfig
Kernel hacking --->
[*] Kernel debugging
[*] Kernel low-level debugging functions
[*] Kernel low-level debugging messages via S3C UART

 

4.      nfs启动 dm9000驱动出错:

a.      Looking up port of RPC 100003/2 on 192.168.1.90

------------[ cut here ]------------

WARNING: at net/sched/sch_generic.c:258 dev_watchdog+0x270/0x294()

NETDEV WATCHDOG: eth0 (dm9000): transmit queue 0 timed out

Modules linked in:

                 B. dm9000 Ethernet Driver, V1.31

dm9000 dm9000: eth2090025647: Invalid ethernet

MAC address. Please set using ifconfig

eth0: dm9000a at c480c300,c4810304 IRQ 48

     MAC: 00:00:00:00:00:00 (chip)

 

解决:在dm9000.C文件

memcpy(ndev->dev_addr, "\x08\x90\x90\x90\x90\x90", 6);// add ltls for dm9000

    if (!is_valid_ether_addr(ndev->dev_addr))

    dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please "

             "set using ifconfig\n", ndev->name);

5.      增加dm9000:

//---start---add by ltls for dm9000 ----------------------------

//---author:fj_ltls

//---date:2001.6.18

//------start--------------------------------------------

/* DM9000AEP 10/100 ethernet controller */

 

static struct  resource  smdk2416_dm9k_resource [ ] = {

  [0] = {

       .start = MACH_smdk2416_DM9K_BASE,

       .end   = MACH_smdk2416_DM9K_BASE + 3,

       .flags = IORESOURCE_MEM

  },

  [1] = {

       .start = MACH_smdk2416_DM9K_BASE + 4,

       .end   = MACH_smdk2416_DM9K_BASE + 7,

       .flags = IORESOURCE_MEM

  },

  [2] = {

       .start = IRQ_EINT4,//ltls  Port :GPF4  EINT4

       .end   = IRQ_EINT4,//ltls

       .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,

  }

};

 

/*

 * The DM9000 has no eeprom, and it's MAC address is set by

 * the bootloader before starting the kernel.

 */

static struct dm9000_plat_data smdk2416_dm9k_pdata = {

  .flags        = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),

};

 

static struct platform_device smdk2416_device_eth = {

  .name         = "dm9000",

  .id      = -1,

  .num_resources     = ARRAY_SIZE(smdk2416_dm9k_resource),

  .resource = smdk2416_dm9k_resource,

  .dev     = {

       .platform_data     = &smdk2416_dm9k_pdata,

  },

};

 

//---end---add by ltls for dm9000 --------------------------------------

 

6.      增加nand  mtdpart:

 

A.arch/arm/mach-2416/s3c2416.c文件中:

               void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)

{

              s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);

              s3c_device_nand.name = "s3c2416-nand";这个与下面面的要对应更改为“s3c2440-nand”

}

 

B.Driver/mtd/nand/s3c2410.c文件中:

static struct platform_device_id s3c24xx_driver_ids[] = {

  {

       .name         = "s3c2410-nand",

       .driver_data  = TYPE_S3C2410,

  }, {

       .name         = "s3c2440-nand",

       .driver_data  = TYPE_S3C2440,

  }, {

       .name         = "s3c2412-nand",

       .driver_data  = TYPE_S3C2412,

  }, {

       .name         = "s3c6400-nand",

       .driver_data  = TYPE_S3C2412, /* compatible with 2412 */

  },

  { }

};

         

            C.arch/arm/plat-s3c24xx/common-smdk.c文件中:nandflash的分区:

 

              static struct mtd_partition smdk_default_nand_part[] = {

     [0] = {

         .name    = "Boot Agent",

         .size    = SZ_16K,

         .offset  = 0,

     },

     [1] = {

         .name    = "S3C2410 flash partition 1",

         .offset = 0,

         .size    = SZ_2M,

     },

     [2] = {

         .name    = "S3C2410 flash partition 2",

         .offset = SZ_4M,

         .size    = SZ_4M,

     },

     [3] = {

         .name    = "S3C2410 flash partition 3",

         .offset  = SZ_8M,

         .size    = SZ_2M,

     },

     [4] = {

         .name    = "S3C2410 flash partition 4",

         .offset = SZ_1M * 10,

         .size    = SZ_4M,

     },

     [5] = {

         .name    = "S3C2410 flash partition 5",

         .offset  = SZ_1M * 14,

         .size    = SZ_1M * 10,

     },

     [6] = {

         .name    = "S3C2410 flash partition 6",

         .offset  = SZ_1M * 24,

         .size    = SZ_1M * 24,

     },

     [7] = {

         .name    = "S3C2410 flash partition 7",

         .offset = SZ_1M * 48,

         .size    = SZ_16M,

     }

};

7.增加 kernel 文件系统yaffs2:

 

A.linux-2.6.35-rc3\fs\增加yaffs2文件夹从2.6.32 拷贝

B.linux-2.6.35-rc3\fs\kconfig:增加

       # Patched by YAFFS

source "fs/yaffs2/Kconfig"

C. linux-2.6.35-rc3\fs\makfile增加:

obj-$(CONFIG_MINIX_FS)       += minix/

obj-$(CONFIG_YAFFS_FS)       += yaffs2/

obj-$(CONFIG_FAT_FS)     += fat/

D.nand write.yaffs c0008000 6a0000 3b22c00 其中3b22c00 要为2048+64=2112的倍数

 

  否出错:

Input block length is not page aligned

Data did not fit into device, due to bad blocks

 127270912 bytes written: ERROR

 

 

8、kernel 启动停止

  Uncompressing Linux...................... done, booting the kernel.

 

1、  在配置中进入Kernel hacking 打开Kernel debugging和Kernel low-level debugging functions 还有Kernel low-level debugging messages via S3C UARTKernel hacking -> Kernel low-level debugging functions 和  Kernel hacking -> Kernel low-level debugging via EmbeddedICE DCC channel 也是打开的 保存后再编译 运行

2、   

在Device Drivers->Character devices->Serial drivers中选择加载Samsung SoC serial support , 选成静态编译之后又会出现Support for console on Samsung SoC serial port ,也选上。

 

 

 

三、   root (根文件)

1. 制作 cramfs文件系统:

mkcramfs  root_qitoal  l.cramfs                                         

Nand write c0008000 6a0000 $(filezise)   烧写

四、   驱动的更改:

1. lcd驱动更改:

drivers\video\kconfig  文件

增加红色部分

config FB_S3C2410_DEBUG

     bool "S3C2410 lcd debug messages"

     depends on FB_S3C2410

     help

       Turn on debugging messages. Note that you can set/unset at run time

       through sysfs

 

choice

     prompt "LCD select"

     depends on FB_S3C2410

     help

        S3C24x0 LCD size select

 

config FB_S3C2410_T240320

     boolean "3.5 inch 240X320 Toppoly LCD"

     depends on FB_S3C2410

     help

       3.5 inch 240X320 Toppoly LCD

 

config FB_S3C2410_N240320

     boolean "3.5 inch 240X320 NEC LCD"

     depends on FB_S3C2410

     help

        3.5 inch 240x320 NEC LCD

 

config FB_S3C2410_TFT640480

     boolean "8 inch 640X480 L80 LCD"

     depends on FB_S3C2410

     help

        8 inch 640X480 LCD

 

config FB_S3C2410_TFT800480

     boolean "7 inch 800x480 TFT LCD"

     depends on FB_S3C2410

     help

        7 inch 800x480 TFT LCD

 

config FB_S3C2410_VGA1024768

     boolean "VGA 1024x768"

     depends on FB_S3C2410

     help

        VGA 1024x768

 

endchoice

 

config BACKLIGHT_MINI2440

2.linux-2.6.35-rc3\arch\arm\mach-s3c2416\mach-s3c2416.c

    增加红色部分:申请资源

  static struct platform_device *smdk2416_devices[] __initdata = {

         &s3c_device_fb,

         &s3c_device_wdt,

         &s3c_device_ohci,

         &s3c_device_i2c0,

         &s3c_device_hsmmc0,

         &s3c_device_hsmmc1,

         &s3c_device_rtc, //add by ltls

         &s3c_device_lcd,

 

         &smdk2416_device_eth,//add by ltls for dm9000

         //&s3c_device_nand,

};

3.linux-2.6.35-rc3\arch\arm\plat-s3c24xx\devs.c

   

/* LCD Controller */

 

static struct resource s3c_lcd_resource[] = {

    [0] = {

        .start = S3C24XX_PA_LCD,

        .end   = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,

        .flags = IORESOURCE_MEM,

    },

    [1] = {

        .start = IRQ_S3C2443_LCD3,//IRQ_LCD,ltls

        .end   = IRQ_S3C2443_LCD3,//IRQ_LCD,ltls

        .flags = IORESOURCE_IRQ,

    }

 

};

 由于:中断替换不成功  :

linux-2.6.35-rc3\arch\arm\mach-s3c2416\irq.c

 

static int __init s3c2416_irq_add(struct sys_device *sysdev)

{

    printk(KERN_INFO "S3C2416: IRQ Support\n");

 

    s3c2416_add_sub(IRQ_LCD, s3c2416_irq_demux_lcd, &s3c2416_irq_lcd,

            IRQ_S3C2443_LCD2, IRQ_S3C2443_LCD4);

   

      printk("IRQ_LCD=%d,IRQ_S3C2443_LCD2=%d\n",IRQ_LCD,IRQ_S3C2443_LCD3);//ltls

     //==================================================\\  

     //======           中断替换不成功                       ===========\\

     //======结果:IRQ_LCD=32, IRQ_S3C2443_LCD3=86   ===========\\

     //================================================\\

4.S3c_fb.c

   linux-2.6.35-rc3\drivers\video\kconfig

 

 config FB_S3C

    tristate "Samsung S3C framebuffer support"

    depends on FB && ARCH_S3C64XX //改为depends on FB

    select FB_CFB_FILLRECT

    select FB_CFB_COPYAREA

    select FB_CFB_IMAGEBLIT





『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
AVR单片机中RC电容触摸的感应原理解析