Linux/arm 3.0.8 Kernel Configuration(内核配置和编译简析)

主机:ubuntu 12.04发行版
目标机:smdkv210平台
交叉编译工具:arm-none-linux-gnueabi-gcc

一、解压内核
$ tar  xvf  linux-3.0.8.tar.gz
$ cd  linux-3.0.8

二、修改内核顶层目录下的Makefile
$ vim Makefile
修改:
ARCH             ?= $(SUBARCH)
CROSS_COMPILE ?=
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
为:
ARCH            = arm
CROSS_COMPILE      =arm-none-linux-gnueabi-

三、拷贝标准板配置文件
$ make    s5pv210_defconfig

四、 配置内核
$ make  menuconfig 
该命令执行时会弹出一个菜单,我们可以对内核进行详细的配置。这里我们先查看一下,内核都提供了那些功能!
    General setup  --->  //通用配置  
    [*] Enable loadable module support  --->  // 使能insmod
-*- Enable the block layer  --->  // 磁盘IO调度, 一般使用默认的
    System Type  --->   //选择特定的arm core /cpu 类型,以及它们的一下属性, make menuconfig之后应当确认一下该部分
    Bus support  ---> // 一些总线的支持,一般使用默认的
    Kernel Features  --->  //内核的特性,比如应用和内核空间的内存分布
    Boot options  ---> //启动选项, 内核启动过程当中,可以修改的特性
    CPU Power Management  ---> // cpu电源管理, 一般在用电池设备当中会要做选择
    Power management options  ---> // 外围设备的电源管理    suspend()  resum()
    Networking support  ---> // 网络的支持,基本上都是协议方面的,比如TCP/IP, 域套接字, 组播 , ppp协议
    Device Drivers  --->  // 设备驱动,包含两部分驱动: 控制器===设备的驱动, 经常光顾的选项
    File systems  ---> // 文件系统的支持,比如支持ntfs, ext4, nfs, cramfs, jiffs, minix..yaffs, ubifs,procfs,sysfs
选择时注意点
[*] < >  可以用空格去选择
()可以往里面填一些值,使用回车进入,比如 (arm-none-linux-gnueabi-) Cross-compiler tool prefix  

五、配置过程:
General setup  --->
      [*] Configure standard kernel features (for small systems)  ---> 
               //内核崩溃kernel panic, 会提示代码执行栈
System Type  --->
       ARM system type (Samsung S5PV210/S5PC110)  --->
      (0) S3C UART to use for low-level messages // 内核的调试信息需要由ttySAC0打印出来,这个要和bootargs中的console=xx保持一致
      S5PV210 Machines  --->//一般默认就会选上,只是我们查看配置文件选择的是否正确 

Kernel Features  --->   
     Memory split (3G/1G user/kernel split)  --->
     [*] Use the ARM EABI to compile the kernel //如果交叉工具链中出现了eabi,一定要选上
     [*]   Allow old ABI binaries to run with this kernel (EXPERIMENTAL) 
[ * ] Networking support  --->
     Networking options  ---> 
           <*> Packet sockets 
          <*> Unix domain sockets 
          [*] TCP/IP networking  <==========如果有网卡,一定要选上
          [*]   IP: multicasting  
          [*]   IP: kernel level autoconfiguration
              [*]     IP: BOOTP support
Device Drivers  ---> 
  <*> Memory Technology Device (MTD) support  --->  // 有nand,onenand等等设备,需要选择mtd
       <*>   Caching block device access to MTD devices // CONFIG_MTD_BLOCK
       [*]     Command line partition table parsing //uboot可以传递分区表
       <*>   NAND Device Support  --->  //nand设备支持, 具体的某个平台的nand控制器选项
       // 平台的nand, 比如S3C的nand
 [*] Network device support  --->  //需要有网卡
     [*]   Ethernet (10 or 100Mbit) (NEW)  ---> 
          <*>   DM9000 support
 [*] USB support  --->
      <*>   Support for Host-side USB  
      [*]     USB device filesystem (DEPRECATED) 
      [*]     USB device class-devices (DEPRECATED) (NEW) 
      <*>   USB Modem (CDC ACM) support // 3G配置
      <*>   USB Serial Converter support  ---> usb转串口
  Graphics support  ---> // 图形: lcd
       <*> Support for frame buffer devices  --->
        <*>   Samsung S3C framebuffer support
            Console display driver support --->

                 <*> Framebuffer Console support

      [*] Bootup logo  --->  // 启动的log,前提是LCD驱动OK了,log才能显示
    ?          编译内核
File systems  ---> 
 <*> Ext3 journalling file system support
 <*> The Extended 4 (ext4) filesystem  
 Pseudo filesystems  ---> // 虚拟文件系统: 在内存中管理文件,掉电之后,文件就不存在, 开机的时候临时创建
    // dev/, proc/, sys/几个目录中的文件都是临时
      [*] /proc file system support (NEW) 
      [*] sysfs file system support (NEW) 
      [*] Virtual memory file system support (former shm fs) 
      [*]   Tmpfs POSIX Access Control Lists 
  //Configure standard kernel features (for small systems)这个选项一定要选上
 [*] Miscellaneous filesystems  ---> //杂项文件系统, 对支持存放在nand中文件的管理方式
     <*>   Journalling Flash File System v2 (JFFS2) support
     [*]     JFFS2 write-buffering support 
  <*>   Compressed ROM file system support (cramfs)
  <*>   SquashFS 4.0 - Squashed file system support
 [*] Network File Systems (NEW)  ---> // 网络文件系统: nfs
      <*>   NFS client support 
     [*]     Root file system on NFS 
 <*> Native language support  ---> //内核支持的字符编码方式
   <*>   Codepage 437 (United States, Canada)
   <*>   Simplified Chinese charset (CP936, GB2312)
   <*>   ASCII (United States)  
   <*>   NLS ISO 8859-1  (Latin 1; Western European Languages) 
   <*>   NLS UTF-8

总结: 一般需要选择procfs , sysfs, tmpfs,  cramfs, jffs, squashfs, nfs

$ make  zImage -j2 
或者$ make uImage
通过上述操作我们能够在arch/arm/boot目录下生成一个zImage/uImage文件,这就是经过压缩的内核镜像。

六、将编译好的内核镜像zImage拷贝到/tftpboot
    cp arch/arm/boot/zImage /tftpboot/
发布了97 篇原创文章 · 获赞 135 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/weixin_37787043/article/details/79247335