<var id="fnfpo"><source id="fnfpo"></source></var>
<rp id="fnfpo"></rp>

<em id="fnfpo"><object id="fnfpo"><input id="fnfpo"></input></object></em>
<em id="fnfpo"><acronym id="fnfpo"></acronym></em>
  • <th id="fnfpo"><track id="fnfpo"></track></th>
  • <progress id="fnfpo"><track id="fnfpo"></track></progress>
  • <tbody id="fnfpo"><pre id="fnfpo"></pre></tbody>

  • x
    x

    你不可不知的嵌入式內核

    發布時間:2013-12-10 10:53    發布者:edu118gct
    關鍵詞: 內核



    linux內核:

    1.linux內核目錄結構

    開發板的配置信息文件存放位置:
    linux-2.6.32.2/arch/arm/configs

    內核映像默認存放位置:
    linux-2.6.32.2/arch/arm/boot

    板級存放位置:
    linux-2.6.32.2/arch/arm/mach-s3c2440

    CPU平臺相關文件存放位置:
    linux-2.6.32.2/arch/arm/plat-s3c
    linux-2.6.32.2/arch/arm/plat-s3c34xx


    常用文件系統:
    cramfs,fat,nfs,ntfs,proc,sysfs[內存],yaffs,jffs2,ext2,ext3,ext4.



    2.linux裁剪方法

    1)修改交叉編譯器:打開頂層Makefie,搜索ARCH,CROSS_COMPILE,修改如下:
    183 ARCH        = arm
    184 # CROSS_COMPILE = arm-linux-
    185 CROSS_COMPILE      = arm-none-linux-gnueabi-

    2)配置,裁剪功能。

    a.參考相近的配置文件,在此基礎上進行修改。

      [root@dhua linux-2.6.32.2]# make help 把所有配置都列出來

      只列出包含2440的配置文件
      [root@dhua linux-2.6.32.2]# make help | grep 2440
      mini2440_defconfig       - Build for mini2440

    b.備份配置好的文件,把.config文件保存為config_back[這步的前提是你配置好過內核]
    [root@dhua linux-2.6.32.2]# cp .config config_back

    c.4種配置方法:
            (1)make config:詢問式的
            (2)make xconfig:窗口模式,比較適合使用鼠標的人使用
            (3)make menuconfig:終端中顯示菜單,比較適合熟悉鍵盤的人使用
            (4)直接使用vi編輯器/文本編輯器修改.config文件

    ===========================================================================================

    參考mini2440_defconfig,把mini2440_defconfig的配置文件覆蓋.config,

    [root@dhua linux-2.6.32.2]# make mini2440_defconfig
      HOSTLD  scripts/kconfig/conf
    #
    # configuration written to .config
    #
    [root@dhua linux-2.6.32.2]# make menuconfig

    改版本號:在General setup 后面的local.....里加


    system type--ARM system type選對
                    --s3c2440 machines--SMDK2440


    kernel features--Memory split選3G/1G
            選上EABI


    boot options--kernel execute-in-place for rom在u-boot那里的那一場串環境變量

    userspace binary for---kernel support for ELF binaries

    重點配置對象:
    device drivers---網卡支持:network device support--10 or 100--dm9000
                    ---character--ledl  beep
                    ---graphices support--LCD:幀緩沖設備--s3c2410 lcd   
                                            lcd select--
                    ---企鵝Bootup logo[console display d support--framebuffer console support]


            u盤usb support--usb mass storge support
    文件系統file system---network file system--

    語言native language support--簡體中文 NLS UTF-8選上

    ==============================================================================================

    make -j2

    然后在u-boot-1.3.4/tools/將mkimage拷到系統的bin目錄下或者交叉編譯器的目錄下去,

    然后:make uImage,編譯出uIamge內核鏡像

    3.linux內核映像制作


    4.添加菜單

    每一個目錄都有一個Kconfig和Makefile,Kconfig管理本層菜單,Makefile管理相應的c文件。

    有子菜單的選項使用menu作為關鍵字,如下:

    上層菜單包含下層菜單的Kconfig

    menu "Device Drivers"

    source "drivers/base/Kconfig"

    source "drivers/connector/Kconfig"


    一下是內部子菜單的書寫格式:

    menu "Generic Driver Options"        #菜單名

    #子菜單關鍵字是string ,表示菜單式輸文字的
    config UEVENT_HELPER_PATH        #菜單對于宏
            string "path to uevent helper"        #子菜單名
            depends on HOTPLUG                #依賴條件
            default "/sbin/hotplug"                #默認值
            help                                #幫組信息
              Path to uevent helper program forked by the kernel for
              every uevent.

    #子菜單關鍵字是bool ,表示這個選項只有選中和不選中兩中狀態。
    config DEVTMPFS
            bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
            depends on HOTPLUG && SHMEM && TMPFS
            help
              This creates a tmpfs filesystem, and mounts it at bootup
              and mounts it at /dev. The kernel driver core creates device
              nodes for all registered devices in that filesystem. All device
              nodes are owned by root and have the default mode of 0600.
              Userspace can add and delete the nodes as needed. This is
              intended to simplify bootup, and make it possible to delay
              the initial coldplug at bootup done by udev in userspace.
              It should also provide a simpler way for rescue systems
              to bring up a kernel with dynamic major/minor numbers.
              Meaningful symlinks, permissions and device ownership must
              still be handled by userspace.
              If unsure, say N here.

    #關鍵字是tristate,有3種選擇,分別是編譯進內核,編譯出模塊[M],不選中[]。
    config LEDS_S3C2440
            tristate "LED Support for S3C2440 GPIO LEDs"
            depends on   ARCH_S3C2410
            default y if ARCH_S3C2410
            help
              This option enables support for LEDs connected to GPIO lines
              on S3C2440 boards.


    -------------------------------------------------------------

    Kconfig和.config的關系:

    每選中一項會在.config文件中把生成一個宏名:CONFIG_加上Kconfig對應菜單宏名

    比如Kconfig有如下選項:

    config LEDS_S3C2440
            tristate "LED Support for S3C2440 GPIO LEDs"
            depends on   ARCH_S3C2410        #CONFIG_ARCH_S3C2410也是Kconfig中的一個菜單宏名,如果ARCH_S3C2410選中,這項菜單才會顯示出來,
            default y if ARCH_S3C2410        #顯示出來的默認狀態:y 顯示 * ;m 顯示 M ,n 顯示不選中
            help
              This option enables support for LEDs connected to GPIO lines
              on S3C2440 boards.

    選中時(*)后,對應.config的名字為:
    CONFIG_LEDS_S3C2440=y

    選中時(M)后,對應.config的名字為:
    CONFIG_LEDS_S3C2440=m

    不選中時,對應.config的名字為:
    #CONFIG_LEDS_S3C2440 is not set
    深圳專業嵌入式技術實訓,QQ754634522

    -----------------------------------------------------------

    .config和Makefie的關系:

    在driver/char/Makefie有以下語句:

    ############################################################################

    obj-$(CONFIG_LEDS_S3C2440)        += s3c2440_leds.o        #$為在后面累加字符串
    obj-$(CONFIG_S3C2440_BUTTONS)        += s3c2440_buttons.o
    obj-$(CONFIG_S3C2440_BUZZER)        += s3c2440_pwm.o
    obj-$(CONFIG_S3C2440_ADC)        += s3c2440_adc.o











    本文地址:http://www.portaltwn.com/thread-124438-1-1.html     【打印本頁】

    本站部分文章為轉載或網友發布,目的在于傳遞和分享信息,并不代表本網贊同其觀點和對其真實性負責;文章版權歸原作者及原出處所有,如涉及作品內容、版權和其它問題,我們將根據著作權人的要求,第一時間更正或刪除。
    上網去溜溜 發表于 2013-12-17 09:14:45
    漲姿勢了
    edu118gct 發表于 2013-12-30 14:28:29
    歡迎學習、交流
    您需要登錄后才可以發表評論 登錄 | 立即注冊

    廠商推薦

    • Microchip視頻專區
    • EtherCAT®和Microchip LAN925x從站控制器介紹培訓教程
    • MPLAB®模擬設計器——在線電源解決方案,加速設計
    • 讓您的模擬設計靈感,化為觸手可及的現實
    • 深度體驗Microchip自動輔助駕駛應用方案——2025巡展開啟報名!
    • 貿澤電子(Mouser)專區

    相關視頻

    關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
    電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
    快速回復 返回頂部 返回列表
    精品一区二区三区自拍图片区_国产成人亚洲精品_亚洲Va欧美va国产综合888_久久亚洲国产精品五月天婷