LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-24-2009, 10:28 PM   #1
NiHao
LQ Newbie
 
Registered: May 2009
Posts: 6

Rep: Reputation: 0
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.
 
Old 05-24-2009, 11:49 PM   #2
contusion
Member
 
Registered: Mar 2005
Posts: 310

Rep: Reputation: 34
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
 
Old 05-25-2009, 01:42 AM   #3
NiHao
LQ Newbie
 
Registered: May 2009
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 05-25-2009, 07:36 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by NiHao View Post
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.
 
Old 05-25-2009, 07:50 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,137

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
Quote:
Originally Posted by Sergei Steshenko View Post
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 ...

Sorry mate, couldn't resist.
 
Old 05-25-2009, 07:59 AM   #6
contusion
Member
 
Registered: Mar 2005
Posts: 310

Rep: Reputation: 34
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.
 
Old 05-25-2009, 08:42 PM   #7
NiHao
LQ Newbie
 
Registered: May 2009
Posts: 6

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

Thanx!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I edit the initrd.img in the RHEL 5.1 boot disk? Ken B Red Hat 6 07-18-2008 08:34 AM
Floppy boot disk *.img file dherve Suse/Novell 1 08-31-2005 01:49 PM
Suse boot.img file dherve Linux - Software 6 08-30-2005 04:50 AM
How can i edit K3B's img images? Braveheart1980 Linux - Software 10 02-20-2004 01:37 AM
How to Edit .img files safrout Linux - Software 2 08-13-2003 07:54 AM


All times are GMT -5. The time now is 08:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration