From: Vivek Goyal <vgoyal@in.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@suse.de>, Jurriaan <thunder7@xs4all.nl>,
Helge Hafting <helgehaf@aitel.hist.no>,
linux-kernel@vger.kernel.org, Horms <horms@verge.net.au>,
Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: [PATCH 1/2] x86_64: Reflect the relocatability of the kernel in the ELF header.
Date: Tue, 24 Apr 2007 12:01:40 +0530 [thread overview]
Message-ID: <20070424063139.GA22742@in.ibm.com> (raw)
In-Reply-To: <m18xcjznbm.fsf_-_@ebiederm.dsl.xmission.com>
On Sun, Apr 22, 2007 at 11:12:13PM -0600, Eric W. Biederman wrote:
>
> Currently because vmlinux does not reflect that the kernel is relocatable
> we still have to support CONFIG_PHYSICAL_START. So this patch adds a small
> c program to do what we cannot do with a linker script, set the elf header
> type to ET_DYN.
>
> This should remove the last obstacle to removing CONFIG_PHYSICAL_START
> on x86_64.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
[Dropping fastboot mailing list from CC as kexec mailing list is new list
for this discussion]
[..]
> +void file_open(const char *name)
> +{
> + if ((fd = open(name, O_RDWR, 0)) < 0)
> + die("Unable to open `%s': %m", name);
> +}
> +
> +static void mketrel(void)
> +{
> + unsigned char e_type[2];
> + if (read(fd, &e_ident, sizeof(e_ident)) != sizeof(e_ident))
> + die("Cannot read ELF header: %s\n", strerror(errno));
> +
> + if (memcmp(e_ident, ELFMAG, 4) != 0)
> + die("No ELF magic\n");
> +
> + if ((e_ident[EI_CLASS] != ELFCLASS64) &&
> + (e_ident[EI_CLASS] != ELFCLASS32))
> + die("Unrecognized ELF class: %x\n", e_ident[EI_CLASS]);
> +
> + if ((e_ident[EI_DATA] != ELFDATA2LSB) &&
> + (e_ident[EI_DATA] != ELFDATA2MSB))
> + die("Unrecognized ELF data encoding: %x\n", e_ident[EI_DATA]);
> +
> + if (e_ident[EI_VERSION] != EV_CURRENT)
> + die("Unknown ELF version: %d\n", e_ident[EI_VERSION]);
> +
> + if (e_ident[EI_DATA] == ELFDATA2LSB) {
> + e_type[0] = ET_REL & 0xff;
> + e_type[1] = ET_REL >> 8;
> + } else {
> + e_type[1] = ET_REL & 0xff;
> + e_type[0] = ET_REL >> 8;
> + }
Hi Eric,
Should this be ET_REL or ET_DYN? kexec refuses to load this vmlinux
as it does not find it to be executable type.
I am not well versed with various conventions but if I go through "Executable
and Linking Format" document, this is what it says about various file types.
• A relocatable file holds code and data suitable for linking with other
object files to create an executable or a shared object file.
• An executable file holds a program suitable for execution.
• A shared object file holds code and data suitable for linking in two
contexts. First, the link editor may process it with other relocatable and
shared object files to create another object file. Second, the dynamic
linker combines it with an executable file and other shared objects
to create a process image.
So above does not seem to fit in the ET_REL type. We can't relink this
vmlinux? And it does not seem to fit in ET_DYN definition too. We are
not relinking this vmlinux with another executable or other relocatable
files.
I remember once you mentioned the term dynamic executable which can be
loaded at a non-compiled address and let run without requiring any
relocation processing. This vmlinux will fall in that category but can't
relate it to standard elf file definitions.
Thanks
Vivek
next prev parent reply other threads:[~2007-04-24 6:33 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-30 8:05 2.6.21-rc5-mm3 Andrew Morton
2007-03-30 11:00 ` 2.6.21-rc5-mm3 Rafael J. Wysocki
2007-03-30 16:31 ` 2.6.21-rc5-mm3 Michal Piotrowski
2007-03-30 16:55 ` 2.6.21-rc5-mm3 Ingo Molnar
2007-03-30 17:19 ` 2.6.21-rc5-mm3 Michal Piotrowski
2007-03-30 16:38 ` 2.6.21-rc5-mm3 Dmitry Torokhov
2007-03-30 16:59 ` 2.6.21-rc5-mm3 Andrew Morton
2007-03-30 17:23 ` 2.6.21-rc5-mm3 Valdis.Kletnieks
2007-03-30 18:58 ` 2.6.21-rc5-mm3 Johannes Berg
2007-03-31 7:12 ` 2.6.21-rc5-mm3 - no boot, "address not 2M aligned" Helge Hafting
2007-03-31 7:53 ` Andrew Morton
2007-03-31 8:14 ` Eric W. Biederman
2007-04-09 22:09 ` Helge Hafting
2007-04-10 4:48 ` Helge Hafting
2007-04-01 5:29 ` thunder7
2007-04-01 6:15 ` Eric W. Biederman
2007-04-01 6:29 ` Andrew Morton
2007-04-02 7:41 ` Vivek Goyal
2007-04-02 8:43 ` Eric W. Biederman
2007-04-02 9:45 ` Vivek Goyal
2007-04-02 17:26 ` Eric W. Biederman
2007-04-03 4:01 ` Vivek Goyal
2007-04-03 5:23 ` Eric W. Biederman
2007-04-03 10:03 ` Vivek Goyal
2007-04-23 5:12 ` [PATCH 1/2] x86_64: Reflect the relocatability of the kernel in the ELF header Eric W. Biederman
2007-04-23 5:15 ` [PATCH 2/2] x86_64: Remove CONFIG_PHYSICAL_START and CONFIG_RELOCATABLE Eric W. Biederman
2007-04-23 6:07 ` Vivek Goyal
2007-04-23 6:17 ` Eric W. Biederman
2007-04-23 6:25 ` Vivek Goyal
2007-04-24 6:31 ` Vivek Goyal [this message]
2007-04-24 7:21 ` [PATCH 1/2] x86_64: Reflect the relocatability of the kernel in the ELF header Eric W. Biederman
2007-04-02 11:17 ` 2.6.21-rc5-mm3 - no boot, "address not 2M aligned" thunder7
2007-04-02 11:36 ` Vivek Goyal
2007-04-02 14:49 ` thunder7
2007-04-02 14:59 ` thunder7
2007-04-03 4:05 ` Vivek Goyal
2007-03-31 8:05 ` 2.6.21-rc5-mm3 - cpuidle, acpi, and C-states Valdis.Kletnieks
2007-03-31 19:25 ` 2.6.21-rc5-mm3: Why was my vioc cleanup patch dropped? Adrian Bunk
2007-03-31 20:48 ` [-mm patch] make drivers/ata/pata_ali.c:ali_tf_load() static Adrian Bunk
2007-04-01 16:21 ` Tejun Heo
2007-03-31 20:55 ` [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk Adrian Bunk
2007-03-31 21:05 ` Jeremy Fitzhardinge
2007-03-31 21:11 ` Adrian Bunk
2007-03-31 21:17 ` Jeremy Fitzhardinge
2007-03-31 20:55 ` [-mm patch] make drivers/net/qla3xxx.c:PHY_DEVICES[] static Adrian Bunk
2007-04-04 2:34 ` Jeff Garzik
2007-03-31 20:55 ` [-mm patch] make struct proc_fdinfo_file_operations static Adrian Bunk
2007-04-01 16:00 ` 2.6.21-rc5-mm3 Michal Piotrowski
2007-04-01 19:03 ` 2.6.21-rc5-mm3 Andrew Morton
2007-04-01 20:39 ` 2.6.21-rc5-mm3 Rafael J. Wysocki
2007-04-01 20:56 ` 2.6.21-rc5-mm3 Rafael J. Wysocki
2007-04-01 21:59 ` 2.6.21-rc5-mm3 Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2007-04-30 15:12 [PATCH 1/2] x86_64: Reflect the relocatability of the kernel in the ELF header Eric W. Biederman
2007-04-30 15:17 ` Andi Kleen
2007-05-01 3:55 ` Vivek Goyal
2007-05-01 4:20 ` Eric W. Biederman
2007-05-01 5:06 ` Vivek Goyal
2007-05-01 5:26 ` Eric W. Biederman
2007-05-01 6:25 ` Andi Kleen
2007-05-01 5:54 ` Eric W. Biederman
2007-05-01 6:44 ` Vivek Goyal
2007-05-28 10:54 ` Bernhard Walle
2007-05-28 11:09 ` Vivek Goyal
2007-05-28 14:39 ` Bernhard Walle
2007-06-01 12:26 ` Bernhard Walle
2007-05-28 14:57 ` Andi Kleen
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=20070424063139.GA22742@in.ibm.com \
--to=vgoyal@in.ibm.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=helgehaf@aitel.hist.no \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thunder7@xs4all.nl \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox