[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using isohybrid for usb bootable isos



Attached patch stack handles everything on the d-i side, except firmware
(see next post). It makes the mini.iso hybrid and updates the manual to
document writing it to a USB stick, instead of its prior hand-waving
about assembling a netboot USB stick manually.

I've tested the mini.iso boots (from USB and as a CD), but nothing else.

-- 
see shy jo
From 2a4f550612a16a1911284a918f32630e275bef31 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 13 Sep 2010 19:57:09 -0400
Subject: [PATCH 1/5] Run isohybrid on i386 and amd64 miniiso, which allows it to be written directly to and booted from a USB stick.

---
 installer/build/config/x86.cfg |    2 ++
 installer/debian/changelog     |    7 +++++++
 installer/debian/control       |    6 +++---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/installer/build/config/x86.cfg b/installer/build/config/x86.cfg
index e98467d..4a0a005 100644
--- a/installer/build/config/x86.cfg
+++ b/installer/build/config/x86.cfg
@@ -278,6 +278,8 @@ arch_miniiso: x86_syslinux
 	genisoimage -r -J -b isolinux.bin -c boot.cat \
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
 		-o $(TEMP_MINIISO) $(TEMP_CD_TREE)
+	
+	isohybrid $(TEMP_MINIISO)
 
 # Netboot files
 .PHONY: arch_netboot_dir
diff --git a/installer/debian/changelog b/installer/debian/changelog
index d3820df..2e67006 100644
--- a/installer/debian/changelog
+++ b/installer/debian/changelog
@@ -1,3 +1,10 @@
+debian-installer (20100913) UNRELEASED; urgency=low
+
+  * Run isohybrid on i386 and amd64 miniiso, which allows it to be written
+    directly to and booted from a USB stick. 
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 13 Sep 2010 19:56:39 -0400
+
 debian-installer (20100912) unstable; urgency=low
 
   * Skip last translation changes for rescue and debian-installer-
diff --git a/installer/debian/control b/installer/debian/control
index 886120b..9e9f20d 100644
--- a/installer/debian/control
+++ b/installer/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.8.3
 Vcs-Svn: svn://svn.debian.org/d-i/trunk/installer
 Build-Conflicts: libnewt-pic [mipsel]
 # NOTE: Do not edit the next line by hand. See comment below.
-Build-Depends: debhelper (>= 7.0.0), apt, apt-utils, gnupg, debian-archive-keyring (>= 2006.11.22), dctrl-tools, wget, bc, debiandoc-sgml, xsltproc, docbook-xml, docbook-xsl, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], glibc-pic, libslang2-pic (>= 2.0.6-4), libnewt-pic (>= 0.52.2-11.3) [!mipsel], libnewt-dev (>= 0.52.2-11.3) [mipsel], libgcc1 [i386 amd64], cramfsprogs [powerpc ia64 mips mipsel armeb armel], genext2fs (>= 1.3-7.1), e2fsprogs, mklibs (>= 0.1.25), genisoimage [!s390 !s390x], genromfs [sparc sparc64], hfsutils [powerpc], dosfstools [i386 ia64 m68k amd64], cpio, devio [armeb armel], slugimage (>= 0.10+r58-6) [armeb armel], dns323-firmware-tools [armel], uboot-mkimage [armel], syslinux (>= 2:3.63+dfsg-2) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc sparc64], genisovh [mips], tip22 [mips], colo [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], emile [m68k], emile-bootblocks [m68k], apex-nslu2 [armeb armel], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386], module-init-tools [i386 armeb armel amd64 alpha hppa ia64 m68k mips mipsel powerpc s390 sh4 sparc sparc64], bf-utf-source [!s390 !s390x], mkvmlinuz [powerpc], openssl [armel], win32-loader [i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386], makefs [kfreebsd-i386 kfreebsd-amd64], grub-pc (>= 1.98~20100101-1) [kfreebsd-i386 kfreebsd-amd64 hurd-i386], xorriso [kfreebsd-i386 kfreebsd-amd64 hurd-i386], debian-ports-archive-keyring [sh4 sparc64]
+Build-Depends: debhelper (>= 7.0.0), apt, apt-utils, gnupg, debian-archive-keyring (>= 2006.11.22), dctrl-tools, wget, bc, debiandoc-sgml, xsltproc, docbook-xml, docbook-xsl, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], glibc-pic, libslang2-pic (>= 2.0.6-4), libnewt-pic (>= 0.52.2-11.3) [!mipsel], libnewt-dev (>= 0.52.2-11.3) [mipsel], libgcc1 [i386 amd64], cramfsprogs [powerpc ia64 mips mipsel armeb armel], genext2fs (>= 1.3-7.1), e2fsprogs, mklibs (>= 0.1.25), genisoimage [!s390 !s390x], genromfs [sparc sparc64], hfsutils [powerpc], dosfstools [i386 ia64 m68k amd64], cpio, devio [armeb armel], slugimage (>= 0.10+r58-6) [armeb armel], dns323-firmware-tools [armel], uboot-mkimage [armel], syslinux (>= 2:4.02) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc sparc64], genisovh [mips], tip22 [mips], colo [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], emile [m68k], emile-bootblocks [m68k], apex-nslu2 [armeb armel], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386], module-init-tools [i386 armeb armel amd64 alpha hppa ia64 m68k mips mipsel powerpc s390 sh4 sparc sparc64], bf-utf-source [!s390 !s390x], mkvmlinuz [powerpc], openssl [armel], win32-loader [i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386], makefs [kfreebsd-i386 kfreebsd-amd64], grub-pc (>= 1.98~20100101-1) [kfreebsd-i386 kfreebsd-amd64 hurd-i386], xorriso [kfreebsd-i386 kfreebsd-amd64 hurd-i386], debian-ports-archive-keyring [sh4 sparc64]
 # This package has the worst Build-Depends in Debian, so it deserves some
 # explanation. Note that this comment can also be used to generate a
 # Build-Depends line, by running the debian/genbuilddeps program.
@@ -99,8 +99,8 @@ Build-Depends: debhelper (>= 7.0.0), apt, apt-utils, gnupg, debian-archive-keyri
 #	On many arches boot loaders are copied onto or ran on the boot
 #	images in one way or another. There's a reason our mailing list is
 #	still called debian-boot..
-#	- syslinux (>= 2:3.63+dfsg-2) [i386 amd64]
-#		With menu default64 support.		
+#	- syslinux (>= 2:4.02) [i386 amd64]
+#		With isohybrid.
 #	- palo [hppa]
 #	- elilo [ia64]
 #	- yaboot [powerpc]
-- 
1.7.1

From e4f52d1b882d034ed3a8797f7f60654fd804a088 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 13 Sep 2010 20:23:25 -0400
Subject: [PATCH 2/5] Update USB stick documentation to reflect isohybird mini.iso files, as generated by debian-installer >= 20100913.

This is very suboptimal, the USB stuff is a dreadful mess and needs a
complete rewrite, but hopefully isohybrid full CD images will obsolte it
later.
---
 manual/debian/changelog                      |    4 ++
 manual/en/install-methods/boot-usb-files.xml |   39 +++++++++++++++++--------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/manual/debian/changelog b/manual/debian/changelog
index f624134..88154a8 100644
--- a/manual/debian/changelog
+++ b/manual/debian/changelog
@@ -21,6 +21,10 @@ installation-guide (2010xxxx) UNRELEASED; urgency=low
   * Add the list of architectures supported by the kFreeBSD port.
   * Restrict "Board Devices" accessibility section to Linux.
 
+  [ Joey Hess ]
+  * Update USB stick documentation to reflect isohybird mini.iso files,
+    as generated by debian-installer >= 20100913.
+
  -- Samuel Thibault <sthibault@debian.org>  Mon, 06 Sep 2010 00:56:02 +0200
 
 installation-guide (20100518) unstable; urgency=low
diff --git a/manual/en/install-methods/boot-usb-files.xml b/manual/en/install-methods/boot-usb-files.xml
index f8c9481..e2fc9af 100644
--- a/manual/en/install-methods/boot-usb-files.xml
+++ b/manual/en/install-methods/boot-usb-files.xml
@@ -4,26 +4,39 @@
  <sect1 condition="bootable-usb" id="boot-usb-files">
  <title>Preparing Files for USB Memory Stick Booting</title>
 
-<para>
+<para><para arch="x86">
 
 There are two installation methods possible when booting from USB stick.
-The first is to install completely from the network. The second is to
-also copy a CD image onto the USB stick and use that as a source for
-packages, possibly in combination with a mirror. This second method is
-the more common.
+The first is to only use the USB stick to boot the installer, and then
+install completely from the network. The second is to also copy a CD image
+onto the USB stick and use that as a source for packages, possibly in
+combination with a mirror.
 
-</para><para>
+</para><para arch="x86">
+
+To prepare a USB stick that only boots the installer, which then proceeds
+to install entirely from the network, you'll need to download the
+<filename>mini.iso</filename> image from the <filename>netboot</filename>
+directory (at the location mentioned in <xref linkend="where-files"/>), and
+write this file directly to the USB stick, overwriting its current contents.
+
+</para><para arch="x86">
+
+For example, when using an existing GNU/Linux system, the
+<filename>mini.iso</filename> file can be written to a USB stick as follows:
+
+<informalexample><screen>
+# cat mini.iso &gt; /dev/<replaceable>sdX</replaceable>
+</screen></informalexample>
 
-For the first installation method you'll need to download an installer
-image from the <filename>netboot</filename> directory (at the location
-mentioned in <xref linkend="where-files"/>) and use the
-<quote>flexible way</quote> explained below to copy the files to the USB
-stick.
+This method will work with very small USB sticks, only a few megabytes in
+size.
 
 </para><para>
 
-Installation images for the second installation method can be found in
-the <filename>hd-media</filename> directory and either the <quote>easy
+To prepare a USB stick that installs packages from a CD image included
+on the stick, use the installer images found in the
+<filename>hd-media</filename> directory. Either the <quote>easy
 way</quote> or the <quote>flexible way</quote> can be used to copy the
 image to the USB stick. For this installation method you will also need
 to download a CD image. The installation image and the CD image must be
-- 
1.7.1

From c526b1d1effdb5a2aa66ba76b11b7bc8176412c2 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 13 Sep 2010 20:33:11 -0400
Subject: [PATCH 3/5] isohybrid support

* Always try to mount USB partitions as a fallback, in order
  to support isohybrid images booted from USB stick.
* Set cdrom-detect/hybrid in that case for use by apt-setup.
* Removed cdrom-detect/try-usb, as that is now always done.
---
 packages/cdrom-detect/debian/cdrom-detect.postinst |   24 ++++++++++----------
 .../cdrom-detect/debian/cdrom-detect.templates     |   12 +++++-----
 packages/cdrom-detect/debian/changelog             |    6 +++++
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/packages/cdrom-detect/debian/cdrom-detect.postinst b/packages/cdrom-detect/debian/cdrom-detect.postinst
index 25641f6..a8bf6f4 100755
--- a/packages/cdrom-detect/debian/cdrom-detect.postinst
+++ b/packages/cdrom-detect/debian/cdrom-detect.postinst
@@ -95,24 +95,24 @@ mkdir /cdrom 2>/dev/null || true
 while true; do
 	WRONG=
 
-	if db_get cdrom-detect/try-usb && [ "$RET" = true ]; then
-		devices="$(list-devices usb-partition)"
-		for device in $devices; do
-			if try_mount $device $FATFS; then
-				break 2
-			fi
-			if try_mount $device $CDFS; then
-				break 2
-			fi
-		done
-	fi
-
 	devices="$(list-devices cd; list-devices maybe-usb-floppy)"
 	for device in $devices; do
 		if try_mount $device $CDFS; then
 			break 2
 		fi
 	done
+	
+	devices="$(list-devices usb-partition)"
+	for device in $devices; do
+		if try_mount $device $CDFS; then
+			db_set cdrom-detect/hybrid true
+			break 2
+		fi
+		if try_mount $device $FATFS; then
+			break 2
+		fi
+	done
+
 
 	if [ "$WRONG" ]; then
 		db_input critical cdrom-detect/wrong-cd || [ $? -eq 30 ]
diff --git a/packages/cdrom-detect/debian/cdrom-detect.templates b/packages/cdrom-detect/debian/cdrom-detect.templates
index 157d468..1b20af9 100644
--- a/packages/cdrom-detect/debian/cdrom-detect.templates
+++ b/packages/cdrom-detect/debian/cdrom-detect.templates
@@ -65,6 +65,12 @@ Default: iso9660
 Description: for internal use only
  File system used on cdrom-detect/cdrom_device.
 
+Template: cdrom-detect/hybrid
+Type: boolean
+Default: false
+Description: for internal use only
+ Set if the CD appears to be on a USB stick.
+
 Template: cdrom-detect/scanning_progress_title
 Type: text
 # :sl1:
@@ -129,9 +135,3 @@ Type: text
 #  Item in the main menu to select this package
 # :sl2:
 _Description: Detect and mount CD-ROM
-
-Template: cdrom-detect/try-usb
-Type: boolean
-Description: for internal use only
- Preseed this to true to try to mount /cdrom from USB partitions.
- Can be used for creating e.g. Debian Live USB sticks.
diff --git a/packages/cdrom-detect/debian/changelog b/packages/cdrom-detect/debian/changelog
index 7bc9daa..0ab1162 100644
--- a/packages/cdrom-detect/debian/changelog
+++ b/packages/cdrom-detect/debian/changelog
@@ -7,6 +7,12 @@ cdrom-detect (1.35) UNRELEASED; urgency=low
   * Set cdrom/suite and cdrom/codename when premounted /cdrom found.
     Closes: #594344.
 
+  [ Joey Hess ]
+  * Always try to mount USB partitions as a fallback, in order
+    to support isohybrid images booted from USB stick.
+  * Set cdrom-detect/hybrid in that case for use by apt-setup.
+  * Removed cdrom-detect/try-usb, as that is now always done.
+
  -- Samuel Thibault <sthibault@debian.org>  Sat, 21 Aug 2010 18:29:58 +0200
 
 cdrom-detect (1.34) unstable; urgency=low
-- 
1.7.1

From 3bebf2f73d241e35fd67f1f55dc38c262d9c5bf7 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 13 Sep 2010 20:39:08 -0400
Subject: [PATCH 4/5] remove redundant hd-media test

40cdrom avoids generating /var/lib/install-cd.id for hd-media installs,
so 41cdset checking for that file is enough; it doesn't need to also check
for /hd-media.
---
 packages/apt-setup/generators/41cdset |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/packages/apt-setup/generators/41cdset b/packages/apt-setup/generators/41cdset
index 6a8e705..af11516 100755
--- a/packages/apt-setup/generators/41cdset
+++ b/packages/apt-setup/generators/41cdset
@@ -5,8 +5,7 @@ set -e
 
 file="$1"
 
-if [ ! -e /cdrom/.disk/cd_type ] || [ -d /hd-media ] || \
-   [ ! -e /var/lib/install-cd.id ]; then
+if [ ! -e /cdrom/.disk/cd_type ] || [ ! -e /var/lib/install-cd.id ]; then
 	exit 0
 fi
 # multi-arch CDs have cd_type 'non_complete'
-- 
1.7.1

From c9f1637bf3ceb5d60d71205d6769167a595220a4 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 13 Sep 2010 20:41:30 -0400
Subject: [PATCH 5/5] When cdrom-detect/hybrid is true, the CD is not mountable by apt, so behave the same as for a hd-media install.

---
 packages/apt-setup/debian/changelog   |    8 ++++++++
 packages/apt-setup/generators/40cdrom |   13 +++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/packages/apt-setup/debian/changelog b/packages/apt-setup/debian/changelog
index a3f93c9..fd3fa5a 100644
--- a/packages/apt-setup/debian/changelog
+++ b/packages/apt-setup/debian/changelog
@@ -1,3 +1,11 @@
+apt-setup (1:0.47) UNRELEASED; urgency=low
+
+  * When cdrom-detect/hybrid is true, the CD is not mountable by apt,
+    so behave the same as for a hd-media install.
+  * Needs cdrom-detect 1.35.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 13 Sep 2010 20:40:08 -0400
+
 apt-setup (1:0.46) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/packages/apt-setup/generators/40cdrom b/packages/apt-setup/generators/40cdrom
index b26cbe4..af63342 100755
--- a/packages/apt-setup/generators/40cdrom
+++ b/packages/apt-setup/generators/40cdrom
@@ -9,6 +9,12 @@ if [ ! -e /cdrom/.disk/base_installable ]; then
 	exit 0
 fi
 
+cd_mountable=1
+db_get cdrom-detect/hybrid || true
+if [ "$RET" = true ] || [ -d /hd-media ]; then
+	cd_mountable=""
+fi
+
 fs=iso9660
 if db_get cdrom-detect/cdrom_fs && [ "$RET" ]; then
 	fs="$RET"
@@ -19,7 +25,7 @@ if [ "$fs" != iso9660 ]; then
 fi
 
 remount_cd() {
-	if [ "$ROOT" ] && [ ! -d /hd-media ]; then
+	if [ "$ROOT" ] && [ "$cd_mountable" ]; then
 		db_get cdrom-detect/cdrom_device
 		$logoutput mount -t "$fs" -o ro,exec $RET /cdrom || true
 	fi
@@ -60,8 +66,7 @@ if [ "$ROOT" ]; then
 	chroot=chroot
 
 	# Allow apt-cdrom to manage mounting/unmounting CDs in /target
-	# (except for hd-media installs)
-	if [ ! -d /hd-media ]; then
+	if [ "$cd_mountable" ]; then
 		rm -f $ROOT/etc/apt/apt.conf.d/00NoMountCDROM
 
 		# Also removes the bind-mount in /target
@@ -77,7 +82,7 @@ if $logoutput $chroot $ROOT apt-cdrom add \
    </dev/null; then
 	cat $ROOT$tmp >> $file
 
-	if [ "$ROOT" ] && [ ! -d /hd-media ]; then
+	if [ "$ROOT" ] && [ "$cd_mountable" ]; then
 		save_label
 	fi
 else
-- 
1.7.1

Attachment: signature.asc
Description: Digital signature


Reply to: