[Top] [All Lists]

Re: Does Linux Mips support compressed Kernel?

To: "Ardelean, Andrei" <>
Subject: Re: Does Linux Mips support compressed Kernel?
From: wu zhangjin <>
Date: Sat, 28 Aug 2010 12:01:12 +0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=97wDaYXRErIQatEVpxvEjhbxIBRfAoHXgdkorZf9Gvw=; b=epyYwEXXJVfO9ZuGy40JVkiAxFvtTxjo270vPzkBQ6rJQ6zo8YCvMhaJ4udkR+H6n+ trXmt2DLl/AuHO4FSrNycDCTRIBCuY9cM1oPQA6/lV1dlQVlIuVNNQqLxjUGQlQFXATI KcveDqrOIpJyq3pA8Np/xVzcbrGz1cHjIO8CM=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=aqGCEmQ1usC//zvLG3pV09Xip4mSxLiVlHgHAFL9f5myqjKhexYswebgFozMPfaa+3 VgH97jB23X2OBrSTr8oO7eh2z0sBICbRQoguAr+tm8PJRASB2pusQJZTEJnG2vyFneZ5 kzA9Lg1P/DeUPzEFwndU9Yo6aUivXXE82WLzo=
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <>
On 8/28/10, Ardelean, Andrei <> 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

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

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

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

Wu Zhangjin

<Prev in Thread] Current Thread [Next in Thread>