从
s3c2410_recover\lib
?或 /usr/local/arm/3.4.1/arm-linux/lib
?或/opt/eldk/arm/lib copy 过来,再裁减lib 库
?目录 proc
?------->空着但必须有这目录
?4.2.etc/下文件内容修改
?4.2.1 etc/rc.d/rc.sysinit
?这里你还可以按自己的要求修改
?4.2.2 etc/rc.d/rc.local
?以后要启动的程序你可以加在这里
?=============================================================
?#!/bin/sh
?#
?# This script will be executed *after* all the other init scripts.
?# You can put your own initialization stuff in here if you don‘t
?# want to do the full Sys V style init stuff.
?#touch /var/lock/subsys/local
?=======================================
?4.2.3 etc/inittab
?init启动后会首先执行这个文件
?===========================================================?#
?# inittab       This file describes how the INIT process should set up
?#               the system in a certain run-level.
?# Default runlevel. The runlevels used by RHS are:
?#   0 - halt (Do NOT set initdefault to this)
?#   1 - Single user mode
?#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
?#   3 - Full multiuser mode
?#   4 - unused
?#   5 - X11
?#   6 - reboot (Do NOT set initdefault to this)
?#
【1】文件系统
 挂载文件系统
  mount  -t     vfat                               /dev/mmcblk1p1    /mnt
  挂载         指定需要挂载的文件系统的类型       设备节点(文件)  挂载点(文件系统挂载到rootfs的地方)  
【2】内核调试
 1)点灯是用 GPIO 作为输出,观察程序运行阶段和状态的方法 
 2)printk
   内核解压后
   信息输出显示是在 console 初始化之后
   printascii
   console初始化前
   printk打印级别:数字越低,级别越高   
- 
#define KERN_EMERG        "<0>"   /* system is unusable           */ 
- 
 #define   LERT            "<1>” /* action must be taken immediately */ 
- 
 #define KERN_CKERN_ARIT             "<2>"   /* critical conditions          */ 
- 
 #define KERN_ERR              "<3>"   /* error conditions         */ 
- 
 #define KERN_WARNING  "<4>"   /* warning conditions           */ 
- 
 #define   KERN_NOTICE          "<5>"   /* normal but significant condition */ 
- 
 #define KERN_INFO            "<6>"   /* informational            */ 
- 
 #define KERN_DEBUG        "<7>"   /* debug-level messages 
   ubuntu系统:   
   通过proc在运行时查看和修改日志级别
   cat /proc/sys/kernel/printk
    4 4 1 7
    echo “7 4 1 7” >/proc/sys/kernel/printk
    cat /proc/sys/kernel/printk
    7 4 1 7
 3)OOPS
    pc寄存器保存内核崩溃时,运行的地址
                                                       定位                  系统崩溃时的地址
linux@ubuntu:~/work/day_2/linux-3.14-fs4412$ arm-none-linux-gnueabi-addr2line 0xc0278e1c       
-e vmlinux               -f
指定定位镜像文件     指定出错的文件以及行号 
    dm9000_probe
    /home/linux/work/day_2/linux-3.14-fs4412/drivers/net/ethernet/davicom/dm9000.c:1414
 
4)调试信息
  调试信息一般显示在两个地方 :终端、log日志
 
  klogd进程:执行系统调用,去访问内核的打印消息
  syslog进程:记录非内核打印的消息
 
 
  void openlog(const char *ident, int option, int facility);
  功能:打开日志
  参数:ident  日志的标志
        option     LOG_PID        Include PID with each message.  打印的消息附加上进程ID
                       LOG_CONS       Write directly to system console if there is an error while sending to system logger.
                                                  把消息显示到log日志
        facility   表示的是消息出自于什么类型的进程
        LOG_DAEMON     system daemons without separate facility value
        void syslog(int priority, const char *format, ...);
        功能:将消息显示到日志中
        参数:priority  级别
                         LOG_WARNING    warning conditio
                         LOG_NOTICE     normal, but significant, condition
                         LOG_INFO       informational message
                         LOG_DEBUG      debug-level message
  void closelog(void);
  功能:关闭日志 
  查看日志消息: var/log/syslog日志 
【3】文件系统
 文件系统:文件存储的格式
 文件系统的类型:
 磁盘文件系统:驻留在磁盘上的文件系统
 FAT16、FAT32、NTFS、EXT2、EXT3、EXT4 
 网络文件系统:可以远程访问的文件系统
 nfs(network filesystem)
 内存文件系统:存在内存上的文件系统
 tmpfs
 只读文件系统:
 cramfs 
 根文件系统(root  filesystem)是存放运行、维护系统所必须的各种工具软件、库文件、脚本、
            配置文件和其他特殊文件的地方,也可以安装各种软件包。
 根文件系统是内核运行之后,加载的第一个文件系统,是其他文件系统的根,可用来挂载其他类型的文件系统,也可视其为特殊的文件系统
 必须存在,不存在内核无法运行  
 文件系统的目录结构:
        /etc  存放内核所需要的配置文件(启动文件)
====================================================================
        /bin: 普通用户和root用户都能执行的基本程序
               ping, mknod, mount, tar, grep, gzip, etc
        /sbin: root用户能执行的基本程序
               int, insmod, route, mkfs, rmmod, ifconfig
   ====================================================================
        /usr/bin: 更多非必须的用户程序
               autorun, bibtex, latex, biff, ftp, wc, whereis, whoami
        /usr/sbin: 更多非必须的root工具程序
               automount, httpd, in.telnetd, in.talkd, sendmail
        ====================================================================
        /proc  挂载proc文件系统,记录进程的信息
/sys   挂载sysfs文件系统,记录内核所需的特殊文件,设备,总线等信息
/mnt   临时挂载点,挂载其他文件系统使用
/tmp   临时挂载点,挂载其他文件系统使用
====================================================================
        /dev   设备节点(文件)
【4】根文件系统的制作
 1)make
    生成bin sbin usr/bin usr/sbin linuxrc
 2)mkdir  dev  etc  mnt  proc  var  tmp  sys  root 
 3)/etc
    inittab  fstab  init.d/rcS  profile 
inittab   
 |
 |
fstab
 |
 |
init.d ---- rcS
 |
 |
profile 
    1)initab  内核在加载rootfs的时候,解析该文件
- 
 ::sysinit:/etc/init.d/rcS   文件系统中运行第一个脚本 
- 
 :askfirst:-/bin/sh          指定脚本的类型 
- 
 ::restart:/sbin/init        文件系统运行的第一个进程(sbin/init) init=/linuxrc 守护进程 
- 
 开启当前的shell环境,服务其他进程,打开其他进程 
- 
 ::ctrlaltdel:/sbin/reboot   reboot系统重启 
2)init.d/rcS
- 
 #!/bin/sh 
- 
 # This is the first script called by init process 
- 
 /bin/mount  -a             执行挂载,与之匹配的是fstab中设置好的挂载点 
- 
 echo  /sbin/mdev  >  /proc/sys/kernel/hotplug        生效热插拔机制 
- 
 /sbin/mdev  -s 
3)fstab  设置不同的文件系统的挂载点
      #device     mount-point   type     options         dump     fsck order
      proc      /proc       proc     defaults     0     0
      tmpfs /tmp       tmpfs     defaults         0           0
      sysfs     /sys         sysfs     defaults         0           0
      tmpfs   /dev       tmpfs     defaults         0           0
    4)申明库文件,以及进程的路径
     export HOSTNAME=farsight
     export USER=root
     PATH=/bin:/sbin:/usr/bin:/usr/sbin
     LD_LIBRARY_PATH=/lib:/usr/lib:$LD_LIBRARY_PATH