vmlinuz的产生

vmlinuz 其实就是Image.gz
下面这个是编译rpm包时候的mkspec文件,从最后的else可以看到vmlinuz就是KBUILD_IMAGE的拷贝
echo "%ifarch ia64"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
echo "%else"
echo "%ifarch ppc64"
echo "cp vmlinux arch/powerpc/boot"
echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
echo "%else"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
echo "%endif"
echo "%endif"
而在makefile中定义KBUILD_IMAGE就是Image.gz
arch/arm64/Makefile:116:KBUILD_IMAGE    := $(boot)/Image.gz

最后Image.gz 就是vmlinux 压缩后的

$(obj)/Image: vmlinux FORCE
        $(call if_changed,objcopy)

$(obj)/Image.gz: $(obj)/Image FORCE
        $(call if_changed,gzip)

最后可以通过file命令验证vmlinuz的格式
[root@localhost boot]# file vmlinuz-4.14.0-115.10.1.el7a.aarch64
vmlinuz-4.14.0-115.10.1.el7a.aarch64: gzip compressed data, from Unix, max compression

 

你可能感兴趣的:(Linux,源码分析)