Subject: build xen kernels as part of i386 release
To: None <port-i386@netbsd.org, port-xen@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 03/09/2005 23:54:20
--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,
Attached are some diffs to i386 code, to integrate Xen kernels. There are
3 parts here:
- add xen devices to the i386 MD devices. I think we want this anyway, to
  avoid conflicts on the major numbers, and to share the MAKEDEV (we can
  run a plain i386 kernel, or a xen0 kernel on the same root filesystem)
- add the xen kernels to the i386 release process. This way we don't have
  a separate xen build and distribution, just extra kernels in the i386 one
- add support for xen devices to the install ramdisk, and provide a
  XENU_INSTALL kernel with an embeeded ramdisk. This can be used either
  as a standalone kernel to play with xen non-privileged domains, or to
  to a NetBSD on a xen virtual device (instead of prepopulating the
  filesystem from the domain0 system, which is not always easy).

Any comment/objections ? I'd like to commit this in a day or 2, and in any
case before 3.0 is branched.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=xen-diff

cvs diff: sys/arch/i386/conf/INSTALL_XENU is a new entry, no comparison available
cvs diff: sys/arch/i386/conf/XEN0 is a new entry, no comparison available
cvs diff: sys/arch/i386/conf/XENU is a new entry, no comparison available
Index: distrib/i386/floppies/instkernel/Makefile
===================================================================
RCS file: /cvsroot/src/distrib/i386/floppies/instkernel/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- distrib/i386/floppies/instkernel/Makefile	18 Nov 2002 12:39:46 -0000	1.3
+++ distrib/i386/floppies/instkernel/Makefile	9 Mar 2005 22:40:44 -0000
@@ -17,6 +17,7 @@
 
 MDSETTARGETS=		INSTALL		${RAMDISK_B}	-	\
 			INSTALL_LAPTOP	${RAMDISK_B}	-	\
+			INSTALL_XENU	${RAMDISK_B}	-	\
 			INSTALL_SMALL	${RAMDISK_S}	-	\
 			INSTALL_TINY	${RAMDISK_T}	-	\
 			INSTALL_PS2	${RAMDISK_S}	-	\
Index: distrib/utils/sysinst/arch/i386/md.h
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/md.h,v
retrieving revision 1.53
diff -u -r1.53 md.h
--- distrib/utils/sysinst/arch/i386/md.h	14 Aug 2004 16:06:41 -0000	1.53
+++ distrib/utils/sysinst/arch/i386/md.h	9 Mar 2005 22:40:58 -0000
@@ -84,7 +84,7 @@
  * On i386, we allow "wd"  ST-506/IDE disks,  "sd" scsi disks, "ld" logical
  * disks, "ed" IBM ESDI disks, "raid" raidframe disks
  */
-#define DISK_NAMES "wd", "sd", "ld", "ed", "raid:no_mbr"
+#define DISK_NAMES "wd", "sd", "ld", "ed", "raid:no_mbr", "xbd:no_mbr"
 
 /*
  * Machine-specific command to write a new label to a disk.
Index: etc/MAKEDEV.tmpl
===================================================================
RCS file: /cvsroot/src/etc/MAKEDEV.tmpl,v
retrieving revision 1.38
diff -u -r1.38 MAKEDEV.tmpl
--- etc/MAKEDEV.tmpl	8 Jan 2005 22:31:28 -0000	1.38
+++ etc/MAKEDEV.tmpl	9 Mar 2005 22:41:00 -0000
@@ -88,6 +88,7 @@
 #	rx*	MSCP floppy disk (RX33/50/...)
 #	up*	other UNIBUS devices (e.g. on Emulex SC-21V controller)
 #	vnd*	"file" pseudo-disks
+#	xbd*	Xen virtual disks
 #	xd*	Xylogic 753/7053 disks
 #	xy*	Xylogic 450/451 disks
 #
@@ -150,6 +151,7 @@
 #	dhu*    UNIBUS DHU11 (vax)
 #	dmz*    UNIBUS DMZ32 (vax)
 #	dl*	UNIBUS DL11 (vax)
+#	xencons	Xen virtual console
 #
 # Terminal multiplexors:
 #	dc*	4 channel serial interface (keyboard, mouse, modem, printer)
@@ -275,6 +277,7 @@
 #	view*	generic interface to graphic displays (Amiga)
 #	wsfont*	console font control
 #	wsmux*	wscons event multiplexor
+#	xenevt	Xen event interface
 
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue
@@ -565,6 +568,14 @@
 	mkdev wsmuxctl$unit c %wsmux_chr% $(($unit + 128)) 200
 	;;
 
+xenevt)
+	mkdev xenevt c %xenevt_chr% 0
+	;;
+
+xencons)
+	mkdev xencons c %xencons_chr% 0
+	;;
+
 ttyEstat)
 	mkdev ttyEstat c %wsdisplay_chr% 254
 	;;
@@ -674,6 +685,12 @@
 	%MKDISK% $name $unit $blk $chr
 	;;
 
+xbd*)
+	name=xbd; unit=${i#xbd}; blk=%xbd_blk%; chr=%xbd_chr%
+	%MKDISK% $name $unit $blk $chr
+	;;
+
+
 ttyCY*)
 	name=tyCY; chr=%cy_chr%; off=32
 	unit=${i#t${name}}
Index: etc/etc.i386/MAKEDEV.conf
===================================================================
RCS file: /cvsroot/src/etc/etc.i386/MAKEDEV.conf,v
retrieving revision 1.3
diff -u -r1.3 MAKEDEV.conf
--- etc/etc.i386/MAKEDEV.conf	2 Dec 2004 16:44:28 -0000	1.3
+++ etc/etc.i386/MAKEDEV.conf	9 Mar 2005 22:41:01 -0000
@@ -12,6 +12,7 @@
 	makedev ed0 ed1
 	makedev raid0
 	makedev ld0 ld1 ld2 ld3
+	makedev xbd0
 	makedev usbs
 	makedev ipty
 	makedev local
@@ -42,6 +43,10 @@
 	makedev nsmb
 	;;
 
+xen)
+	makedev xenevt xencons
+	;;
+
 floppy)
 	makedev std wt0 fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4 st0 st1
 	makedev tty0 tty1 tty2 cd0 cd1 mcd0 ttyv0 opty ld0 ld1 ld2 ld3 ed0 ed1
Index: etc/etc.i386/Makefile.inc
===================================================================
RCS file: /cvsroot/src/etc/etc.i386/Makefile.inc,v
retrieving revision 1.40
diff -u -r1.40 Makefile.inc
--- etc/etc.i386/Makefile.inc	23 Jul 2004 17:57:41 -0000	1.40
+++ etc/etc.i386/Makefile.inc	9 Mar 2005 22:41:01 -0000
@@ -5,10 +5,10 @@
 
 KERNEL_SETS=		GENERIC GENERIC_TINY GENERIC_LAPTOP \
 			GENERIC_DIAGNOSTIC GENERIC_PS2TINY GENERIC.MP \
-			GENERIC.MPACPI
+			GENERIC.MPACPI XEN0 XENU
 
 BUILD_KERNELS=		INSTALL INSTALL_SMALL INSTALL_TINY \
-			INSTALL_LAPTOP INSTALL_PS2
+			INSTALL_LAPTOP INSTALL_PS2 INSTALL_XENU
 
 INSTALLATION_DIRS+=	installation/misc	\
 			installation/floppy
Index: sys/arch/i386/conf/majors.i386
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/majors.i386,v
retrieving revision 1.23
diff -u -r1.23 majors.i386
--- sys/arch/i386/conf/majors.i386	10 Dec 2003 02:04:01 -0000	1.23
+++ sys/arch/i386/conf/majors.i386	9 Mar 2005 22:41:02 -0000
@@ -108,6 +108,16 @@
 device-major	ct		char 106 block 23	ct
 device-major	mt		char 107 block 24	mt
 
+#
+# Device majors for Xen. These are assigned here so that:
+# - we are sure there's no conflics with plain i386 
+# - they appear in the i386 MAKEDEV
+#
+
+device-major	xenevt		char 141		xenevt
+device-major	xbd		char 142 block 142	xbd
+device-major	xencons		char 143		xencons
+
 # Majors up to 143 are reserved for machine-dependant drivers.
 # New machine-independant driver majors are assigned in 
 # sys/conf/majors.

--jI8keyz6grp/JLjh--