linux內(nèi)核: 1.linux內(nèi)核目錄結(jié)構(gòu) 開發(fā)板的配置信息文件存放位置: linux-2.6.32.2/arch/arm/configs 內(nèi)核映像默認(rèn)存放位置: linux-2.6.32.2/arch/arm/boot 板級(jí)存放位置: linux-2.6.32.2/arch/arm/mach-s3c2440 CPU平臺(tái)相關(guān)文件存放位置: linux-2.6.32.2/arch/arm/plat-s3c linux-2.6.32.2/arch/arm/plat-s3c34xx 常用文件系統(tǒng): cramfs,fat,nfs,ntfs,proc,sysfs[內(nèi)存],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.參考相近的配置文件,在此基礎(chǔ)上進(jìn)行修改。 [root@dhua linux-2.6.32.2]# make help 把所有配置都列出來(lái) 只列出包含2440的配置文件 [root@dhua linux-2.6.32.2]# make help | grep 2440 mini2440_defconfig - Build for mini2440 b.備份配置好的文件,把.config文件保存為config_back[這步的前提是你配置好過(guò)內(nèi)核] [root@dhua linux-2.6.32.2]# cp .config config_back c.4種配置方法: (1)make config:詢問(wèn)式的 (2)make xconfig:窗口模式,比較適合使用鼠標(biāo)的人使用 (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 改版本號(hào):在General setup 后面的local.....里加 system type--ARM system type選對(duì) --s3c2440 machines--SMDK2440 kernel features--Memory split選3G/1G 選上EABI boot options--kernel execute-in-place for rom在u-boot那里的那一場(chǎng)串環(huán)境變量 userspace binary for---kernel support for ELF binaries 重點(diǎn)配置對(duì)象: device drivers---網(wǎng)卡支持:network device support--10 or 100--dm9000 ---character--ledl beep ---graphices support--LCD:幀緩沖設(shè)備--s3c2410 lcd lcd select-- ---企鵝Bootup logo[console display d support--framebuffer console support] u盤usb support--usb mass storge support 文件系統(tǒng)file system---network file system-- 語(yǔ)言native language support--簡(jiǎn)體中文 NLS UTF-8選上 ============================================================================================== make -j2 然后在u-boot-1.3.4/tools/將mkimage拷到系統(tǒng)的bin目錄下或者交叉編譯器的目錄下去, 然后:make uImage,編譯出uIamge內(nèi)核鏡像 3.linux內(nèi)核映像制作 4.添加菜單 每一個(gè)目錄都有一個(gè)Kconfig和Makefile,Kconfig管理本層菜單,Makefile管理相應(yīng)的c文件。 有子菜單的選項(xiàng)使用menu作為關(guān)鍵字,如下: 上層菜單包含下層菜單的Kconfig menu "Device Drivers" source "drivers/base/Kconfig" source "drivers/connector/Kconfig" 一下是內(nèi)部子菜單的書寫格式: menu "Generic Driver Options" #菜單名 #子菜單關(guān)鍵字是string ,表示菜單式輸文字的 config UEVENT_HELPER_PATH #菜單對(duì)于宏 string "path to uevent helper" #子菜單名 depends on HOTPLUG #依賴條件 default "/sbin/hotplug" #默認(rèn)值 help #幫組信息 Path to uevent helper program forked by the kernel for every uevent. #子菜單關(guān)鍵字是bool ,表示這個(gè)選項(xiàng)只有選中和不選中兩中狀態(tài)。 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. #關(guān)鍵字是tristate,有3種選擇,分別是編譯進(jìn)內(nèi)核,編譯出模塊[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的關(guān)系: 每選中一項(xiàng)會(huì)在.config文件中把生成一個(gè)宏名:CONFIG_加上Kconfig對(duì)應(yīng)菜單宏名 比如Kconfig有如下選項(xiàng): config LEDS_S3C2440 tristate "LED Support for S3C2440 GPIO LEDs" depends on ARCH_S3C2410 #CONFIG_ARCH_S3C2410也是Kconfig中的一個(gè)菜單宏名,如果ARCH_S3C2410選中,這項(xiàng)菜單才會(huì)顯示出來(lái), default y if ARCH_S3C2410 #顯示出來(lái)的默認(rèn)狀態(tài):y 顯示 * ;m 顯示 M ,n 顯示不選中 help This option enables support for LEDs connected to GPIO lines on S3C2440 boards. 選中時(shí)(*)后,對(duì)應(yīng).config的名字為: CONFIG_LEDS_S3C2440=y 選中時(shí)(M)后,對(duì)應(yīng).config的名字為: CONFIG_LEDS_S3C2440=m 不選中時(shí),對(duì)應(yīng).config的名字為: #CONFIG_LEDS_S3C2440 is not set 深圳專業(yè)嵌入式技術(shù)實(shí)訓(xùn),QQ754634522 ----------------------------------------------------------- .config和Makefie的關(guān)系: 在driver/char/Makefie有以下語(yǔ)句: ############################################################################ 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 |