From: Anthony Liguori <aliguori@us.ibm.com>
To: xen-devel@lists.sourceforge.net
Cc: niv@us.ibm.com
Subject: [Fwd: Installing from distribution CDs]
Date: Tue, 11 Jan 2005 14:48:09 -0600 [thread overview]
Message-ID: <1105476489.8213.18.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
Sorry, hit send instead of attach again. Rest of patches included.
--
Anthony Liguori
Samba, Linux/Windows Interoperability
Linux Technology Center (LTC) - IBM Austin
E-mail: aliguori@us.ibm.com
Phone: (512) 838-1208
Tie Line: 678-1208
[-- Attachment #2: Forwarded message - Installing from distribution CDs --]
[-- Type: message/rfc822, Size: 6036 bytes --]
[-- Attachment #2.1.1: Type: text/plain, Size: 1924 bytes --]
Hi,
I recently tried to see what it would take in Xen to install a
distribution from a CD in domain > 0. Here's my findings along with a
couple patches I used to find this. These patches are proof of concepts
and quite ugly.
1) initrd support
Xen currently implements the ramdisk option which seems to simply pull
in a gzip'd file to a ramdisk and set that as the root. Looking at the
initrd code in the kernel and reading through the man page, initrd is a
bit more complicated than that.
Among other things, the initrd process will check for a /linuxrc file
and execute it. After execution, it will remount a new root and then
fall through to the normal init process.
SLES-9 at least uses linuxrc. I imagine most distros do since it was
added specifically to help out distros.
2) CDROM support. SLES-9 at least expects to have been booted from a
CDROM and looks for a /proc/sys/ entry to find out where that CDROM is.
Right now Xen doesn't really support CDROMs.
The attached patches add /linuxrc to the init list (this will at least
let you get a bit into the installation process), add an old hack from
2.4 Xen to enable at least some response to MULTISESSION ioctls
(otherwise isofs won't mount the device), and also add a CDROM entry to
/proc/sys for hdc1.
A couple questions did come up though:
1) why isn't xen using the Linux initrd code? The man page says that
initrd has unspecified features. My fear is that some distros rely on
these features so reusing the initrd code would probably be best.
2) Have there been thoughts on how removable devices like CDROMs are
going to be supported?
BTW, you have to increase the ramdisk size to 64MB and add support for
minix to the kernel in order to boot off of SLES cd.
Regards,
--
Anthony Liguori
Samba, Linux/Windows Interoperability
Linux Technology Center (LTC) - IBM Austin
E-mail: aliguori@us.ibm.com
Phone: (512) 838-1208
Tie Line: 678-1208
[-- Attachment #2.1.2: xen-sles9-fakecd.diff --]
[-- Type: text/x-patch, Size: 3433 bytes --]
diff -ur xen-2.0/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c xen-2.0-new/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c
--- xen-2.0/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c 2005-01-03 21:46:11.000000000 -0600
+++ xen-2.0-new/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c 2005-01-05 14:08:26.000000000 -0600
@@ -31,6 +31,8 @@
#include "block.h"
#include <linux/blkdev.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
/*
* For convenience we distinguish between ide, scsi and 'other' (i.e.
@@ -281,6 +283,98 @@
return NULL;
}
+#define CDROM_STR_SIZE 1000
+static char info[CDROM_STR_SIZE];
+
+int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ int pos;
+
+ if (!*lenp || (*ppos && !write)) {
+ *lenp = 0;
+ return 0;
+ }
+
+ pos = sprintf(info,
+ "CD-ROM information, Id: cdrom.c 3.20 2003/12/17\n"
+ "\ndrive name:\t\thdc1\n"
+ "drive speed:\t\t40\n"
+ "drive # of slots:\t1\n"
+ "Can close tray:\t\t0\n"
+ "Can open tray:\t\t0\n"
+ "Can lock tray:\t\t0\n"
+ "Can change speed:\t0\n"
+ "Can select disk:\t0\n"
+ "Can read multisession:\t0\n"
+ "Can read MCN:\t\t0\n"
+ "Reports media changed:\t0\n"
+ "Can play audio:\t\t0\n"
+ "Can write CD-R:\t\t0\n"
+ "Can write CD-RW:\t0\n"
+ "Can read DVD:\t\t0\n"
+ "Can write DVD-R:\t0\n"
+ "Can write DVD-RAM:\t0\n"
+ "Can read MRW:\t\t0\n"
+ "Can write MRW:\t\t0\n"
+ "Can write RAM:\t\t0\n"
+ "\n");
+
+ return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
+}
+
+/* Place files in /proc/sys/dev/cdrom */
+static ctl_table cdrom_table[] = {
+ {
+ .ctl_name = DEV_CDROM_INFO,
+ .procname = "info",
+ .data = &info,
+ .maxlen = CDROM_STR_SIZE,
+ .mode = 0444,
+ .proc_handler = &cdrom_sysctl_info,
+ },
+ { .ctl_name = 0 }
+};
+
+static ctl_table cdrom_cdrom_table[] = {
+ {
+ .ctl_name = DEV_CDROM,
+ .procname = "cdrom",
+ .maxlen = 0,
+ .mode = 0555,
+ .child = cdrom_table,
+ },
+ { .ctl_name = 0 }
+};
+
+static ctl_table cdrom_root_table[] = {
+#ifdef CONFIG_PROC_FS
+ {
+ .ctl_name = CTL_DEV,
+ .procname = "dev",
+ .maxlen = 0,
+ .mode = 0555,
+ .child = cdrom_cdrom_table,
+ },
+#endif /* CONFIG_PROC_FS */
+ { .ctl_name = 0 }
+};
+static struct ctl_table_header *cdrom_sysctl_header;
+
+static void cdrom_sysctl_register(void)
+{
+ static int initialized;
+
+ if (initialized == 1)
+ return;
+
+ cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1);
+ if (cdrom_root_table->ctl_name && cdrom_root_table->child->de)
+ cdrom_root_table->child->de->owner = THIS_MODULE;
+
+ initialized = 1;
+}
+
/*
* xlvbd_init_device - initialise a VBD device
* @disk: a vdisk_t describing the VBD
@@ -323,13 +417,20 @@
goto out;
}
+ printk(KERN_ALERT "XenLinux: init of %d %s\n", device, gd->disk_name);
+
if (VDISK_READONLY(xd->info))
set_disk_ro(gd, 1);
+ if (!strcmp(gd->disk_name, "hdc1")) {
+ xd->info = VDISK_TYPE_CDROM;
+ }
+
/* Some final fix-ups depending on the device type */
switch (VDISK_TYPE(xd->info)) {
case VDISK_TYPE_CDROM:
gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
+ cdrom_sysctl_register();
/* FALLTHROUGH */
case VDISK_TYPE_FLOPPY:
case VDISK_TYPE_TAPE:
[-- Attachment #3: xen-sles9-linuxrc.diff --]
[-- Type: text/x-patch, Size: 378 bytes --]
--- xen-2.0-new/linux-2.6.9-xenU/init/main.c~ 2005-01-11 14:43:52.000000000 -0600
+++ xen-2.0-new/linux-2.6.9-xenU/init/main.c 2005-01-11 14:44:46.168201000 -0600
@@ -745,6 +745,7 @@
if (execute_command)
run_init_process(execute_command);
+ run_init_process("/linuxrc");
run_init_process("/sbin/init");
run_init_process("/etc/init");
run_init_process("/bin/init");
[-- Attachment #4: xen-sles9-multisession.diff --]
[-- Type: text/x-patch, Size: 1079 bytes --]
diff -ur xen-2.0/linux-2.6.9-xen-sparse/drivers/xen/blkfront/blkfront.c xen-2.0-new/linux-2.6.9-xen-sparse/drivers/xen/blkfront/blkfront.c
--- xen-2.0/linux-2.6.9-xen-sparse/drivers/xen/blkfront/blkfront.c 2005-01-03 21:46:09.000000000 -0600
+++ xen-2.0-new/linux-2.6.9-xen-sparse/drivers/xen/blkfront/blkfront.c 2005-01-05 14:22:11.000000000 -0600
@@ -236,6 +236,7 @@
int blkif_ioctl(struct inode *inode, struct file *filep,
unsigned command, unsigned long argument)
{
+ int i;
/* struct gendisk *gd = inode->i_bdev->bd_disk; */
DPRINTK_IOCTL("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n",
@@ -247,6 +248,12 @@
/* return ENOSYS to use defaults */
return -ENOSYS;
+ case CDROMMULTISESSION:
+ DPRINTK("FIXME: support multisession CDs later\n");
+ for ( i = 0; i < sizeof(struct cdrom_multisession); i++ )
+ if ( put_user(0, (byte *)(argument + i)) ) return -EFAULT;
+ return 0;
+
default:
printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n",
command);
[-- Attachment #5: slesboot --]
[-- Type: text/plain, Size: 2870 bytes --]
# -*- mode: python; -*-
#============================================================================
# Python configuration setup for 'xm create'.
# This script sets the parameters used when a domain is created using 'xm create'.
# You use a separate script for each domain you want to create, or
# you can set the parameters for the domain on the xm command line.
#============================================================================
#----------------------------------------------------------------------------
# Kernel image file.
kernel = "/boot/vmlinuz-2.6.9-xenU"
# Optional ramdisk.
ramdisk = "/root/loader/initrd"
# The domain build function. Default is 'linux'.
#builder='linux'
# Initial memory allocation (in megabytes) for the new domain.
memory = 256
# A name for your domain. All domains must have different names.
name = "SLESBoot"
# Which CPU to start domain on?
#cpu = -1 # leave to Xen to pick
#----------------------------------------------------------------------------
# Define network interfaces.
# Number of network interfaces. Default is 1.
#nics=1
# Optionally define mac and/or bridge for the network interfaces.
# Random MACs are assigned if not given.
#vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ]
#----------------------------------------------------------------------------
# Define the disk devices you want the domain to have access to, and
# what you want them accessible as.
# Each disk entry is of the form phy:UNAME,DEV,MODE
# where UNAME is the device, DEV is the device name the domain will see,
# and MODE is r for read-only, w for read-write.
disk = [ 'phy:volumes/rhel3,sda1,w', 'file:/root/sles9.iso,hdc1,r' ]
#----------------------------------------------------------------------------
# Set the kernel command line for the new domain.
# You only need to define the IP parameters and hostname if the domain's
# IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
# You can use 'extra' to set the runlevel and custom environment
# variables used by custom rc scripts (e.g. VMID=, usr= ).
# Set if you want dhcp to allocate the IP address.
#dhcp="dhcp"
# Set netmask.
#netmask=
# Set default gateway.
#gateway=
# Set the hostname.
#hostname= "vm%d" % vmid
# Set root device.
#root = "/dev/sda2 rw"
# Root device for nfs.
#root = "/dev/nfs"
# The nfs server.
#nfs_server = '169.254.1.0'
# Root directory on the nfs server.
#nfs_root = '/full/path/to/root/directory'
# Sets runlevel 4.
extra = "4"
#----------------------------------------------------------------------------
# Set according to whether you want the domain restarted when it exits.
# The default is 'onreboot', which restarts the domain when it shuts down
# with exit code reboot.
# Other values are 'always', and 'never'.
#restart = 'onreboot'
#============================================================================
next reply other threads:[~2005-01-11 20:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-11 20:48 Anthony Liguori [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-02-02 8:51 [Fwd: Installing from distribution CDs] Ian Pratt
2005-02-02 11:31 ` Jared Rhine
2005-02-02 15:03 ` Anthony Liguori
2005-02-02 18:39 ` Jared Rhine
2005-02-02 19:40 ` Anthony Liguori
2005-02-02 20:04 ` Anthony Liguori
2005-02-02 14:57 ` Anthony Liguori
2005-02-02 22:26 Ian Pratt
2005-02-03 2:16 ` Anthony Liguori
2005-02-03 4:07 ` Christian Limpach
2005-02-03 4:52 ` Anthony Liguori
2005-02-03 10:54 ` Christian Limpach
2005-02-09 0:11 Ian Pratt
2005-02-09 1:00 ` Anthony Liguori
2005-02-09 22:56 ` Jared Rhine
2005-02-09 1:47 Ian Pratt
2005-02-09 2:11 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1105476489.8213.18.camel@localhost \
--to=aliguori@us.ibm.com \
--cc=niv@us.ibm.com \
--cc=xen-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.