linux_2.6.30.4_Makefile_4--make zImage流程

为解惑生成zImage的过程,查到此文,地址:http://blog.chinaunix.net/uid-26009923-id-3194580.html

    分析一下make zImage的流程,具体的操作是:首先将linux-2.6.30.4/config_EmbedSky_W35_256MB改名为.config,然后make zImage.看一下make zImage之后发生了什么事情。

点击(此处)折叠或打开

  1. linux-2.6.30.4/Makefile
  2. 284 #config-targets=0, mixed-targets=0, dot-config=1,不会进入L285
  3. 285 ifeq ($(mixed-targets),1) #不成立跳过
  4. ...
  5. 291 ifeq ($(config-targets),1) #不成立跳过
  6. 304 else
  7. 305
  8. 306 ifeq ($(KBUILD_EXTMOD),)
  9. ......
  10. 354 include $(srctree)/arch/$(SRCARCH)/Makefile
在 arch/arm/Makefile中包含了zImage

点击(此处)折叠或打开

  1.   linux-2.6.30.4/arch/arm/Makefile
  2.    174    ifeq ($(CONFIG_XIP_KERNEL),y)
  3.    175    KBUILD_IMAGE := xipImage
  4.    176    else
  5.    177    KBUILD_IMAGE := zImage
  6.    178    endif
  7.    179    
  8.    180    all:    $(KBUILD_IMAGE)
  9.    181    
  10.    182    boot := arch/arm/boot
  11.    183    
  12.    193    zImage Image xipImage bootpImage uImage: vmlinux
  13.    194        $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  14. #zImage依赖于vmliux, vmliux在linux-2.6.30.4/Makefile中
1. linux-2.6.30.4/Makefile 中包含了arch/arm/Makefile
2. 在 arch/arm/Makefile中找到目标zImage
3. zImage依赖linux-2.6.30.4中的Makefile中vmlinux
4. 分析 linux-2.6.30.4/Makefile中vmlinux的依赖
5.
就第4步进行具体分析

点击(此处)折叠或打开

  1.    306    ifeq ($(KBUILD_EXTMOD),)
  2.    307    PHONY += scripts
  3.    308    scripts: scripts_basic include/config/auto.conf
  4.    309        $(Q)$(MAKE) $(build)=$(@)
  5.    310    
  6.    311    init-y        := init/
  7.    312    drivers-y    := drivers/ sound/ firmware/
  8.    313    net-y        := net/
  9.    314    libs-y        := lib/
  10.    315    core-y        := usr/
  11.    316    endif # KBUILD_EXTMOD
  12.    317    
  13.    318    ifeq ($(dot-config),1)
  14.    319    -include include/config/auto.conf
  15.    320    
  16.    321    ifeq ($(KBUILD_EXTMOD),)
  17.    322    -include include/config/auto.conf.cmd
  18.    323    
  19.    324    $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
  20.    325    
  21.    326    include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
  22.    327        $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
  23.    328    else
  24.    329    PHONY += include/config/auto.conf
  25.    330    
  26.    331    include/config/auto.conf:
  27.    332        $(Q)test -e include/linux/autoconf.--e $@ || (        \
  28.    333        echo;                                \
  29.    334        echo " ERROR: Kernel configuration is invalid.";        \
  30.    335        echo " include/linux/autoconf.h or $@ are missing.";    \
  31.    336        echo " Run 'make oldconfig && make prepare' on kernel src to fix it.";    \
  32.    337        echo;                                \
  33.    338        /bin/false)
  34.    339    
  35.    340    endif # KBUILD_EXTMOD

  36. #vmliux的依赖vmlinux-lds=arch/arm/kernel/vmlinux.lds vmlinux-init=arch/arm/kernel/head-nommu.o arch/arm/      kernel/init_task.o  init/built-in.o vmlinux-main= usr/built-in.o  arch/arm/kernel/built-in.o  arch/arm/mm/built-in.o  arch/arm/common/built-in.o  kernel/built-in.o  mm/built-in.o  fs/built-in.o  ipc/built-in.o  security/    built-in.o  crypto/built-in.o  block/built-in.o  arch/arm/lib/lib.a  lib/lib.a  arch/arm/lib/built-in.o  lib/   built-in.o  drivers/built-in.o  sound/built-in.o  firmware/built-in.o  net/built-in.o kallsyms=
  37.    576    vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
  38. #vmlinux-lds等 依赖于vmlinux-dirs
  39.    598    $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
  40.    
  41.    601    PHONY += $(vmlinux-dirs)
  42.    602    $(vmlinux-dirs): prepare scripts
  43.    603        $(Q)$(MAKE) $(build)=$@

  44.    636    prepare3: include/config/kernel.release
  45.    649    
  46.    650    prepare2: prepare3 outputmakefile
  47.    651    
  48.    652    prepare1: prepare2 include/linux/version.h include/linux/utsrelease.\
  49.    653     include/asm include/config/auto.conf
  50.    654        $(cmd_crmodverdir)
  51.    655    
  52.    656    archprepare: prepare1 scripts_basic
  53.    657    
  54.    658    prepare0: archprepare FORCE
  55.    659        $(Q)$(MAKE) $(build)=.
  56.    660        $(Q)$(MAKE) $(build)=. missing-syscalls
  57.    661    
  58.    662    prepare: prepare0
  1. 整理一下上述的各个依赖关系,如下图所示
  2. linux_2.6.30.4_Makefile_4--make zImage流程_第1张图片
  3. 下面按照执行的顺序详细分析一下,各个步骤:
  4. 4.1 首先执行的是scripts的过程:
  5.     这个过程类似于make menuconfig的过程,只不过最后调用的是:conf -s ,不产生图形界面。

    点击(此处)折叠或打开

    1. scrpts的过程:
    2.  326    include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
    3.  327        $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
    4.  即: make -f /root/kernel/linux-2.6.30.4/Makefile silentoldconfig
    5.      make -f scripts/Makefile.build obj=scripts/basic
    6.      mkdir -p include/linux include/config
    7.      make -f scripts/Makefile.build obj=scripts/kconfig silentoldconfig
    8.      scripts/kconfig/conf -s arch/arm/Kconfig
  6. 4.2 其次执行的是prepare的过程:
  7. linux_2.6.30.4_Makefile_4--make zImage流程_第2张图片
  8. 点击(此处)折叠或打开

    1. linux-2.6.30.4/Makefile 中archprepare: prepare1 scripts_basic
    2. 而在
    3. arch/arm/Makefile中archprepare: maketools
    4. 这地方有点没有看明白,在Makefile和arch/arm/Makefile中都有archprepare的规则,
    5. 什么这两个都执行了,而不是一个覆盖另一个?
    6.   
    7.    linux-2.6.30.4/Makefile
    8.    714    include/linux/version.h: $(srctree)/Makefile FORCE
    9.    715        $(call filechk,version.h)
    10.    这将会调用linux-2.6.30.4/scripts/Kbuild.include中的filechk函数,主要作用是:用Makefile中的版本信息更新include/linux/version.h中的版本信息。

    11.   arch/arm/Makefile
    12.   $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
    13.  即: make -f scripts/Makefile.build obj=arch/arm/tools include/asm-arm/mach-types.h
    14.  这会调用arch/arm/tools/Makefile中的规则产生include/asm-arm/mach-types.h 文件

    15.    linux-2.6.30.4/Makefile
    16.    628    include/config/kernel.release: include/config/auto.conf FORCE
    17.    629        $(Q)rm -f $@
    18.    630        $(Q)echo $(kernelrelease) > $@
    19.    这会产生kernel.release文件: echo 2.6.30.4-EmbedSky > include/config/kernel.release
    20.     
    21.    linux-2.6.30.4/Makefile
    22.    717    include/linux/utsrelease.h: include/config/kernel.release FORCE
    23.    718        $(call filechk,utsrelease.h)
    24. 这将会调用linux-2.6.30.4/scripts/Kbuild.include中的filechk函数,主要是检查include/config/kernel.release中的kernel版本信息是否超过64字节,超过则报错。

    25.    linux-2.6.30.4/Makefile
    26.    693    include/asm: FORCE
    27.    694        $(Q)$(check-symlink)
    28.    695        $(Q)$(create-symlink)
    29.   #刚生出来(下载)的内核代码是不存在include/asm目录的,check-symlink是检查include/asm是存在并指向asm-arm,如果不存在asm-arm的符号连接则创建,存在但不正确就打印出错信息。

    30.    linux-2.6.30.4/Makefile
    31.    prepare1的最后执行 $(cmd_crmodverdir)
    32.    1146    cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
    33.    1147     $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
    34.    即:mkdir -p .tmp_versions

    35.    linux-2.6.30.4/Makefile
    36.    archprepare的第二个依赖 scripts_basic
    37.    即:make -f scripts/Makefile.build obj=scripts/basic

    38.    linux-2.6.30.4/Makefile
    39.    prepare0的依赖执行完之后,执行:
    40.    make -f scripts/Makefile.build obj=.
    41. #执行scripts/Makefile的__build目标,此处只执行always依赖,(KBUILD_BUILTIN=1,但是$(builtin-target) $(lib-target) $(extra-y)都为空,KBUILD_MODULES=0)
    42. always=./include/linux/bounds.h ./include/asm/asm-offsets.h 
    43. __build: ./include/linux/bounds.h ./include/asm/asm-offsets.h 
    44. :
    45. 这将会编译kernel/bounds.c 和 arch/arm/kernel/asm-offsets.c两个文件
    4.3 vmlinux-dirs的依赖执行完了之后,再去执行vmlinux-dirs的命令了

    点击(此处)折叠或打开

    1. linux-2.6.30.4/Makefile
    2.  880 PHONY += $(vmlinux-dirs)
    3.  881 $(vmlinux-dirs): prepare scripts
    4.  882 $(Q)$(MAKE) $(build)=$@
    5. 由于命令中用到$@即vmlinux-dirs先转到vmlinux-dirs的定义处:

    6. linux-2.6.30.4/Makefile
    7.  653 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
    8.  654 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
    9.  655 $(net-y) $(net-m) $(libs-y) $(libs-m)))
    10. 可以看到vmlinux-dirs是:
    11. vmlinux-dirs=init usr arch/arm/kernel arch/arm/mm arch/arm/common arch/arm/mach-s3c2410 arch/arm/mach-s3c2400 arch/arm/mach-s3c2412 arch/arm/mach-s3c2440 arch/arm/mach-s3c2442 arch/arm/mach-s3c2443 arch/arm/plat-s3c24xx arch/arm/plat-s3c kernel mm fs ipc security crypto block drivers sound firmware net arch/arm/lib lib
    12. 这就是要去内核的每一个目录下面去编译需要的每一个源文件了

    13. make -f scripts/Makefile.build obj=init
    14. #builtin-target=init/built-in.o lib-target= extra-y= subdir-ym= always=

    15. linux-2.6.30.4/scripts/Makefile.build
    16.  93 __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
    17.  94 $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
    18.  95 $(subdir-ym) $(always)
    19.  96 @:
    20. #此时只有builtin-target=init/built-in.o有定义,下一步生成目标builtin-target

    21. linux-2.6.30.4/scripts/Makefile.build
    22. 286 ifdef builtin-target
    23. 287 quiet_cmd_link_o_target = LD $@
    24. 288 # If the list of objects to link is empty, just create an empty built-in.o
    25. 289 cmd_link_o_target = $(if $(strip $(obj-y)),\
    26. 290 $(LD) $(ld_flags) --o $@ $(filter $(obj-y), $^) \
    27. 291 $(cmd_secanalysis),\
    28. 292 rm -f $@; $(AR) rcs $@)
    29. 293 
    30. 294 $(builtin-target): $(obj-y) FORCE
    31. 295 $(call if_changed,link_o_target)

    32. #先去执行builtin-target的依赖obj-y,将所以.c编译为.o, .s编译为.o
    33. obj-y=init/main.o init/version.o init/mounts.o init/noinitramfs.o init/calibrate.o
    34. ld 
    35. 把obj-y链接成init/built-in.o
    36. 目标vmlinux-dirs执行完成后,built-in.o

    37.  $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
    38. 因为这个指令是一个空指令,所以当vmlinux-dirs执行完成之后,vmlinux的依赖$(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds)都准备好了。
    4.4 vmlinux的两个依赖: vmlinux.o与$(kallsyms.o)

    点击(此处)折叠或打开

    1. 4.4.1 vmlinux的一个依赖是:vmlinux.o
    2. linux-2.6.30.4/Makefile
    3.  866 vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
    4.  867 $(call if_changed_rule,vmlinux-modpost)

    5. linux-2.6.30.4/scripts/Kbuild.include
    6. 208 if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
    7. 209 @set -e; \
    8. 210 $(rule_$(1)))
    9. #如果目标有更新则执行rule_vmlinux-modpost
    10. linux-2.6.30.4/Makefile
    11.  838 define rule_vmlinux-modpost
    12.  839 :
    13.  840 +$(call cmd,vmlinux-modpost)
    14.  841 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
    15.  842 $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
    16.  843 endef

    17. linux-2.6.30.4/Makefile
    18.  834 quiet_cmd_vmlinux-modpost = LD $@
    19.  835 cmd_vmlinux-modpost = $(LD) $(LDFLAGS) --o $@ \
    20.  836 $(vmlinux-init) --start-group $(vmlinux-main) --end-group \
    21.  837 $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
    22. #首先链接生成vmlinux.o: L834 arm-linux-ld -EL -r -o vmlinux.o
    23. 然后执行:make -f /root/kernel/linux-2.6.30.4/scripts/Makefile.modpost vmlinux.o,
    24. 最后把链接生成vmlinux.o的过程打印到.cmd文件中

    25. linux-2.6.30.4/scripts/Makefile.modpost
    26. 103 vmlinux.o: FORCE
    27. 104 @rm -fr $(kernelmarkersfile)
    28. 105 $(call cmd,kernel-mod)
    29. 然后执行:
    30. 101 cmd_kernel-mod = $(modpost) $@
    31. 即:scripts/mod/modpost -o /root/kernel/linux-2.6.30.4/Module.symvers -S -c vmlinux.o
    32. 用scripts/mod/modpost处理vmlinux.o,得到Module.symvers,这个具体有什么作用现在还没有搞清楚


    33. 4.4.2 vmlinux的一个依赖是:$(kallsyms.o)=.tmp_kallsyms2.o
    34.  801 .tmp_kallsyms1..tmp_kallsyms2..tmp_kallsyms3.o: %.o: %.S scripts FORCE
    35.  802 $(call if_changed_dep,as_o_S)

    36. .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
    37. 依赖中又含有%.o: %.S ? 没看明白
    38. 看到打印中: /opt/EmbedSky/4.3.3/bin/arm-none-linux-gnueabi-nm -.tmp_vmlinux2 | scripts/kallsyms > .tmp_kallsyms2.S
    39. 然后通过: arm-linux-gcc $(a_flags) --.tmp_kallsyms2..tmp_kallsyms2.S

    40. linux-2.6.30.4/scripts/Kbuild.include
    41. 198 if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
    42. 199 @set -e; \
    43. 200 $(echo-cmd) $(cmd_$(1)); \
    44. 201 scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
    45. 202 rm -f $(depfile); \
    46. 203 mv -f $(dot-target).tmp $(dot-target).cmd)

    47. #执行cmd_as_o_S
    48. linux-2.6.30.4/scripts/Makefile
    49. 1580 cmd_as_o_S = $(CC) $(a_flags) --o $@ $<

  9. 4.5 当vmlinux的所有依赖都ok之后,执行vmlinux的命令

    点击(此处)折叠或打开

    1. 845 # vmlinux image - including updated kernel symbols
    2.  846 vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
    3.  847 ifdef CONFIG_HEADERS_CHECK
    4.  848 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
    5.  849 endif
    6.  850 ifdef CONFIG_SAMPLES
    7.  851 $(Q)$(MAKE) $(build)=samples
    8.  852 endif
    9.  853 ifdef CONFIG_BUILD_DOCSRC
    10.  854 $(Q)$(MAKE) $(build)=Documentation
    11.  855 endif
    12.  856 $(call vmlinux-modpost)
    13.  857 $(call if_changed_rule,vmlinux__)
    14.  858 $(Q)rm -.old_version

    15. #CONFIG_HEADERS_CHECK CONFIG_SAMPLES CONFIG_BUILD_DOCSRC都为空,所以
    16. 4.5.1 $(call vmlinux-modpost) ;没找到定义
    17. 4.5.2 $(call if_changed_rule,vmlinux__) ;具体分析
    18. 4.5.3 $(Q)rm -f .old_version


    19. linux-2.6.30.4/scripts/Kbuild.include
    20. 208 if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ),                 \
    21. 209     @set -e;                                                             \
    22. 210     $(rule_$(1)))
    23. #如果目标有更新则执行rule_vmlinux__

    24. linux-2.6.30.4/Makefile
    25.  731 define rule_vmlinux__
    26.  732     :
    27.  733     $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version))
    28.  734 
    29.  735     $(call cmd,vmlinux__)
    30.  736     $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
    31.  737 
    32.  738     $(Q)$(if $($(quiet)cmd_sysmap),                                      \
    33.  739       echo '  $($(quiet)cmd_sysmap)  System.map' &&)                     \
    34.  740     $(cmd_sysmap) $@ System.map;                                         \
    35.  741     if [ $$? -ne 0 ]; then                                               \
    36.  742         rm -f $@;                                                    \
    37.  743         /bin/false;                                                  \
    38.  744     fi;
    39.  745     $(verify_kallsyms)
    40.  746 endef
    41. L733行 CONFIG_KALLSYMS=y,所以不做任何操作
    42. L735行 在linux-2.6.30.4/scripts/Kbuild.include L160 cmd = @$(echo-cmd) $(cmd_$(1)),打印并执行cmd_vmlinux__

    43. linux-2.6.30.4/Makefile
    44.  704 quiet_cmd_vmlinux__ ?= LD      $@
    45.  705       cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
    46.  706       -T $(vmlinux-lds) $(vmlinux-init)                          \
    47.  707       --start-group $(vmlinux-main) --end-group                  \
    48.  708       $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
    49. #链接生成vmlinux的过程:
    50. L735 arm-linux-ld -o vmlinux -Tarch/arm/kernel/vmlinux.lds  
    51. L736 将链接生成vmlinux的过程写入到.cmd中
    52. L738   在linux-2.6.30.4/Makefile中 L724 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap

    53. .scripts/mksysmap  System.map 
    54. ./scripts/mksysmap vmlinux System.map
    55. if [ $? -ne 0 ];
    56.     then rm -f vmlinux;
    57. /bin/false; 
    58. fi

    59. L858 rm -f .old_version
    5. 生成最终的zImage

    点击(此处)折叠或打开

    1. 终于zImage的依赖vmlinux执行完了,下面回到arch/arm/Makefile中执行zImge的命令过程:
    2. linux-2.6.30.4/arch/am/Makefile
    3. 230 zImage Image xipImage bootpImage uImage: vmlinux
    4. 231  $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
    5.  #make -f scripts/Makefile.build obj=arch/arm/boot MACHINE=arch/arm/mach-s3c2410/ arch/arm/boot/zImage

    6. #执行arch/arm/boot/Makefile中的zImage
    7. linux-2.6.30.4/arch/arm/boot/Makefile 
    8.  56 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
    9.  57 $(call if_changed,objcopy)
    10.  58 @cp -f arch/arm/boot/zImage zImage.bin
    11.  59 @echo ' Kernel: $@ is ready'
    12. 首先生成arch/arm/boot/compress/vmlinux

    13. linux-2.6.30.4/arch/arm/boot/Makefile中
    14.  53 $(obj)/compressed/vmlinux: $(obj)/Image FORCE
    15.  54 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
    16.   make -f scripts/Makefile.build obj=arch/arm/boot/compressed arch/arm/boot/compressed/vmlinux

    17. 执行arch/arm/boot/compress/Makefile
    18. linux-2.6.30.4/arch/arm/boot/compressed/Makefile
    19.  94 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.\
    20.  95 $(addprefix $(obj)/, $(OBJS)) FORCE
    21.  96 $(call if_changed,ld)
    22.  97 @:

    23. #arm-linux-gcc -c -o arch/arm/boot/compressed/head.o arch/arm/boot/compressed/head.S
    24. linux-2.6.30.4/arch/arm/boot/compressed/Makefile
    25. 102 $(obj)/piggy.o: $(obj)/piggy.gz FORCE
    26. gzip --< arch/arm/boot/compressed/../Image > arch/arm/boot/compressed/piggy.gz
    27. piggy.o
    28. #arm-linux-gcc -c -o arch/arm/boot/compressed/piggy.o arch/arm/boot/compressed/piggy.S

    29. #arm-linux-gcc -c -o arch/arm/boot/compressed/misc.o arch/arm/boot/compressed/misc.c

    30. #arm-linux-ld -T arch/arm/boot/compressed/vmlinux.lds compressed/head.o piggy.o misc.o -o arch/arm/boot/compressed/vmlinux

    31. linux-2.6.30.4/arch/arm/boot/Makefile 
    32.  56 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
    33.  57 $(call if_changed,objcopy)
    34.  58 @cp -f arch/arm/boot/zImage zImage.bin
    35.  59 @echo ' Kernel: $@ is ready'
    36. #好了compressed/vmlinux也生成了,最后一步$(call if_changed, objcopy)

    37. linux-2.6.30.4/scripts/Kbuild.include
    38. 192 if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
    39. 193 @set -e; \
    40. 194 $(echo-cmd) $(cmd_$(1)); \
    41. 195 echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
    42. #打印并执行$(cmd_objcopy),最后把$(cmd_objcopy)写到.cmd文件中

    43. linux-2.6.30.4/scripts/Makefile.lib
    44. 184 quiet_cmd_objcopy = OBJCOPY $@
    45. 185 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
    46. 即:arm-linux-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S arch/arm/boot/compressed/vmlinux arch/arm/boot/zImage
    47. 将vmlinux这个elf的二进制文件,转换为raw二进制文件。
    终于完成了,zImage的过程,不容易啊!

你可能感兴趣的:(Linux_shell)