[lkml]   [1999]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Where the code goes?
    =?ISO-8859-1?Q?=14Tonglu?= yi writes:
    ->I found that the linux kernel source code is about 60MB, but when I
    ->compiling into into binary, making it into kernel image, the image is
    ->only about 0.6MB. I don't know how it is so? Does all of the 60MB source
    ->code become the 0.6 binary code? Why?

    Because linux uses ultra-secret 100% compression invisible patented
    algorithm to compress its kernels. <joking>

    Let see, I assume you compiled it on PC style machine, but this is not
    the only architecture which linux support. checking the architecture
    directory shows that a chunk of code is used by other platforms like
    Alpah or Sun.. those won't go into the kernel you compiled.

    eax:/usr/src/Linux/23/linux# du -sh arch/*
    711K arch/alpha
    817K arch/arm
    979K arch/i386
    2.0M arch/m68k
    920K arch/mips
    1.5M arch/ppc
    164K arch/sh
    1.2M arch/sparc
    1.2M arch/sparc64

    Furthermore there are tons of drivers, for PC's and other arechitecture,
    I doubt you compiled them all. As you can see they account for around 50%
    of sources.

    eax:/usr/src/Linux/23/linux# du -sh drivers
    35M drivers

    The image itself is compressed (not as 100% as I suggested above
    but still),

    [adam@pepsi HOWTO]$ du -sh /boot/vmlinux-2.3.18ac5 /lib/modules/2.3.18ac4/ /boot/vmlinuz-2.3.18ac5
    2.5M /boot/vmlinux-2.3.18ac5
    1.3M /lib/modules/2.3.18ac4 < uncompressed kernel
    982k /boot/vmlinuz-2.3.18ac5 < compressed kernel

    so the end binary size is : around 4 mb.

    In the end machine executable code always will be more compact that human
    readable code (at very least b/c lack of comments). for small programs
    binary is bigger becuase of overhead of starup code, but once source code
    gets big, the proportions reverse.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:54    [W:0.019 / U:19.936 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site