資源描述:
《Linux內核啟動流程分析(一)》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、很久以前分析的,一直在電腦的一個角落,今天發(fā)現(xiàn)貼出來和大家分享下。由于是word直接粘過來的有點亂,敬請諒解!S3C2410?Linux?2.6.35.7啟動分析(第一階段)arm?linux?內核生成過程?1.?依據(jù)arch/arm/kernel/vmlinux.lds?生成linux內核源碼根目錄下的vmlinux,這個vmlinux屬于未壓縮,帶調試信息、符號表的最初的內核,大小約23MB;?命令:arm-linux-gnu-ld?-o?vmlinux?-T?arch/arm/kernel/vmlinux
2、.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去除調試
3、信息、注釋、符號表等內容,生成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?
4、mpressed/../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/pig
5、gy.o?arch/arm/boot/compressed/piggy.S?5.?依據(jù)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=0x30008000?params_ph
6、ys=0x30000100?-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/zI
7、mage大小約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?0x30
8、008000?-e?0x30008000?-n?'Linux-2.6.35.7'?-d?arch/arm/boot/zImage?arch/arm/boot/uImage內核啟動分析:本文著重分析S3C2410?linux-2.6.35.7?內核啟動的詳細過程,主要包括:?zImage?解壓縮階段、?vmlinux?啟動匯編階段、?startkernel?到創(chuàng)建第一個進程階段三個部分,