uclinux 编译心得六:根据make menuconfig trace信息分析的处理过程

$@--目标文件,$^--所有的依赖文件,$<--第一个依赖文件。
处理依赖文件时,从左到右依次处理
uClinuxdist:Makefile:77
menuconfig: mconf
config menuconfig qconfig gconfig xconfig: Kconfig conf
    //处理依赖文件Kconfig
    //Makefile:62: target 'Kconfig' does not exist
    Kconfig:
     @chmod u+x config/mkconfig
     config/mkconfig > Kconfig
   
    //处理依赖文件conf
    //config/Makefile.conf:10: target '/home/dx/uclinux/uClinux-dist/config/kconfig/conf' does not exist
    $(SCRIPTSDIR)/conf:
     $(SMAKE) -C $(SCRIPTSDIR) conf
      //CC=cc CXX=c++ make -C /home/dx/uclinux/uClinux-dist/config/kconfig conf 
      //make[1]: Entering directory '/home/dx/uclinux/uClinux-dist/config/kconfig'
      //make[1]: Leaving directory '/home/dx/uclinux/uClinux-dist/config/kconfig'
   //处理依赖文件mconf
   //config/Makefile.conf:16: target '/home/dx/uclinux/uClinux-dist/config/kconfig/mconf' does not exist
   $(SCRIPTSDIR)/mconf:
     $(SMAKE) -C $(SCRIPTSDIR) mconf
      //CC=cc CXX=c++ make -C /home/dx/uclinux/uClinux-dist/config/kconfig mconf       
      //make[1]: Entering directory '/home/dx/uclinux/uClinux-dist/config/kconfig'
      //make[1]: Leaving directory '/home/dx/uclinux/uClinux-dist/config/kconfig'
   //开始执行menuconfig规则的执行体第1条
   KCONFIG_NOTIMESTAMP=1 $(SCRIPTSDIR)/$(SCRIPTS_BINARY_$@) Kconfig
   //KCONFIG_NOTIMESTAMP=1 /home/dx/uclinux/uClinux-dist/config/kconfig/mconf Kconfig
   //继续执行第2条,因为已生成了.config,因此这个判断可通过
    if [ ! -f .config ]; then \
     echo; \
     echo "You have not saved your config, please re-run 'make menuconfig'"; \
     echo; \
     exit 1; \
     fi
    //继续执行第3条
    chmod u+x config/setconfig
    //继续执行第4条 
    config/setconfig defaults
        fix_conf_files 
        在setconfig脚本里236,要执行make -C config VENDOR="$VENDOR" PRODUCT="$PRODUCT" autoconf
        //make[1]: Entering directory '/home/dx/uclinux/uClinux-dist/config'
        //autoconf: ../vendors/Kconfig ../lib/Kconfig.auto ../user/Kconfig.auto   automake
        //automake: ../lib/Makefile.auto ../user/Makefile.auto 
       
            处理autoconf的第1个依赖文件
            Makefile:35: update target '../vendors/Kconfig' due to: Makefile force
                  ../vendors/Kconfig: Makefile
                   echo "# autogenerated, do not EDIT" > ../vendors/Kconfig; \
                    . ../.config; \  这一步的执行,主要是将config中的设置导入环境变量,以便下一步的处理
                    for i in $CONFIG_VENDOR/CONFIG_PRODUCT$/. $CONFIG_VENDOR/.; do \
                     [ -f ../vendors/$i/Kconfig ] || continue; \
                     echo "source ../vendors/$i/Kconfig" >> ../vendors/Kconfig; \
                     echo "autoconf: vendors/$i/Kconfig"; \
                    done
         
           处理autoconf的第2个依赖文件, 在lib目录下生成Kconfig.auto 和 Makefile.auto
            Makefile:44: update target '../lib/Kconfig.auto' due to: Makefile force
                    cd `dirname ../lib/Kconfig.auto`; \
                    P=`dirname ../lib/Kconfig.auto`; \
                    T=`basename $P | tr '[a-z]' '[A-Z]'`; \
                    echo "# autogenerated, do not EDIT" > Kconfig.auto; \
                    echo "# autogenerated, do not EDIT" > Makefile.auto; \
                    grep -l 'include .*\/tools/.*\.inc' */[mM]akefile 2> /dev/null | while read t; do \
                     D=`dirname $t`; \
                     M=`echo $D | tr '[a-z]' '[A-Z]' | sed 's/[-+]/_/g'`; \
                     if [ -f $D/Kconfig ]; then \
                      echo "automake: $D (custom Kconfig)"; \
                      echo "source  $P/$D/Kconfig" >> Kconfig.auto; \
                     else \
                      echo "automake: $D (default Kconfig)"; \
                      ( \
                      echo "config ${T}_${M}"; \
                      echo "bool \"$D\""; \
                      echo "help"; \
                      echo "    Automake package for $D."; \
                      echo "    see /home/dx/uclinux/uClinux-dist/Documentation/automake.txt for details"; \
                      echo "    on improving this help."; \
                      ) >> Kconfig.auto; \
                     fi; \
                     echo "dir_$""(CONFIG_${T}_${M}) += $D" >> Makefile.auto; \
                     if [ -f $D/Makefile.auto ]; then \
                      echo "include $D/Makefile.auto" >> Makefile.auto; \
                     fi; \
                    done
   
   
             处理autoconf的第2个依赖文件,在user目录下生成Kconfig.auto 和 Makefile.auto
              Makefile:44: update target '../user/Kconfig.auto' due to: Makefile force
                  cd `dirname ../user/Kconfig.auto`; \
                  P=`dirname ../user/Kconfig.auto`; \
                  T=`basename $P | tr '[a-z]' '[A-Z]'`; \
                  echo "# autogenerated, do not EDIT" > Kconfig.auto; \
                  echo "# autogenerated, do not EDIT" > Makefile.auto; \
                  grep -l 'include .*\/tools/.*\.inc' */[mM]akefile 2> /dev/null | while read t; do \
                   D=`dirname $t`; \
                   M=`echo $D | tr '[a-z]' '[A-Z]' | sed 's/[-+]/_/g'`; \
                   if [ -f $D/Kconfig ]; then \
                    echo "automake: $D (custom Kconfig)"; \
                    echo "source  $P/$D/Kconfig" >> Kconfig.auto; \
                   else \
                    echo "automake: $D (default Kconfig)"; \
                    ( \
                    echo "config ${T}_${M}"; \
                    echo "bool \"$D\""; \
                    echo "help"; \
                    echo "    Automake package for $D."; \
                    echo "    see /home/dx/uclinux/uClinux-dist/Documentation/automake.txt for details"; \
                    echo "    on improving this help."; \
                    ) >> Kconfig.auto; \
                   fi; \
                   echo "dir_$""(CONFIG_${T}_${M}) += $D" >> Makefile.auto; \
                   if [ -f $D/Makefile.auto ]; then \
                    echo "include $D/Makefile.auto" >> Makefile.auto; \
                   fi; \
                  done
   
   
   
       //在setconfig 261行
       make oldconfig_linux
          //因为在根Makefile:142里定义了依赖关系 oldconfig_linux: linux_oldconfig,因此处理对应的linux_oldconfig目标
          //根据规则:
          //linux_%:
         //  KCONFIG_NOTIMESTAMP=1 $(MAKEARCH_KERNEL) -C $(LINUXDIR) $(patsubst linux_%,%,$@)
          //Makefile:135: target 'linux_oldconfig' does not exist
          KCONFIG_NOTIMESTAMP=1 make ARCH=arm CROSS_COMPILE=arm-uclinuxeabi- CFLAGS_KERNEL="" AFLAGS_KERNEL="" EXTRA_MODULE_DIRS="" -C linux oldconfig
     
          //进入LINUX目录,
          //make[2]: Entering directory '/home/dx/uclinux/uClinux-dist/linux'
          //根据规则处理oldconfig目标.这里可以参考https://blog.csdn.net/dianhuiren/article/details/6917066       
          //Makefile:534: update target 'oldconfig' due to: scripts_basic outputmakefile FORCE
          %config: scripts_basic outputmakefile FORCE
             $(Q)$(MAKE) $(build)=scripts/kconfig $@
      
                处理依赖文件
                //Makefile:442: target 'scripts_basic' does not exist
                scripts_basic:
                 $(Q)$(MAKE) $(build)=scripts/basic
                 $(Q)rm -f .tmp_quiet_recordmcount
                 
             条件满足后,开始执行oldconfig目标的规则.   
             make -f ./scripts/Makefile.build obj=scripts/kconfig oldconfig
     
               //根据scripts/kconfig/Makefile:84: update target 'oldconfig' due to: scripts/kconfig/conf
               $(simple-targets): $(obj)/conf
                 $< $(silent) --$@ $(Kconfig)
                  //先处理依赖文件conf后,在执行      
                   //scripts/kconfig/conf  --oldconfig Kconfig
          将oldconfig写入当前.config
      在setconfig 281行,       make oldconfig_modules没有执行
     
      在setconfig 312行,       执行make oldconfig_config
     
        //因为根Makefile:140行的 oldconfig_config: myconfig_oldconfig
        //因此根据Makefile:139: target 'myconfig_oldconfig' does not exist
        //myconfig_%:
         //KCONFIG_NOTIMESTAMP=1 $(MAKEARCH) -C config $(patsubst myconfig_%,%,$@)
     
          KCONFIG_NOTIMESTAMP=1 make ARCH=arm -C config oldconfig
         
          //Makefile:7: update target 'oldconfig' due to: conf autoconf
          //oldconfig: conf autoconf
           //$(SCRIPTSDIR)/conf -o Kconfig
         因为autoconf为force
         因此如同前面LINUX的oldconfig,重新执行
              Makefile:35: update target '../vendors/Kconfig' due to: force
              echo "# autogenerated, do not EDIT" > ../vendors/Kconfig; \
              . ../.config; \
              for i in $CONFIG_VENDOR/$CONFIG_PRODUCT/. $CONFIG_VENDOR/.; do \
               [ -f ../vendors/$i/Kconfig ] || continue; \
               echo "source ../vendors/$i/Kconfig" >> ../vendors/Kconfig; \
               echo "autoconf: vendors/$i/Kconfig"; \
              done
           
              Makefile:44: update target '../lib/Kconfig.auto' due to: force
              cd `dirname ../lib/Kconfig.auto`; \
              P=`dirname ../lib/Kconfig.auto`; \
              T=`basename $P | tr '[a-z]' '[A-Z]'`; \
              echo "# autogenerated, do not EDIT" > Kconfig.auto; \
              echo "# autogenerated, do not EDIT" > Makefile.auto; \
              grep -l 'include .*\/tools/.*\.inc' */[mM]akefile 2> /dev/null | while read t; do \
               D=`dirname $t`; \
               M=`echo $D | tr '[a-z]' '[A-Z]' | sed 's/[-+]/_/g'`; \
               if [ -f $D/Kconfig ]; then \
                echo "automake: $D (custom Kconfig)"; \
                echo "source  $P/$D/Kconfig" >> Kconfig.auto; \
               else \
                echo "automake: $D (default Kconfig)"; \
                ( \
                echo "config ${T}_${M}"; \
                echo "bool \"$D\""; \
                echo "help"; \
                echo "    Automake package for $D."; \
                echo "    see /home/dx/uclinux/uClinux-dist/Documentation/automake.txt for details"; \
                echo "    on improving this help."; \
                ) >> Kconfig.auto; \
               fi; \
               echo "dir_$""(CONFIG_${T}_${M}) += $D" >> Makefile.auto; \
               if [ -f $D/Makefile.auto ]; then \
                echo "include $D/Makefile.auto" >> Makefile.auto; \
               fi; \
              done
              Makefile:44: update target '../user/Kconfig.auto' due to: force
              cd `dirname ../user/Kconfig.auto`; \
              P=`dirname ../user/Kconfig.auto`; \
              T=`basename $P | tr '[a-z]' '[A-Z]'`; \
              echo "# autogenerated, do not EDIT" > Kconfig.auto; \
              echo "# autogenerated, do not EDIT" > Makefile.auto; \
              grep -l 'include .*\/tools/.*\.inc' */[mM]akefile 2> /dev/null | while read t; do \
               D=`dirname $t`; \
               M=`echo $D | tr '[a-z]' '[A-Z]' | sed 's/[-+]/_/g'`; \
               if [ -f $D/Kconfig ]; then \
                echo "automake: $D (custom Kconfig)"; \
                echo "source  $P/$D/Kconfig" >> Kconfig.auto; \
               else \
                echo "automake: $D (default Kconfig)"; \
                ( \
                echo "config ${T}_${M}"; \
                echo "bool \"$D\""; \
                echo "help"; \
                echo "    Automake package for $D."; \
                echo "    see /home/dx/uclinux/uClinux-dist/Documentation/automake.txt for details"; \
                echo "    on improving this help."; \
                ) >> Kconfig.auto; \
               fi; \
               echo "dir_$""(CONFIG_${T}_${M}) += $D" >> Makefile.auto; \
               if [ -f $D/Makefile.auto ]; then \
                echo "include $D/Makefile.auto" >> Makefile.auto; \
               fi; \
              done
       执行//$(SCRIPTSDIR)/conf -o Kconfig    
       /home/dx/uclinux/uClinux-dist/config/kconfig/conf -o Kconfig
       configuration written to .config
    在setconfig 351行,       执行make oldconfig_uClibc
    //Makefile:144: target 'oldconfig_uClibc' does not exist
    //oldconfig_uClibc:
     //[ -z "$(findstring uClibc,$(LIBCDIR))" ] || KCONFIG_NOTIMESTAMP=1 $(MAKEARCH) -C $(LIBCDIR) oldconfig
      [ -z "uClibc" ] || KCONFIG_NOTIMESTAMP=1 make ARCH=arm -C uClibc oldconfig
      Makefile.in:445: update target 'oldconfig' due to: extra/config/conf
      oldconfig: $(conf)
         $(Q)$< -o extra/Configs/Config.in
          先处理依赖关系
          $(conf) $(mconf): | $(top_builddir)include/config $(top_builddir)extra/config/lxdialog
            $(Q)$(MAKE) -C extra/config $(@F)
 
                  //$(addprefix $(top_builddir),include include/bits include/sys include/config lib extra/config/lxdialog extra/locale extra/scripts $(subdirs)):
                 //   $(do_mkdir)
                  Makefile.in:429: target 'include/config' does not exist
                         MKDIR include/config
                         install -d include/config
        
            //Makefile.in:434: target 'extra/config/conf' does not exist
             make -C extra/config conf
                $(host-cobjs.nogen): $(obj)/%.o: $(top_srcdir)$(src)/%.c
                 $(hcompile.o)
                $(host-cobjs.generated): $(obj)/%.o: $(obj)/%.c
                 $(hcompile.o)
                $(obj)/conf: $(conf-objs)
                 $(hcompile.u) 
    
    
         执行$(Q)$< -o extra/Configs/Config.in,生成.config文件
    //回到根Makefile执行体,执行
    //@if egrep "^CONFIG_DEFAULTS_KERNEL=y" .config > /dev/null; then \
     //$(MAKE) linux_$@; \
     //fi
    if egrep "^CONFIG_DEFAULTS_KERNEL=y" .config > /dev/null; then \
     make linux_menuconfig; \
    fi
         Makefile:135: target 'linux_menuconfig' does not exist
         KCONFIG_NOTIMESTAMP=1 make ARCH=arm CROSS_COMPILE=arm-uclinuxeabi- CFLAGS_KERNEL="" AFLAGS_KERNEL="" EXTRA_MODULE_DIRS="" -C linux menuconfig
         make[2]: Entering directory '/home/dx/uclinux/uClinux-dist/linux'
         Makefile:442: target 'scripts_basic' does not exist
         make -f ./scripts/Makefile.build obj=scripts/basic
         scripts/Makefile.host:91: update target 'scripts/basic/fixdep' due to: FORCE
         scripts/Makefile.build:97: update target '__build' due to: scripts/basic/fixdep
         rm -f .tmp_quiet_recordmcount
         Makefile:534: update target 'menuconfig' due to: scripts_basic outputmakefile FORCE
         make -f ./scripts/Makefile.build obj=scripts/kconfig menuconfig
   
         scripts/kconfig/Makefile:28: update target 'menuconfig' due to: scripts/kconfig/mconf
         scripts/kconfig/mconf  Kconfig
          configuration written to .config

   DXDX:因为没有配置进行菜单项配置,因此跳过执行
   if egrep "^CONFIG_DEFAULTS_MODULES=y" .config > /dev/null; then \
      make modules_menuconfig; \
   fi
   if egrep "^CONFIG_DEFAULTS_VENDOR=y" .config > /dev/null; then \
    make myconfig_menuconfig; \
   fi
   最后执行
   config/setconfig final

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值