On Sat, 2009-08-08 at 20:21 +0200, Frans Pop wrote:
> On Friday 07 August 2009, Ian Campbell wrote:
> > Below is a patch for debian-installer to build cdrom-xen variants for
> > i386 and amd64. If nobody objects I would like to commit this to the
> > d-i repository.
> 
> I'd like to test it first. The fan of my notebook needs replacing, so that 
> may take a few days.

No problem, thanks.

A few other things are also needed to get a final result which is
actually usable. I wasn't bothering about these explicitly since they
will happen in the routine course of things.

Firstly the i386 and amd64 kernel udebs need to be rebuilt against a
kernel package >= 2.6.30-4 in order to pick up a bug fix which prevents
the kernel from booting under Xen.

Secondly an updated udev package is needed in order for d-i to detect
the CD correctly. Marco is working on a new upstream which includes this
and says it'll be done in a few weeks. I've been using a rebuild of the
current version in sid with the necessary patches applied, debdiff is
below.

Ian.

diff -u udev-0.141/rules/debian/50-udev.rules 
udev-0.141/rules/debian/50-udev.rules
--- udev-0.141/rules/debian/50-udev.rules
+++ udev-0.141/rules/debian/50-udev.rules
@@ -6,6 +6,8 @@
        IMPORT{program}="cdrom_id --export $tempnode"
 KERNEL=="sr[0-9]*", ACTION=="add|change", \
        IMPORT{program}="cdrom_id --export $tempnode"
+KERNEL=="xvd*", ACTION=="add|change", \
+       IMPORT{program}="cdrom_id --export $tempnode"
 
 # workarounds for devices which do not report media changes
 SUBSYSTEMS=="ide",  KERNEL=="hd[a-z]", ATTR{removable}=="1", \
diff -u udev-0.141/rules/debian/60-persistent-storage.rules 
udev-0.141/rules/debian/60-persistent-storage.rules
--- udev-0.141/rules/debian/60-persistent-storage.rules
+++ udev-0.141/rules/debian/60-persistent-storage.rules
@@ -22,9 +22,6 @@
 # ignore partitions that span the entire disk
 TEST=="whole_disk",                    GOTO="persistent_storage_end"
 
-# skip xen virtual hard disks
-DRIVERS=="vbd",                                GOTO="no_hardware_id"
-
 # workaround for kernels < 2.6.25-rc1
 ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
 ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"
diff -u udev-0.141/debian/changelog udev-0.141/debian/changelog
--- udev-0.141/debian/changelog
+++ udev-0.141/debian/changelog
@@ -1,3 +1,9 @@
+udev (0.141-1.0.hellion0) UNRELEASED; urgency=low
+
+  * Allow Xen vbd's to be probed.
+
+ -- Ian Campbell <i...@hellion.org.uk>  Wed, 13 May 2009 08:31:33 +0100
+
 udev (0.141-1) unstable; urgency=high
 
   * New upstream release. Fixes:
diff -u udev-0.141/debian/patches/series udev-0.141/debian/patches/series
--- udev-0.141/debian/patches/series
+++ udev-0.141/debian/patches/series
@@ -8,2 +8,4 @@
 dont-build-some-helpers
+path_id-xen-vbd
+cdrom_id-xen-vbd
 
only in patch2:
unchanged:
--- udev-0.141.orig/debian/patches/path_id-xen-vbd
+++ udev-0.141/debian/patches/path_id-xen-vbd
@@ -0,0 +1,51 @@
+commit 09b2999210c6843a2a3de529dd316b741261e31c
+Author: Ian Campbell <i...@hellion.org.uk>
+Date:   Thu Apr 16 22:46:18 2009 +0200
+
+    path_id: support identification of Xen virtual block devices
+
+diff --git a/extras/path_id/path_id b/extras/path_id/path_id
+index d21dea7..7b4973f 100755
+--- a/extras/path_id/path_id
++++ b/extras/path_id/path_id
+@@ -129,6 +129,30 @@ handle_platform () {
+       RESULT=0
+ }
+ 
++handle_xen () {
++      local DEV=$1
++      cd -P $1
++      vbd_id=${DEV##*/}
++      host_dev_path=$DEV
++      while [ ! -z "$host_dev_path" ] ; do
++              case "$host_dev_path" in
++                      */vbd*)
++                              host_dev_path=${host_dev_path%/*}
++                              ;;
++                      *)
++                              break
++                              ;;
++              esac
++      done
++      if [ "$d" ]; then
++              d="xen-$vbd_id-$d"
++      else
++              d="xen-$vbd_id"
++      fi
++      D="$host_dev_path"
++      RESULT=0
++}
++
+ handle_serio () {
+       local DEV=$1
+       cd -P $1
+@@ -532,6 +556,9 @@ handle_device () {
+                       */platform/*)
+                               handle_platform "$D"
+                               ;;
++                      */vbd-[0-9]*)
++                              handle_xen "$D"
++                              ;;
+                       */devices)
+                               D=
+                               ;;
only in patch2:
unchanged:
--- udev-0.141.orig/debian/patches/cdrom_id-xen-vbd
+++ udev-0.141/debian/patches/cdrom_id-xen-vbd
@@ -0,0 +1,35 @@
+commit 55d8f5e208396589476583dad8f2a7f2db3e2ef5
+Author: Kay Sievers <kay.siev...@vrfy.org>
+Date:   Fri Apr 17 00:29:56 2009 +0200
+
+    cdrom_id: add Xen cdrom support
+
+diff --git a/extras/cdrom_id/60-cdrom_id.rules 
b/extras/cdrom_id/60-cdrom_id.rules
+index 12fbf63..a3e8e3c 100644
+--- a/extras/cdrom_id/60-cdrom_id.rules
++++ b/extras/cdrom_id/60-cdrom_id.rules
+@@ -1,3 +1,5 @@
+-# import optical drive properties
++# do not edit this file, it will be overwritten on update
+ 
+-ACTION=="add|change", KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", 
IMPORT{program}="cdrom_id --export $tempnode"
++# import optical drive properties
++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \
++  KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]|xvd*", IMPORT{program}="cdrom_id 
--export $tempnode"
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index 7be0789..c578f12 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -567,10 +567,8 @@ int main(int argc, char *argv[])
+       }
+ 
+       /* check drive */
+-      if (cd_inquiry(udev, fd) < 0) {
+-              rc = 2;
+-              goto exit;
+-      }
++      if (cd_inquiry(udev, fd) < 0)
++              goto print;
+ 
+       /* read drive and possibly current profile */
+       if (cd_profiles(udev, fd) < 0)

-- 
Ian Campbell

I hope you're not pretending to be evil while secretly being good.
That would be dishonest.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to