Linux内核启动流程分析(一)
很久以前分析的,一直在电脑的一个角落,今天发现贴出来和大家分享下。由于是word直接粘过来的有点乱,敬请谅解!S3C2410?Linux?启动分析(第一阶段) HYPERLINK "/sustzombie/article/details/5626780" \o "arm linux 内核生成过程" arm?linux?内核生成过程?1.?依据arch/arm/kernel/vmlinux.lds?生成linux内核源码根目录下的vmlinux,这个vmlinux属于未压缩,带调试信息、符号表的最初的内核,大小约23MB;?命令:arm-linux-gnu-ld?-o?vmlinux?-T?arch/arm/kernel/vmlinux.lds??arch/arm/kernel/head.o??init/built-in.o??--start-group???arch/arm/mach-s3c2410/built-in.o???kernel/built-in.o??????????mm/built-in.o???fs/built-in.o???ipc/built-in.o???drivers/built-in.o???net/built-in.o??--end-group?.tmp_kallsyms2.o?2.?将上面的vmlinux去除调试信息、注释、符号表等内容,生成arch/arm/boot/Image,这是不带多余信息的linux内核,Image的大小约3.2MB;???命令:arm-linux-gnu-objcopy?-O?binary?-S??vmlinux?arch/arm/boot/Image?3.将?arch/arm/boot/Image?用gzip?-9?压缩生成arch/arm/boot/compressed/piggy.gz大小约1.5MB;??????????命令:gzip?-f?-9?<?arch /arm/boot/compressed/../Image?>?arch/arm/boot/compressed/piggy.gz?4.?编译arch/arm/boot/compressed/piggy.S?生成arch/arm/boot/compressed/piggy.o大小约1.5MB,这里实际上是将piggy.gz通过piggy.S编译进piggy.o文件中。而piggy.S文件仅有6行,只是包含了文件piggy.gz;??命令:arm-linux-gnu-gcc?-o?arch/arm/boot/compressed/piggy.o?arch/arm/boot/compressed/piggy.S?5.?依据arch/arm/boot/compressed/vmlinux.lds?将arch/arm/boot/compressed/目录下的文件head.o?、piggy.o?、misc.o链接生成?arch/arm/boot/compressed/vmlinux,这个vmlinux是经过压缩且含有自解压代码的内核,大小约1.5MB;?命令:arm-linux-gnu-ld?zreladdr=0params_phys=0-T?arch/arm/boot/compressed/vmlinux.lds?arch/arm/boot/compressed/head.o?arch/arm/boot/compressed/piggy.o?arch/arm/boot/compressed/misc.o?-o?arch/arm/boot/compressed/vmlinux?6.?将arch/arm/boot/compressed/vmlinux去除调试信息、注释、符号表等内容,生成arch/arm/boot/zImage大小约1.5MB;这已经是一个可以使用的linux内核映像文件了;?命令:arm-linux-gnu-objcopy?-O?binary?-S??arch/arm/boot/compressed/vmlinux??arch/arm/boot/zImage?7.?将arch/arm/boot/zImage添加64Bytes的相关信息打包为arch/arm/boot/uImage大小约1.5MB;?命令:?./mkimage?-A?arm?-O?linux?-T?kernel?-C?none?-a?0-e?0-n?'Linux-'?-d?arch/arm/boot/zImage?arch/arm/boot/uImage
内核启动分析:本文着重分析S3C241