[Author: Bo Shen <voice.shen@gmail.com>]
前面讲了uImage的生成过程(http://blog.youkuaiyun.com/voice_shen/article/details/6559752)。uImage会依赖zImage。那么下面就具体分析zImage生成过程。
其实zImage的生成过程更简单,源代码 <arm/arm/boot/Makefile>,如下:
$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
$(call if_changed,objcopy)
@$(kecho) ' Kernel: $@ is ready'
从源码可知,zImage是由<arm/arm/boot/compressed/vmlinux>通过objcopy生成。
if_changed命令从那里来呢?查看源码,发现其在<scripts/Kbuild.include>里面定义。
--->8---
# if_changed - execute command if any prerequisite is newer than target, or command line has changed.
---8<---
当执行$(call if_changed, objcopy)命