LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to edit a gzipped boot.img file without gunzipping it first... (http://www.linuxquestions.org/questions/programming-9/how-to-edit-a-gzipped-boot-img-file-without-gunzipping-it-first-728254/)

NiHao 05-24-2009 10:28 PM

How to edit a gzipped boot.img file without gunzipping it first...
 
(forgive me if I'm not using the correct terms, but here goes...)

I am trying to edit an .iso's "boot.img" file that is gzipped to "boot.gz". If I gunzip it, edit the boot.img file, and gzip it again, it doesn't work right (I get errors upon booting the .iso and it aborts).

All I did was change the menucolor text from "11,0" to "1,0" (from cyan to blue) without making any other changes.

I'm uncertain if there is a some form of checksum verification involved to confirm the boot.img file hasn't been tampered with before booting up.

Windows XP edit method:
I am using UltraISO to explore the .iso file, and then "view" the "boot.gz" file within the .iso using IZARC. IZARC permits using the text editor (notepad2) to view the boot.img file (gunzipped name of "boot.gz"). While viewing the boot.img file in notepad2 I am able to make the change from 11,0 to 1,0 then click "save" without any error messages or complaints from notepad2, but when I try to boot it shows the original cyan on black menucolors. I believe that this method does not actually save the change in the boot.img file.

OpenBSD edit method:
I extract the boot.gz file from the .iso using UltraISO in Windows, copy the boot.gz over to OpenBSD, then I gunzip the boot.gz file and edit it using vi in OpenBSD, making the same modification (changing 11,0 to 1,0) then gzip it back to boot.gz and add the modified file back into the .iso file (overwriting the original "boot.gz" file) using UltrISO in Windows. Upon booting the .iso it aborts after displaying system errors.
I believe this method actually does edit and save the change.

I am using OpenBSD because using WINGZ in Windows to gzip the file back to "boot.gz" won't rename the file the same as gzip in OpenBSD (WINGZ creates a "boot.img.gz" file that gunzips to "boot.img", or a "boot.gz" file that gunzips to "boot". Only OpenBSD gzips the file to "boot.gz" and gunzips it back to "boot.img").

Any help you can provide would be greatly appreciated.

Thank you in advance.

contusion 05-24-2009 11:49 PM

Mount the boot.img file
It is done by the following command.
mount -o loop boot.img /mnt
edit the file
And then unmount it.
umount /mnt

NiHao 05-25-2009 01:42 AM

Thank you for the prompt reply, but in order for me to get to the boot.img file, I'd have to gunzip it, and I'm trying to avoid doing that.

Or am I misunderstanding your direction?

I was able to edit the boot.img file using vi in OpenBSD without mounting it, but I had to gunzip it, then edit it, then gzip it again.

I heard there was a way to edit the file within an archive file without the need to extract the archive first.

Sergei Steshenko 05-25-2009 07:36 AM

Quote:

Originally Posted by NiHao (Post 3551719)
Thank you for the prompt reply, but in order for me to get to the boot.img file, I'd have to gunzip it, and I'm trying to avoid doing that.

Or am I misunderstanding your direction?

I was able to edit the boot.img file using vi in OpenBSD without mounting it, but I had to gunzip it, then edit it, then gzip it again.

I heard there was a way to edit the file within an archive file without the need to extract the archive first.


No, you can not edit any compressed file in any operating system.

Whenever you have an application which edits a compressed file for you, the application first uncompresses the file and edits the uncompressed copy.

syg00 05-25-2009 07:50 AM

Quote:

Originally Posted by Sergei Steshenko (Post 3551976)
No, you can not edit any compressed file in any operating system.

Of course you can.
Whether it will be any bloody use is a different issue ... ;)

Stop, stop - stop throwing them rocks ... :p

Sorry mate, couldn't resist.

contusion 05-25-2009 07:59 AM

Don't fear to about uncompressing gzip file. The tools of your system must not corrupt it.
try using gunzip instead of your archive tool.

NiHao 05-25-2009 08:42 PM

Thank you for your replies, I'll try using gunzipping it and yes, I do have a backup copy :-)...

Thanx!


All times are GMT -5. The time now is 09:11 AM.