Hello,
I have a vmlinux ELF image which includes the initramfs image which I
would like to modify.
In order to do that, at the beginning I extract this image according
memory map returned by objdump utility. Obtained initramfs is proper, so
I make some modification and write it back. After that I try to replace
the .init.ramfs section's data of vmlinux file using objcopy tool. The
final vimlinux image seems ok, but it causes the reset during booting
process.
Is my approach correct to achieve desired result? Maybe is there more
proper way to make some modification of vmlinux image's initramfs.
Thank you in advance for you engagement,
--
Piotr Piwko
http://www.embedded-egnineering.pl/
|
|
0
|
|
|
|
Reply
|
Piotr
|
10/20/2010 10:53:16 AM |
|
On Wed, 20 Oct 2010 12:53:16 +0200, Piotr Piwko wrote:
> Hello,
>
> I have a vmlinux ELF image which includes the initramfs image which I
> would like to modify.
>
> In order to do that, at the beginning I extract this image according
> memory map returned by objdump utility. Obtained initramfs is proper, so
> I make some modification and write it back. After that I try to replace
> the .init.ramfs section's data of vmlinux file using objcopy tool. The
> final vimlinux image seems ok, but it causes the reset during booting
> process.
>
> Is my approach correct to achieve desired result? Maybe is there more
> proper way to make some modification of vmlinux image's initramfs.
>
> Thank you in advance for you engagement,
>
The kernel source is available, so there is no need to resort to
decompiling the object code. However, that may also be unnecessary. The
Linux startup procedure is somewhat distribution dependent, but generally
modern kernels are loaded by the bootloader, and probably use an initrd
to aid final startup.
There are a couple of good sources documenting startup, including
http://tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html
http://tldp.org/HOWTO/Bootdisk-HOWTO/index.html
They are a little out of date, but still generally correct.
--
Douglas Mayne
|
|
0
|
|
|
|
Reply
|
Douglas
|
10/20/2010 2:51:29 PM
|
|
Piotr Piwko <piotr.piwko@embedded-engineering.pl> wrote:
> Hello,
>
> I have a vmlinux ELF image which includes the initramfs image which I
> would like to modify.
>
> In order to do that, at the beginning I extract this image according
> memory map returned by objdump utility. Obtained initramfs is proper, so
> I make some modification and write it back. After that I try to replace
> the .init.ramfs section's data of vmlinux file using objcopy tool. The
> final vimlinux image seems ok, but it causes the reset during booting
> process.
>
> Is my approach correct to achieve desired result? Maybe is there more
> proper way to make some modification of vmlinux image's initramfs.
>
> Thank you in advance for you engagement,
>
Use an initrd. An initrd will get merged with the initramfs that's
built into the kernel. Files in the initrd replace the same files in
the initramfs.
Jerry
|
|
0
|
|
|
|
Reply
|
Jerry
|
10/20/2010 8:36:22 PM
|
|
On 10/20/2010 10:36 PM, Jerry Peters wrote:
> Use an initrd. An initrd will get merged with the initramfs that's
> built into the kernel. Files in the initrd replace the same files in
> the initramfs.
Unfortunately, I cannot do that. My project depends on the initramfs
which should be modified and written back to the single vmlinux object file.
Anyway thanks for your hint,
--
Piotr Piwko
http://www.embedded-engineering.pl/
|
|
0
|
|
|
|
Reply
|
Piotr
|
10/21/2010 6:30:19 AM
|
|
On 10/20/2010 04:51 PM, Douglas Mayne wrote:
> The kernel source is available, so there is no need to resort to
> decompiling the object code. However, that may also be unnecessary. The
> Linux startup procedure is somewhat distribution dependent, but generally
> modern kernels are loaded by the bootloader, and probably use an initrd
> to aid final startup.
Yes, I thought about initrd, but this approach is out of my project
specification which requires the modification of initramfs image.
Thank you for your answer,
--
Piotr Piwko
http://www.embedded-engineering.pl/
|
|
0
|
|
|
|
Reply
|
Piotr
|
10/21/2010 6:36:18 AM
|
|
In article <i9omm9$t0g$1@news.eternal-september.org>,
Piotr Piwko <piotr.piwko@embedded-engineering.pl> wrote:
>On 10/20/2010 10:36 PM, Jerry Peters wrote:
>> Use an initrd. An initrd will get merged with the initramfs that's
>> built into the kernel. Files in the initrd replace the same files in
>> the initramfs.
>
>Unfortunately, I cannot do that. My project depends on the initramfs
>which should be modified and written back to the single vmlinux object file.
>
>Anyway thanks for your hint,
This thread illustates a well-known problem with the Usenet. You need
to have a solution that fits your work-environment, but the people
answering your question get fixated on the idea that they know better
than you how to solve your problem. So, they insist on giving the
answer that they know, in their heart of hearts, is the right answer.
Unfortunately, that answer, right as it may be, in theory, is, alas, of
no use to you.
--
Is God willing to prevent evil, but not able? Then he is not omnipotent.
Is he able, but not willing? Then he is malevolent.
Is he both able and willing? Then whence cometh evil?
Is he neither able nor willing? Then why call him God?
~ Epicurus
|
|
0
|
|
|
|
Reply
|
gazelle
|
10/21/2010 7:19:18 AM
|
|
Kenny McCormack <gazelle@shell.xmission.com> wrote:
> In article <i9omm9$t0g$1@news.eternal-september.org>,
> Piotr Piwko <piotr.piwko@embedded-engineering.pl> wrote:
>>On 10/20/2010 10:36 PM, Jerry Peters wrote:
>>> Use an initrd. An initrd will get merged with the initramfs that's
>>> built into the kernel. Files in the initrd replace the same files in
>>> the initramfs.
>>
>>Unfortunately, I cannot do that. My project depends on the initramfs
>>which should be modified and written back to the single vmlinux object file.
>>
>>Anyway thanks for your hint,
>
> This thread illustates a well-known problem with the Usenet. You need
> to have a solution that fits your work-environment, but the people
> answering your question get fixated on the idea that they know better
> than you how to solve your problem. So, they insist on giving the
> answer that they know, in their heart of hearts, is the right answer.
Gee, can you read? Where in the *original* post did he list any
restrictions? You seem to be the one jumping to unfounded conclusions
*and* not contributing anything to the thread.
Absent such restrictions, I gave him a reasonable answer. Many people
don't know that an initrd gets merged into the initramfs.
Jerry
>
> Unfortunately, that answer, right as it may be, in theory, is, alas, of
> no use to you.
>
|
|
0
|
|
|
|
Reply
|
Jerry
|
10/21/2010 9:02:16 PM
|
|
Piotr Piwko <piotr.piwko@embedded-engineering.pl> wrote:
> On 10/20/2010 10:36 PM, Jerry Peters wrote:
>> Use an initrd. An initrd will get merged with the initramfs that's
>> built into the kernel. Files in the initrd replace the same files in
>> the initramfs.
>
> Unfortunately, I cannot do that. My project depends on the initramfs
> which should be modified and written back to the single vmlinux object file.
>
> Anyway thanks for your hint,
>
I believe that the size of the initramfs is embedded into the kernel.
If you're changing the size, perhaps that's why it's not working.
You might inquire on LKML about what you're trying to do, some of the
kernel developers can tell you what needs to be done.
Jerry
|
|
0
|
|
|
|
Reply
|
Jerry
|
10/21/2010 9:07:31 PM
|
|
|
7 Replies
300 Views
(page loaded in 0.309 seconds)
Similiar Articles:7/24/2012 11:20:10 AM
|