On 8/28/10, Ardelean, Andrei <Andrei.Ardelean@xxxxxxx> wrote: > Hi Wu, > > Thanks a lot for all the details. > > I am using MALTA board with 74K. > From your email I understand that the bootloader must uncompress the > Kernel before launching it, so the compressed Kernel cannot run and > decompress itself? Could you confirm? I am asking that because in some > book I have read that Linux can boot a compressed image and the Kernel > was able to uncompress itself, but maybe it was my misunderstanding. > Geert's answer is right. for the raw compressed kernel, i.e. $ gzip vmlinux $ ls vmlinux.gz You may need the bootloader to decompress it. but for the vmlinuz, it can decompress itself, the reason is: This vmlinuz puts the raw compressed kernel(i.e. the vmlinux.gz above) in a section of itself and adds an extra wrapper for booting and decompressing. it can be parsed and loaded by the bootloader(the load address of vmlinuz is the load address of the vmlinux + the size of vmlinux), then it saves the arguments passed by the bootloader, clears the bss, decompresses the raw compressed kernel into the memory(start from the load address of the raw vmlinux) and at last jump to the load address of the raw Linux, then, the story is the same as loading vmlinux. Most of the working flow is shown in arch/mips/boot/compressed/head.S. arch/mips/boot/compressed/decompress.c is a wrapper for choosing the related decompress algorithm(bzip2, gzip, lzma, lzo), arch/mips/boot/compressed/dbg.c is a simple serial output support for puts() and puthex(), the real implementation of putc() can be added in arch/mips/boot/compressed/uart-* To calculate the load address of the vmlinuz, arch/mips/boot/compressed/calc_vmlinuz_load_addr.c is added, and arch/mips/boot/compressed/ld.script is a simple ld script for linking the vmlinuz, you can get the detail layout of the vmlinuz in ld.script. To learn more about the difference of vmlinux, vmlinux.gz(now, we use vmlinux.bin.z), vmlinuz, you may need to read arch/mips/boot/compressed/Makefile for it shows you how to generate vmlinux.bin.z from vmlinux and also how to generate vmlinuz from vmlinux.bin.z. Regards, Wu Zhangjin