资源描述:
《linux内核自解压分析》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、linux内核自解压分析在嵌入式中一般使用压缩内核,所以在bootloader把压缩的内核移到SDRAM中时,先进行自解压解压以后在调用arch/arm/kernel/head.S,而内核zImage的生成:先生成Image,然后经由gunzip压缩成piggy.gz,然后和vmlinux.ld.S和head.S链接成zImage#include/**Debuggingstuff**Notethatthesemacrosmustnotcontainanycodewhichisnot*100%relocatable.Anyattempttodosowillres
2、ultinacrash.*Pleaseselectoneofthefollowingwhenturningondebugging.*/#ifdefDEBUG#ifdefined(CONFIG_DEBUG_ICEDCC)#ifdefCONFIG_CPU_V6.macroloadsp,rb.endm.macrowriteb,ch,rbmcrp14,0,ch,c0,c5,0.endm#elifdefined(CONFIG_CPU_XSCALE).macroloadsp,rb.endm.macrowriteb,ch,rbmcrp14,0,ch,c8,c0,0.endm#else.macroload
3、sp,rb.endm.macrowriteb,ch,rbmcrp14,0,ch,c1,c0,0.endm#endif#else/*CONFIG_DEBUG_ICEDCC*/#include.macrowriteb,ch,rbsenduartch,rb.endm#ifdefined(CONFIG_ARCH_SA1100).macroloadsp,rbmovrb,#0x80000000@physicalbaseaddress#ifdefCONFIG_DEBUG_LL_SER3addrb,rb,#0x00050000@Ser3#elseaddrb
4、,rb,#0x00010000@Ser1#endif.endm#elifdefined(CONFIG_ARCH_S3C2410).macroloadsp,rbmovrb,#0x50000000addrb,rb,#0x4000*CONFIG_S3C_LOWLEVEL_UART_PORT.endm#else.macroloadsp,rbaddruartrb.endm#endif#endif#endif.macrokputc,valmovr0,valblputc.endm.macrokphex,val,lenmovr0,valmovr1,#lenblphex.endm.macrode
5、bug_reloc_start#ifdefDEBUGkputc#''kphexr6,8/*processorid*/kputc#':'kphexr7,8/*architectureid*/#ifdefCONFIG_CPU_CP15kputc#':'mrcp15,0,r0,c1,c0kphexr0,8/*controlreg*/#endifkputc#''kphexr5,8/*decompressedkernelstart*/kputc#'-'kphexr9,8/*decompressedkernelend*/kputc#'>'kphexr4,8/*kernelexecutionaddr
6、ess*/kputc#''#endif.endm.macrodebug_reloc_end#ifdefDEBUGkphexr5,8/*endofkernel*/kputc#''movr0,r4blmemdump/*dump256bytesatstartofkernel*/#endif.endm.section".start",#alloc,#execinstr/**sortoutdifferentcallingconventions*/.alignstart:.typestart,#function.rept8movr0,r0.endrb1f.word0x016f2818@Magicn
7、umberstohelptheloader.wordstart@absoluteload/runzImageaddress.word_edata@zImageendaddress1:movr7,r1@savearchitectureIDmovr8,r2@saveatagspointer#ifndef__ARM_ARCH_2__/**BootingfromAngel-needtoenterSVCmo