Skip to contentSkip to conversation

Migrations to xorriso

DISCUSSION Thomas Schmitt 5 participants 9 messages May 19, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

would the following changes be acceptable for
grub-mkrescue ?

- Option --xorriso=PROGFILE allows to use a
particular binary as xorriso program.
This will avoid the need to install xorriso.
One can just unpack and build it in some
directory and use .../xorriso/xorriso
as binary.

- Option --diet saves about 400 kB of image
size without losing much benefit.

I attach an untested patch to illustrate the
intended changes.
If ok in principle, then i would do
beautifications and make some tests.

Nevertheless, a GRUB expert should make own
tests afterwards. So maybe Vladimir wants
to take it just as proposal for an own
more qualified change.

Have a nice day :)

Thomas

Signature · 2 lines
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
grub-mkrescue.in.ts renamed from grub-mkrescue.in +17 -1
@@ -38,6 +38,9 @@ efi32_dir=${libdir}/$(echo ${PACKAGE_TAR
 efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
 rom_directory=
 
+xorriso=xorriso
+diet=no
+
 # Usage: usage
 # Print the usage.
 usage () {
@@ -50,6 +53,8 @@ Make GRUB rescue image.
   --output=FILE           save output in FILE [required]
   --modules=MODULES       pre-load specified modules MODULES
   --rom-directory=DIR     save rom images in DIR [optional]
+  --xorriso=PROGFILE      use PROGFILE as xorriso program [optional]
+  --diet                  apply size reducing measures [optional]
 
 $0 generates a bootable rescue image with specified source files or directories.
 
@@ -78,6 +83,10 @@ for option in "$@"; do
 	PATH=${override_dir}:$PATH
 	export PATH
 	;;
+    --xorriso=*)
+	xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
+    --diet)
+	diet=yes ;;
     -*)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
@@ -254,7 +263,14 @@ if [ -e "${iso9660_dir}/boot/coreboot.el
 fi
 
 # build iso image
-xorriso -pathspecs on -as mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source}
+if [ "${diet}" = yes ]; then
+    if [ -e "${output_image}" ]; then
+        rm "${output_image}" || exit 1
+    fi
+    "${xorriso}" -report_about HINT -as mkisofs -graft-points -no-pad ${grub_mkisofs_arguments} --protective-msdos-label -r ${iso9660_dir} ${source} | cat >"${output_image}"
+else
+    "${xorriso}" -report_about HINT -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r ${iso9660_dir} ${source}
+fi
 rm -rf ${iso9660_dir}
 
 rm -f ${embed_img}
#1 lore raw
Quoted 9 lines · Thomas Schmitt

would the following changes be acceptable for
grub-mkrescue ?

- Option --xorriso=PROGFILE allows to use a
particular binary as xorriso program.
This will avoid the need to install xorriso.
One can just unpack and build it in some
directory and use .../xorriso/xorriso
as binary.

This is in line with other options already in GRUB utility scripts, so seems sensible.

Quoted 2 lines

- Option --diet saves about 400 kB of image
size without losing much benefit.

I don't have much of an opinion on this; but if it doesn't lose much, why would it not be the default? Or, put another way, why would somebody want to turn this option off?

Quoted 1 line

+ "${xorriso}" -report_about HINT -as mkisofs -graft-points -no-pad ${grub_mkisofs_arguments} --protective-msdos-label -r ${iso9660_dir} ${source} | cat >"${output_image}"

Useless use of cat.

Signature · 1 line
Colin Watson                                       [[email protected]]
#2 lore raw

Hi,

Quoted 4 lines
Quoted 2 lines

- Option --diet saves about 400 kB of image
size without losing much benefit.

If it doesn't lose much,
why would it not be the default?

Maybe one should revert the default and offer an option
--multi-session-toc
instead ?

Quoted 2 lines

Or, put another way, why would
somebody want to turn this option off?

I could want a bootable multi-session backup on USB stick with the opportunity to mount the backup state of two weeks ago.
For that i'd start with a rescue system created by grub-mkrescue, add my base backup as second session and daily updates as further sessions.

The extra 64 kB to 126 kB make sure that the older sessions of a multi-session ISO image can be detected and mounted. Useful with incremental backups on regular files, USB sticks, DVD+RW or BD-RE media.
But not so much of interest with a single session rescue image.

Without this extra space one can still add new sessions but will always see the youngest one as the only session of the image. (growisofs does it that way.)
If the first session ends up on sequential media (CD-R[W], DVD-R, DVD+R, BD-R) then further multi-session will be managed by the drive anyway.

Quoted 1 line

Useless use of cat.

Not in this case. xorriso calls fstat(2) to determine the semantics of the given output file. Option -o "${output_image}" or a redirection by >"${output_image}" would both reveil type S_IFREG.
But for the diet case i want S_ISCHR or S_IFIFO so that the output "media" appears as sequential rather than as overwriteable.

Have a nice day :)

Thomas

#4 lore raw
In reply to Colin Watson
Quoted 7 lines · Colin Watson
Quoted 2 lines · Thomas Schmitt

- Option --diet saves about 400 kB of image
size without losing much benefit.

I don't have much of an opinion on this; but if it doesn't lose much, why would it not be the default? Or, put another way, why would somebody want to turn this option off?

What size range are the whole images? For example, saving 400 kB off of 500 MB seems less useful than saving 400 kB off of 2 MB.

(Also I guess no one compresses whole ISOs so it needn't be asked how well the extra kilobytes compress.)

-Isaac

#5 lore raw

Hi,

Quoted 1 line · Isaac Dupree

What size range are the whole images?

The minimum output of grub-mkrescue 1.98 with xorriso is 1544192 bytes.

grub-mkisofs: 1550336
genisoimage:  1859584 (-307200 with -no-pad)

One may add lots of other files, of course.

Quoted 1 line

Also I guess no one compresses whole ISOs

It makes few sense to compress the ISO as a whole. But one could compress some files in it.

One could implement a reader for H. Peter Anvin's zisofs format in GRUB's ISO 9660 reader - if not present already.
zisofs is a transparent content compression of single files. A reader is implemented in the Linux kernel. See macro CONFIG_ZISOFS in fs/isofs/*.[ch].
An authorised description is given in doc/zisofs_format.txt of xorriso resp. in
http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/annotate/head:/doc/zisofs_format.txt
The ISO 9660 directory tree stays uncompressed. Compressed and uncompressed files can be mixed.

xorriso can produce zisofs compressed data files on the fly (needs zlib).
A grub-mkrescue 1.98 image with all files compressed has 884736 bytes. But one would have to leave those files uncompressed which are needed for reading ISO 9660 and zisofs compression.

Have a nice day :)

Thomas

#8 lore raw
In reply to Thomas Schmitt
Quoted 5 lines · Thomas Schmitt

Hi,

would the following changes be acceptable for grub-mkrescue ?

Quoted 8 lines

- Option --xorriso=PROGFILE allows to use a particular binary as xorriso program. This will avoid the need to install xorriso. One can just unpack and build it in some directory and use .../xorriso/xorriso as binary.

This can go in. I'll commit it when I have time.

I'm thinking to allow passing arbitrary options to xorriso by just putting it on command line.
Do you recommend to switching to native xorriso interface? It would allow to burn disk from grub-mkisofs by passing recording options to xorriso.

Quoted 8 lines

- Option --diet saves about 400 kB of image size without losing much benefit.

I attach an untested patch to illustrate the intended changes.
If ok in principle, then i would do beautifications and make some tests.

Quoted 6 lines

Nevertheless, a GRUB expert should make own tests afterwards. So maybe Vladimir wants to take it just as proposal for an own more qualified change.

This size saving matters only for floppies. Perhaps we should add an option --pcfloppy which will additionally disable all other platforms. Also I find the way of configuring with "| cat >" quite ugly. Is there a reason not to have an option for this behaviour?

Quoted 11 lines

Have a nice day :)

Thomas

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#6 lore raw
In reply to Thomas Schmitt
Quoted 35 lines · Thomas Schmitt

Hi,

Quoted 2 lines · Isaac Dupree

What size range are the whole images?

The minimum output of grub-mkrescue 1.98 with xorriso is 1544192 bytes.

grub-mkisofs: 1550336
genisoimage:  1859584 (-307200 with -no-pad)

One may add lots of other files, of course.

Quoted 2 lines

Also I guess no one compresses whole ISOs

It makes few sense to compress the ISO as a whole. But one could compress some files in it.

One could implement a reader for H. Peter Anvin's zisofs format in GRUB's ISO 9660 reader - if not present already.
zisofs is a transparent content compression of single files. A reader is implemented in the Linux kernel. See macro CONFIG_ZISOFS in fs/isofs/*.[ch].
An authorised description is given in doc/zisofs_format.txt of xorriso resp. in
http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/annotate/head:/doc/zisofs_format.txt
The ISO 9660 directory tree stays uncompressed. Compressed and uncompressed files can be mixed.

Quoted 9 lines

xorriso can produce zisofs compressed data files on the fly (needs zlib).
A grub-mkrescue 1.98 image with all files compressed has 884736 bytes. But one would have to leave those files uncompressed which are needed for reading ISO 9660 and zisofs compression.

I'm not sure that zisofs is useful for grub. We already have support for .gz files. xz support is coming. Compressing explicitly we would avoid to accidently compressing files we need uncompressed. Also we're more fs-independent.
Implementing zisofs reader may have some value but isn't a priority.

Quoted 11 lines

Have a nice day :)

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#3 lore raw
In reply to Thomas Schmitt
Quoted 6 lines · Thomas Schmitt

Hi,

Quoted 3 lines
Quoted 3 lines

- Option --diet saves about 400 kB of image
size without losing much benefit.

Quoted 10 lines
Quoted 3 lines

If it doesn't lose much,
why would it not be the default?

Maybe one should revert the default and offer an option
--multi-session-toc
instead ?

As said in another mail size saving matters only for floppy. Otherwise I prefer the most standard way possible

Quoted 21 lines
Quoted 4 lines

Or, put another way, why would
somebody want to turn this option off?

I could want a bootable multi-session backup on USB stick with the opportunity to mount the backup state of two weeks ago.
For that i'd start with a rescue system created by grub-mkrescue, add my base backup as second session and daily updates as further sessions.

The extra 64 kB to 126 kB make sure that the older sessions of a multi-session ISO image can be detected and mounted. Useful with incremental backups on regular files, USB sticks, DVD+RW or BD-RE media.
But not so much of interest with a single session rescue image.

Quoted 11 lines

Without this extra space one can still add new sessions but will always see the youngest one as the only session of the image. (growisofs does it that way.)
If the first session ends up on sequential media (CD-R[W], DVD-R, DVD+R, BD-R) then further multi-session will be managed by the drive anyway.

Puppy linux does that. I think it's sensible. However it's up to distributors and individual users whether to make advantage of such features.

Quoted 24 lines
Quoted 2 lines

Useless use of cat.

Not in this case. xorriso calls fstat(2) to determine the semantics of the given output file. Option -o "${output_image}" or a redirection by >"${output_image}" would both reveil type S_IFREG.
But for the diet case i want S_ISCHR or S_IFIFO so that the output "media" appears as sequential rather than as overwriteable.

Have a nice day :)

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#7 lore raw
In reply to Vladimir 'φ-coder/phcoder' Serbinenko

Quoting Vladimir 'φ-coder/phcoder' Serbinenko, who wrote the following on...:

Quoted 45 lines
Quoted 35 lines · Thomas Schmitt

Hi,

Quoted 2 lines · Isaac Dupree

What size range are the whole images?

The minimum output of grub-mkrescue 1.98 with xorriso is 1544192 bytes.

grub-mkisofs: 1550336
genisoimage:  1859584 (-307200 with -no-pad)

One may add lots of other files, of course.

Quoted 2 lines

Also I guess no one compresses whole ISOs

It makes few sense to compress the ISO as a whole. But one could compress some files in it.

One could implement a reader for H. Peter Anvin's zisofs format in GRUB's ISO 9660 reader - if not present already.
zisofs is a transparent content compression of single files. A reader is implemented in the Linux kernel. See macro CONFIG_ZISOFS in fs/isofs/*.[ch].
An authorised description is given in doc/zisofs_format.txt of xorriso resp. in
http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/annotate/head:/doc/zisofs_format.txt
The ISO 9660 directory tree stays uncompressed. Compressed and uncompressed files can be mixed.

Quoted 9 lines

xorriso can produce zisofs compressed data files on the fly (needs zlib).
A grub-mkrescue 1.98 image with all files compressed has 884736 bytes. But one would have to leave those files uncompressed which are needed for reading ISO 9660 and zisofs compression.

Quoted 5 lines

I'm not sure that zisofs is useful for grub. We already have support for .gz files. xz support is coming. Compressing explicitly we would avoid to accidently compressing files we need uncompressed. Also we're more fs-independent.
Implementing zisofs reader may have some value but isn't a priority.

For the record, Solaris uses a ISO9660 filesystem image with individual
compressed files, but this is mainly useful for being able to have a boot archive that grub2 does not have to completely decompress before loading into memory (so we get the benefit of a nearly-compressed filesystem image) without the overhead (taking the overhead on read operations). The value to grub2, though, is unknown.

--S