From: graeme.russ@gmail.com (Graeme Russ)
To: kernelnewbies@lists.kernelnewbies.org
Subject: What is the purpose of parse_elf() in misc.c
Date: Fri, 25 Nov 2011 16:30:44 +1100 [thread overview]
Message-ID: <4ECF2804.9090007@gmail.com> (raw)
Hi All,
In looking at booting a raw x86 kernel image, I discovered that the
compressed image in bzImage is actually an ELF image created with:
objcopy -R .comment -S vmlinux
After decompressing the image, the parse_elf() function in misc.c copies
the sections from the ELF image (there are 3 sections, only 2 are marked
PT_LOAD) into their final resting place in memory. This got me to thinking,
why not use:
objcopy -O binary -R .comment -S vmlinux
I wrote a little stand-alone parse_elf() program, and lo-and-behold, the
outputs are identical. So, in theory, if bzImage contained a raw binary, it
could be decompressed directly to the target address.
Now there is some adjustment in parse_elf() for relocatable kernels, but I
can't but think that this could be simply catered for in the decompression
target address
Surely this would speed up kernel loading by removing the additional copy
that parse_elf() introduces
Or am I missing something significant?
Regards,
Graeme
next reply other threads:[~2011-11-25 5:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 5:30 Graeme Russ [this message]
2011-12-02 5:41 ` What is the purpose of parse_elf() in misc.c Mulyadi Santosa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ECF2804.9090007@gmail.com \
--to=graeme.russ@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.