Will kernel in-place decompression overwrite uncompressed part ?

Jacky jackyclivia at 163.com
Fri Mar 8 22:27:15 EST 2013


According arch/x86/boot/compressed/head_32.S and some comments:

======================================
/*
 * Copy the compressed kernel to the end of our buffer
 * where decompression in place becomes safe.
 */
    pushl   %esi
    leal    (_bss-4)(%ebp), %esi
    ...
/*
 * Jump to the relocated address.
 */
    leal    relocated(%ebx), %eax
    jmp *%eax
ENDPROC(startup_32)

    .text
relocated:
...
==========================

We can see the kernel moves itself, including both compressed and uncompressed to the new location,  and after finish moving, kernel also jump to the new location.

And the below code in this file, uncompressed part will decompress compressed part in-place, so it seems that uncompressed part is overwritten ... 

At 2013-03-09 11:12:26,"leo kirotawa" <kirotawa at gmail.com> wrote:
I don't know if it can help you, but let's try. [1]
What I understand about that is. The compressed kernel is in fact a bzImage or some zImage kernel, and it is a file. As the link says in that compressed file we have this header that makes some early configurations. The kernel is uncompressed into the memory and the compressed kernel remains in the place it was before. Just what matter by the compressed kernel is that header info that it use to setup the stack to the new kernel.


I'm no sure if I'm talking some nosense, but that was what I saw in kernel boot files. Maybe some others mate here can complement or fix my thoughts here.




[1] http://www.ibm.com/developerworks/library/l-linuxboot/


On Fri, Mar 8, 2013 at 10:12 PM, Jacky <jackyclivia at 163.com> wrote:

 
Dear All,

Before, kernel first decompressed to other memory location and then merged and put at final destination. Now, kernel decompression  are decompressed in-place, so-called in-place decompression.

But the compressed part is encompassed by uncompressed part. So, after decompression, will the uncompressed part be overwritten by the decompressed kernel ? If so, some uncompressed part such as deal with kernel relocation will be overwritten by the decompressed kernel, which don't make sense, am I missed something ?

Regards,
Jacky






_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies







--
Leônidas S. Barbosa (Kirotawa)

Engenheiro de Software - IBM (LTC - Linux Technology Center)
MsC Sistemas e Computação
Bacharel em Ciências da Computação.

blog nerd: corecode.wordpress.com/


User linux : #480879


"Mais sábio é aquele que sabe que não sabe" (Sócrates)
"smile and wave" - =D + o/ (Penguins of Madagascar)


日本語の学生です。
コンピュータサイエンスの学位.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130309/4c01bd07/attachment.html 


More information about the Kernelnewbies mailing list