Editing ISO files.
#1
Posted 01 September 2010 - 03:29 PM
I want to edit ISO files ie deleting or adding some files to it.
My general procedure is :
1) Extract ISO file in a folder and then delete/add files in it .
2) Use mkisofs.exe to recreate ISO file.
My aim is to recreate the ISO file with exact specification( joliet , rockridge etc.) as the original file.
How should i decide options for mkisofs.exe so that specification are same for original and recreated ISO file.
Also how should i find the parameter for -b option ( ie booti image file).
#2
Posted 01 September 2010 - 04:34 PM
i am not sure if this is the right group to post , so moderators please move this to appropriate group
I want to edit ISO files ie deleting or adding some files to it.
My general procedure is :
1) Extract ISO file in a folder and then delete/add files in it .
2) Use mkisofs.exe to recreate ISO file.
My aim is to recreate the ISO file with exact specification( joliet , rockridge etc.) as the original file.
How should i decide options for mkisofs.exe so that specification are same for original and recreated ISO file.
Also how should i find the parameter for -b option ( ie booti image file).
Since this is ProjectForge "This section is dedicated to freeware or open source works where popular projects get their own section." the idea was/is that people posts here Releases of their projects.
I presume that we don't actually have a section suitable for your request , unless it goes to the <whatever system you run> section.
mkisofs (unlike most people tend to think) is NOT a "stand-alone" program, it is part of a suite of tools that goes under the name of CDRECORD/CDRTOOLS:
http://cdrecord.berl...e/cdrecord.html
isoinfo is another of the tools, and may give you part of what you need/want
iat:
http://www.ohloh.net...0 Analyzer Tool
is another tool that gives some info.
Good old CDmage will also give some info:
http://www.softpedia...s/CD-Mage.shtml
But AFAIK none of them will give you all what you want/need.
Maybe it would be time for such an utility, that does exactly what you describe, i.e. it could be a nice idea for anyone willing to write an useful program.
I'll see if I can find anything else, but don't count too much on such an app being already developed and being not already "famous".
I am not sure to undestand the question.Also how should i find the parameter for -b option ( ie booti image file).
There are THREE bootable kinds of CD's:
- floppy emulation
- hard disk emulation
- no-emulation
- will be either a 1.44 floppy size 1474560 bytes OR a 2.88 floppy size 2949120 bytes
- will be a much bigger image
- will be a very small file, typically 2048 or 4096 bytes long (but, as an example, grldr is bigger than this)
Also, check:
http://www.nu2.nu/bbie/
Wonko
#3
Posted 01 September 2010 - 05:35 PM
i will try softwares you mentioned.
I am not sure to undestand the question.
My question is how to find , which boot-image file was used to make the ISO file bootable.
Like in case of ISO files , where isolinux is used , isolinux.bin is used as boot-image file.
In case of grub4dos grldr is used.
In above two case i can guess the boot-image files(isolinux.bin & grldr) because i am already familiar with the grub4dos and isolinux.
But what if there is some obscure boot loader was used to create the ISO file. how can i find the boot-image file?
Basically if i am recreating a ISO file , first of all , i have to find out the boot-image file used to create that ISO file and then use that boot-image file as a option(-b boot-image file) for mkisofs.exe.
#4
Posted 01 September 2010 - 06:59 PM
But what if there is some obscure boot loader was used to create the ISO file. how can i find the boot-image file?
This quick trick works mainly on non-UDF ISO
(Windows 7 distro -- won't show)
#5
Posted 01 September 2010 - 07:16 PM
Basically if i am recreating a ISO file , first of all , i have to find out the boot-image file used to create that ISO file and then use that boot-image file as a option(-b boot-image file) for mkisofs.exe.
As said with CDMAGE, 7-ZIP (as suggested by voyajer) or many other applications.
Point is rather WHICH other parameter you will give to mkisofs.
Follow me, IF boot image:
- is EITHER 1474560 OR 2949120 bytes it is a floppy emulation image (mostly used by DOS/Win9x thingies)
- is BIGGER than 2949120 bytes it is a Hard disk emulation image (rare)
- is 2048, 4096 it is a "common" no-emuation bootsector (like MS ones respectively for 2K/XP/2003 and for Vista :w00t:/2008/7) OR is anything BIGGER than 4096 BUT SMALLER than 1474560, it a a no-emulation bootsector as well, BUT using an "obscure loader" (which includes isolinux and grub4dos )
- you need NOT any particular option (apart from -b <bootimage>)
- you need -hard-disk-boot -b <bootimage>
- you need -no-emul-boot -b <bootimage>
I hope now it is more clear.
Wonko
#6
Posted 01 September 2010 - 10:39 PM
For example consider a ISO file created using isolinux.bin. Now size of isolinux.bin is about 14KB.
But when i extract the boot-image file from this ISO file , using 7-zip or bbie , I only get 2KB boot-image file. Same for a ISO file created with GRUB2.
when i recreated ISO files using these extracted 2KB boot-image files (for both isolinux & grub2) and tried to boot the CD , it hangs.
you need NOT any particular option (apart from -b <bootimage>)
there's another troublesome option -boot-info-table.
Like isolinux.bin will give checksum error if this option is not used , but it is not needed in grub4dos.
what happens if i use this option for grub4dos(or for any other obscure bootloader which do not requires this option)?will it break the bootloader?
#7
Posted 01 September 2010 - 11:20 PM
An hour of search for Freeware tools, and I found it! It's Linux version of ISO Master, available in beloved of all Parted Magic
Check it, please. It can work with bootloader too, not only show.
#8
Posted 02 September 2010 - 05:02 AM
Iso-master is extracting complete boot-image file ( 14 KB(isolinux.bin) in case of isolunux and 24 KB(grub_eltorito) in case of grub2).
i have tested the extracted boot-image files and they are working fine.
Is there any command-line alternative of ISO-MASTER for windows?
Also , It is to be noted here that i have to use -boot-info-table option for grub2 , otherwise bootloader just hangs.So this option has to be taken care of while recreating ISO files.
#9
Posted 02 September 2010 - 07:55 AM
#10
Posted 02 September 2010 - 08:14 AM
Mind you I never said to use 7-zip to EXTRACT the image, what I said was that it can be used to view it's size.problem with 7-zip and other tools is that they extract only the first 4 sectors(2KB) of the boot-image file.
Is there any command-line alternative of ISO-MASTER for windows?
Also, check:
http://www.nu2.nu/bbie/
One can use bbie from bart's site http://www.nu2.nu/ to drag out the boot image (of whatever form).
Wonko
#11
Posted 02 September 2010 - 09:08 AM
Also, check:
http://www.nu2.nu/bbie/
Wonko
One can use bbie from bart's site http://www.nu2.nu/ to drag out the boot image (of whatever form).
But when i extract the boot-image file from this ISO file , using 7-zip or bbie , I only get 2KB boot-image file. Same for a ISO file created with GRUB2.
As i already said bbie just extracts only 2KB from boot-image file , unlike ISO-MASTER which extracts complete boot-image file(14 KB for isolinux.bin and 24 KB for grub2).
#12
Posted 02 September 2010 - 09:16 AM
As i already said bbie just extracts only 2KB from boot-image file , unlike ISO-MASTER which extracts complete boot-image file(14 KB for isolinux.bin and 24 KB for grub2).
Strange, I seemed to remember that bbie worked . Sorry for misleading you.
There must be another utility then, as I am pretty sure I somehow did it on command line under 2K.
I'll see if I can find it/remember what it was.
Maybe it was this one
http://www.codeproje...ootExtract.aspx
Wonko
#13
Posted 02 September 2010 - 10:49 AM
Nope !Maybe it was this one
http://www.codeproje...ootExtract.aspx
Wonko
This , too , belongs to 2KB squadron.
#14
Posted 02 September 2010 - 11:22 AM
Nope !
This , too , belongs to 2KB squadron.
Can you post a link to a (possibly smallish) .ISO that contains such a bootsector? (and that doesn't work with the mentioned tools)
Maybe the problem is in the .iso file itself.
I am suspecting that, (check this):
http://odin.himinbi....extraction.html
some data in the actual .iso "misleads" the extracting programs.
Maybe it could be related to the known :
-boot-load-size 4vs.
-boot-load-seg 0x1000http://www.911cd.net...showtopic=20864
I never got around to actually understand what it is about exactly.
Wonko
#15
Posted 02 September 2010 - 01:04 PM
Can you post a link to a (possibly smallish) .ISO that contains such a bootsector? (and that doesn't work with the metioned tools)
Heres the situation.
i am trying to recreate slitaz-3.0.iso(which uses isolinux.bin as boot loader).
By using BootExtract.exe , i get the boot-image file named slitaz-3.0.iso.NoEmulation__Segment-0000__SecCount-4.bin. Now this extracted boot-image file is of size 2KB and is exactly the same as the first 4 sectors of isolinux.bin.
Now i recreate the iso file by using mkisofs.exe:
mkisofs.exe -b slitaz-3.0.iso.NoEmulation__Segment-0000__SecCount-4.bin -no-emul-boot -boot-info-table -o slitaz.iso slitaz-3.0
when i boot this recreated ISO file it hangs with following written on screen:
ISOLINUX 3.82 2009-06-09 ETCD
Maybe the problem is in the .iso file itself.
Let me first clear a doubt . if my original boot-image file has size 14 KB(isolinux.bin).
And my extracted boot-image file has size 2 KB(which is basically just first 4 sectors of original boot-image file).
And then i recreate this ISO with this "extracted boot-image file" . would this recreated ISO will work?
#16
Posted 02 September 2010 - 01:26 PM
It is only the first sector of isolinux.bin . CD sectors are 2048 bytes and are not 512 bytes like the usual value for hard/floppy disk sectors (some hard disk alredy moved to 4096 bytes sectors internally).Now this extracted boot-image file is of size 2KB and is exactly the same as the first 4 sectors of isolinux.bin.
No, your ISO won't work. You need the isolinux.bin file as filename for the -b parameter. mkisofs will put the first 2048 bytes of isolinux at the 'boot sector' of the CD (if you specify '-boot-load-size 4' (which uses 512 bytes blocks, not sure why) = 512*4).Now i recreate the iso file by using mkisofs.exe:
mkisofs.exe -b slitaz-3.0.iso.NoEmulation__Segment-0000__SecCount-4.bin -no-emul-boot -boot-info-table -o slitaz.iso slitaz-3.0
Let me first clear a doubt . if my original boot-image file has size 14 KB(isolinux.bin).
And my extracted boot-image file has size 2 KB(which is basically just first 4 sectors of original boot-image file).
And then i recreate this ISO with this "extracted boot-image file" . would this recreated ISO will work?
The -boot-info-table option patches some bytes in this boot block: LBA address (offset in the iso9660 image) of the boot file (isolinux.bin), filesize of isolinux.bin, checksum of the boot file, ... So mkisofs NEEDS to know where the boot file (isolinux.bin) is located on the iso9660 filesystem.
When the -boot-info-table option is given, mkisofs will modify the boot file specified by the -b option by inserting a 56-byte "boot information table" at offset 8 in the file. This modification is done in the source filesystem, so make sure you use a copy if this file is not easily recreated! This file contains pointers which may not be easily or reli- ably obtained at boot time. The format of this table is as follows; all integers are in section 7.3.1 ("little endian") format. Offset Name Size Meaning 8 bi_pvd 4 bytes LBA of primary volume descriptor 12 bi_file 4 bytes LBA of boot file 16 bi_length 4 bytes Boot file length in bytes 20 bi_csum 4 bytes 32-bit checksum 24 bi_reserved 40 bytes Reserved The 32-bit checksum is the sum of all the 32-bit words in the boot file starting at byte offset 64. All linear block addresses (LBAs) are given in CD sectors (normally 2048 bytes).
#17
Posted 02 September 2010 - 02:03 PM
There is: "El Torito" Bootable CD-ROM Format Specification
http://en.wikipedia....D-ROM_standard)
http://web.archive.o.../specscdrom.pdf
Figure 4:
Sector Count. This is the number of virtual/emulated sectors the system
will store at Load Segment during the initial boot procedure.
According to "El Torito" there are 512 bytes per virtual/emulated sector.
A BIOS should load sectors count to RAM.
However there are BIOS limitatons : sector count may fail at some BIOS.
Loading 4 virtual sectors works always.
Isolinux support this broken BIOS too.
Set sctors count to 4, load 4 virtual sectors to RAM:
First loaded part search whole file at CD.
bbie extracts boot image according to boot catalog: 4 virtual sectors.
Some applications does detect isolinux nowadays.
IsoBuster does detect whole file. Free version read file system ISO9660 and Rock Ridge.
As for isolinux:
Read boot catalog, remember boot image LBA.
And search file with the same LBA: should be isolinux.bin.
Then copy file isolinux.bin at file system level.
#18
Posted 02 September 2010 - 02:20 PM
But not the requested example link.Heres the situation.
Wonko
#19
Posted 02 September 2010 - 02:39 PM
#20
Posted 02 September 2010 - 03:08 PM
http://mirror.slitaz.../slitaz-3.0.iso
just only 30MB.
Good.
This is exactly one of those "strange" images.
It's first sector (sector 0) contains a MBR allright.
This is not part of "normal" ISO.
The "88 00 00 00 00 00 04 00" is at offset 65568 dec. (32x2048+32)
If a programs checks this, I presume it will extract only 4 x 512 bytes sectors of the actual boot image. (EDIT: it does )
The actual isolinux seems like starting at offset 67584 (33x2048) and go on for 7 sectors, since at offset 81920 (40*2048) starts a slitax XHTML.
If you hex edit "88 00 00 00 00 00 04 00" to "88 00 00 00 00 00 1C 00" bootextract will extract the whole thing. (but cannot say if it will work as bootsector).
Wonko
#21
Posted 02 September 2010 - 03:49 PM
isoinfo -d -i \slitaz-3.0.iso
Sectors to load: 4El Torito VD version 1 found, boot catalog is in sector 32
NO Joliet present
Rock Ridge signatures version 1 found
Eltorito defaultboot header:
Bootid 88 (bootable)
Boot media 0 (No Emulation Boot)
Load segment 0
Sys type 0
Nsect 4
Bootoff 21 33
Bootimage is at LBA 33
The ISO use Rock Ridge extension and no Jolet file system.
isoinfo -l -i \slitaz-3.0.iso
There is a ISO9660 file name "ISOLINUX.BIN;1" at LBA 33.Directory listing of /BOOT/ISOLINUX/
---------- 0 0 0 14336 Jun 9 2009 [ 33 00] ISOLINUX.BIN;1
;1 is the file version according to ISO9660. Purchable at http://www.iso.org/
Ecma 119 is also approved as ISO 9660. http://www.ecma-inte...ds/Ecma-119.htm
Extract file /BOOT/ISOLINUX/ISOLINUX.BIN;1 to a new file bootimage.bin
isoinfo -x /BOOT/ISOLINUX/ISOLINUX.BIN;1 -i \slitaz-3.0.iso > bootimage.bin
In addition: LBA 0 describe a hybrid hard disk mode.
http://syslinux.zyto...hp/Doc/isolinux
#22
Posted 02 September 2010 - 03:54 PM
If you hex edit "88 00 00 00 00 00 04 00" to "88 00 00 00 00 00 1C 00" bootextract will extract the whole thing. (but cannot say if it will work as bootsector).
Wonko
YES!
After Hex-editing the ISO file , BOOTEXTRACT is extracting complete boot-image file(14KB).
And i recreated the ISO using that extracted image file. its working fine!
#23
Posted 02 September 2010 - 04:14 PM
YES!
After Hex-editing the ISO file , BOOTEXTRACT is extracting complete boot-image file(14KB).
And i recreated the ISO using that extracted image file. its working fine!
Good .
Obviously the hex edit I suggested is a quick and dirty workaround, cdob gave you the "right" method.
Now check a parted magic .iso image, I checked an old version 4.0 I had around and latest 5.4.
Open them in a hex editor and search for string "MKI", you should be able to find easily:
pmagic 4.0:
and in pmagic 5.4:MKI Sat Apr 4 07:16:05 2009
2.01.01a57 -R -b grldr -no-emul-boot -boot-load-size 4 -o pmagic-svn.iso current
(there is no such info in slitaz)MKI Wed Aug 25 16:55:37 2010
2.01.01a78 -R -l -D -b boot/isolinux/isolinux.bin -o pmagic-5.4.iso -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V Parted Magic current
This means that good developers/guys can also actually "embed" in the .iso the actual info about the EXACT command parameters they used , too bad that this use is not very common .
Wonko
#24
Posted 02 September 2010 - 04:39 PM
Now check a parted magic .iso image, I checked an old version 4.0 I had around and latest 5.4.
Open them in a hex editor and search for string "MKI", you should be able to find easily:
Wonko
yup!
parted magic-5.0
MKI Sun Jul 11 18:22:34 2010.2.01.01a78 -R -l -D -b boot/isolinux/isolinux.bin -o pmagic-5.0.iso -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V Parted Magic current
Good .
Obviously the hex edit I suggested is a quick and dirty workaround, cdob gave you the "right" method.
Wonko
I Agree. Method by cdob can be used as a sure shot method to get boot-image file.
Method by cdob in simple steps: 1) use ISOINFO.EXE to find LBA of boot-image file. 2) find the path of boot-image file using LBA. 3) extarct the boot image file.
May be we can write some script to do all above steps automatically.
Thanks a lot cdob!
#25
Posted 02 September 2010 - 05:44 PM
May be we can write some script to do all above steps automatically.
Sure, the only problem is that different versions/builds may have a different output.
If we use these:
http://www.student.t...t/thomas.plank/
cdrtools-3.00-win32-bin.zip
(which should be "latest")
It can be done.
Give me some time....
Wonko
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users