From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Fwd: Installing from distribution CDs] Date: Wed, 02 Feb 2005 13:40:11 -0600 Message-ID: <1107373210.17156.12.camel@localhost> References: <87acqndwq3.wl@badger.wordzoo.com> <4200EBB5.4040606@codemonkey.ws> <878y66erhr.wl@badger.wordzoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-riXrWNXpUAlMkRRkG3vJ" In-Reply-To: <878y66erhr.wl@badger.wordzoo.com> Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Jared Rhine Cc: xen-devel@lists.sourceforge.net, Ian Pratt List-Id: xen-devel@lists.xenproject.org --=-riXrWNXpUAlMkRRkG3vJ Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2005-02-02 at 12:39, Jared Rhine wrote: > I don't think so; the bottom of my /linuxrc execs /sbin/init. This > marks the end of the standard initrd process of doing a pivot-root and > getting on with life. It doesn't have to be an either/or between > linuxrc and init. This is likely to support older kernels as initrd does a pivot for you. > As mentioned, I can't speak to the innards, but I can offer solid > proof that I need an init=/linuxrc on my boot line, and that this > snippet would not be needed if I wasn't using a Xen'ed kernel. On a > regular kernel, the /linuxrc is found and used automatically in > preference to /sbin/init, if it is present. Now here's something for you to do which should be confusing as the solution. Add a root=/dev/hdc or whatever to your command line and I bet it will work without the init=/linuxrc. Apparently what's happening is that at some point during the domain boot process, Xen decides that the root device is /dev/ram0 if there is no root= command line on the kernel. In init/do_mounts_rd.c:rd_load_image() if the ramdisk loads to what it thinks is the root device, the initrd actions are never taken. Of course, patching that function to remove that check results in the same behavior. I've not yet tracked down what's going on but that's the problem. I've also included a new patch against a recent xen-unstable. It's another proof-of-concept one. This time, I can actually start a rescue CD properly (which means initrd is working with SLES-9). The distro install doesn't work though. However, another 2.6-based distro might have more luck. Regards, -- Anthony Liguori Linux Technology Center (LTC) - IBM Austin E-mail: aliguori@us.ibm.com Phone: (512) 838-1208 --=-riXrWNXpUAlMkRRkG3vJ Content-Disposition: attachment; filename=sles-install.diff Content-Type: text/x-patch; name=sles-install.diff; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 7bit --- linux-2.6.10-xen-sparse/arch/xen/configs/xenU_defconfig 2005-01-25 22:29:15.000000000 -0600 +++ linux-2.6.10-xenU/.config 2005-02-02 11:25:34.000000000 -0600 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.10-xenU -# Mon Dec 27 10:15:03 2004 +# Wed Feb 2 11:25:34 2005 # CONFIG_XEN=y CONFIG_ARCH_XEN=y @@ -12,17 +12,15 @@ # # CONFIG_XEN_PRIVILEGED_GUEST is not set # CONFIG_XEN_PHYSDEV_ACCESS is not set -# CONFIG_XEN_BLKDEV_BACKEND is not set -# CONFIG_XEN_NETDEV_BACKEND is not set CONFIG_XEN_BLKDEV_FRONTEND=y CONFIG_XEN_NETDEV_FRONTEND=y # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set # CONFIG_XEN_BLKDEV_TAP is not set CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_XEN_SCRUB_PAGES=y -CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y CONFIG_X86=y # CONFIG_X86_64 is not set +CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y # # Code maturity level options @@ -48,7 +46,6 @@ # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y @@ -156,7 +153,6 @@ CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_FW_LOADER is not set -# CONFIG_DEBUG_DRIVER is not set # # Block devices @@ -167,7 +163,7 @@ CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" # CONFIG_LBD is not set @@ -341,7 +337,7 @@ # CONFIG_REISERFS_FS_XATTR is not set # CONFIG_JFS_FS is not set # CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set +CONFIG_MINIX_FS=y # CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set CONFIG_DNOTIFY=y --- ../xen-unstable-orig/linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c 2005-01-25 22:29:15.000000000 -0600 +++ linux-2.6.10-xenU/drivers/xen/blkfront/blkfront.c 2005-02-02 11:50:57.000000000 -0600 @@ -219,6 +219,7 @@ unsigned command, unsigned long argument) { /* struct gendisk *gd = inode->i_bdev->bd_disk; */ + int i; DPRINTK_IOCTL("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n", command, (long)argument, inode->i_rdev); @@ -229,6 +230,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); --- ../xen-unstable-orig/linux-2.6.10-xen-sparse/drivers/xen/blkfront/vbd.c 2005-01-25 22:29:17.000000000 -0600 +++ linux-2.6.10-xenU/drivers/xen/blkfront/vbd.c 2005-02-02 11:49:49.000000000 -0600 @@ -31,6 +31,8 @@ #include "block.h" #include +#include +#include /* * For convenience we distinguish between ide, scsi and 'other' (i.e. @@ -280,6 +282,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 @@ -322,13 +416,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: --=-riXrWNXpUAlMkRRkG3vJ-- ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl