1 /* $OpenBSD: rd.c,v 1.2 2008/08/22 03:12:37 deraadt Exp $ */ 2 3 /* 4 * Copyright (c) 1995 Gordon W. Ross 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #include <sys/param.h> 31 #include <sys/systm.h> 32 #include <sys/reboot.h> 33 34 #include <dev/ramdisk.h> 35 36 extern int boothowto; 37 38 #ifndef MINIROOTSIZE 39 #define MINIROOTSIZE 512 40 #endif 41 42 #define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT) 43 44 /* 45 * This array will be patched to contain a file-system image. 46 * See the program: src/distrib/common/rdsetroot.c 47 */ 48 u_int32_t rd_root_size = ROOTBYTES; 49 char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n"; 50 51 /* 52 * This is called during autoconfig. 53 */ 54 void 55 rd_attach_hook(int unit, struct rd_conf *rd) 56 { 57 if (unit == 0) { 58 /* Setup root ramdisk */ 59 rd->rd_addr = (caddr_t) rd_root_image; 60 rd->rd_size = (size_t) rd_root_size; 61 rd->rd_type = RD_KMEM_FIXED; 62 printf("rd%d: fixed, %d blocks\n", unit, MINIROOTSIZE); 63 } 64 } 65 66 /* 67 * This is called during open (i.e. mountroot) 68 */ 69 void 70 rd_open_hook(int unit, struct rd_conf *rd) 71 { 72 } 73