diff -u i386/i386at/conf.c i386/i386at/conf.c
--- i386/i386at/conf.c	9 May 2007 16:09:16 -0000
+++ i386/i386at/conf.c	10 Jul 2007 15:13:26 -0000
@@ -64,6 +64,11 @@
 extern int	kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat();
 #define kmsgname		"kmsg"
 
+#ifdef MACH_ENTROPY                                                                       
+#define entropyname		"entropy"
+extern int	entropyopen(), entropyclose(), entropyread(),  entropygetstat();
+#endif
+
 /*
  * List of devices - console must be at slot 0
  */
@@ -128,6 +133,12 @@
           nodev },
 #endif
 
+#ifdef MACH_ENTROPY
+	{ entropyname, 	entropyopen,	entropyclose,	entropyread,
+	  nodev,	entropygetstat,	nodev,		nomap,
+	  nodev,	nulldev,	nulldev,	0,
+	  nodev },
+#endif
 };
 int	dev_name_count = sizeof(dev_name_list)/sizeof(dev_name_list[0]);
 
reverted:
--- i386/i386at/iopl.c	9 May 2007 16:09:16 -0000
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-/* 
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- * 
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
- * Carnegie Mellon requests users of this software to return to
- * 
- *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- * 
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
- 
-#include <device/io_req.h>
-
-/*ARGSUSED*/
-int iopl_all = 1;
-int
-ioplmmap(dev, off, prot)
-int		dev;
-vm_offset_t	off;
-vm_prot_t	prot;
-{
-    extern vm_offset_t phys_last_addr;
-
-    if (iopl_all) {
-	if (off == 0)
-		return 0;
-	else if (off < 0xa0000)
-		return -1;
-	else if (off >= 0x100000 && off <= phys_last_addr)
-		return -1;
-	else
-		return i386_btop(off);
-
-    }
-	if (off > 0x60000)
-		return(-1);
-
-	/* Get page frame number for the page to be mapped. */
-
-	return(i386_btop(0xa0000 + off));
-}
only in patch2:
unchanged:
--- Makefrag.am	2 Jun 2007 13:23:21 -0000	1.1.2.12
+++ Makefrag.am	10 Jul 2007 15:13:25 -0000
@@ -292,6 +292,14 @@
 	device/kmsg.h
 endif
 
+#
+# kernel entrophy generator device
+
+if enable_entropy
+libkernel_a_SOURCES += \
+	device/entropy.c
+	device/entropy.h
+endif
 
 #
 # Version number.
only in patch2:
unchanged:
--- configfrag.ac	19 Feb 2007 20:09:16 -0000	1.1.2.6
+++ configfrag.ac	10 Jul 2007 15:13:25 -0000
@@ -124,7 +124,18 @@
 [else]
   AM_CONDITIONAL([enable_kmsg], [false])
 [fi]
-
+
+
+AC_ARG_ENABLE([entropy],
+  AS_HELP_STRING([--disable-entropy], [disable use of entropy device]))
+[if [ x"$enable_kmsg" != xno ]; then]
+  AC_DEFINE([MACH_ENTROPY], [], [enable use of entropy device])
+  AM_CONDITIONAL([enable_entropy], [true])
+[else]
+  AM_CONDITIONAL([enable_entropy], [false])
+[fi]
+
+
 #
 # Set up `SYSTYPE/SYSTYPE' and `SYSTYPE/include/mach/SYSTYPE' links.
 #
@@ -134,7 +145,7 @@
 # <http://lists.gnu.org/archive/html/bug-automake/2006-11/msg00027.html>.
 AC_CONFIG_LINKS([machine:$systype/$systype
 		 mach/machine:$systype/include/mach/$systype])
-
+
 dnl Local Variables:
 dnl mode: autoconf
 dnl End:
only in patch2:
unchanged:
--- device/cons.c	13 Nov 2006 21:30:36 -0000	1.2.4.6
+++ device/cons.c	10 Jul 2007 15:13:25 -0000
@@ -44,6 +44,10 @@
 #include <device/kmsg.h>
 #endif
 
+#ifdef MACH_ENTROPY
+#include <device/entropy.h>
+#endif
+
 static	int cn_inited = 0;
 static	struct consdev *cn_tab = 0;	/* physical console device info */
 #ifndef MACH_KERNEL
@@ -230,8 +234,18 @@
 cngetc()
 {
 	if (cn_tab)
-		return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1));
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY
+	  	entropy_putchar(cn_tab->cn_dev);
+#endif // MACH_ENTROPY
+#endif // MACH_KERNEL
+	  	return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1));
 	if (romgetc)
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY
+		entropy_putchar(*romgetc);
+#endif // MACH_KERNL
+#endif // MACH_ENTROPY
 		return ((*romgetc)(1));
 	return (0);
 }
only in patch2:
unchanged:
--- i386/i386at/kd.c	7 May 2007 22:04:53 -0000	1.5.2.13
+++ i386/i386at/kd.c	10 Jul 2007 15:13:26 -0000
@@ -85,6 +85,13 @@
 #include <device/io_req.h>
 #include <device/buf.h>		/* for struct uio (!) */
 #include <vm/vm_kern.h>
+
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY                                                                       
+#include <device/entropy.h>
+#endif /* MACH_KERNEL */
+#endif /* MACH_ENTROPY */
+
 #include <i386/vm_param.h>
 #include <i386/machspl.h>
 #include <i386/pio.h>
@@ -811,6 +818,18 @@
 		up = TRUE;
 		scancode &= ~K_UP;
 	}
+
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY                                                                       
+	/***
+	 * Kirkeby put the get entropy function here, so will I
+	 * the OR causes it to only get a some of the keypresses
+	 * making this even more random when it fires (he got this
+	 * from Linux originally
+	 ***/
+	entropy_putchar(scancode | (up ? 0200 : 0));
+#endif /* MACH_ENTROPY */
+#endif /* MACH_KERNEL */
 	if (scancode < NUMKEYS) {
 		/* Lookup in map, then process. */
 		char_idx = kdstate2idx(kd_state, kd_extended);
only in patch2:
unchanged:
--- i386/i386at/kd_mouse.c	13 Nov 2006 21:30:36 -0000	1.3.2.8
+++ i386/i386at/kd_mouse.c	10 Jul 2007 15:13:26 -0000
@@ -70,6 +70,9 @@
 #ifdef	MACH_KERNEL
 #include <device/errno.h>
 #include <device/io_req.h>
+#ifdef MACH_ENTROPY
+#include <device/entropy.h>
+#endif /* MACH_ENTROPY */
 #else	/* MACH_KERNEL */
 #include <sys/file.h>
 #include <sys/errno.h>
@@ -677,6 +680,11 @@
 	moved.mm_deltaX = (char)mousebuf[1] + (char)mousebuf[3];
 	moved.mm_deltaY = (char)mousebuf[2] + (char)mousebuf[4];
 
+#ifdef MACH_ENTROPY
+	/* Kick some mouse data to the entropy driver */
+	entropy_putchar((buttonchanges + moved.mm_deltaX
+			+ moved.mm_deltaY) | 0122);
+#endif
 	if (moved.mm_deltaX != 0 || moved.mm_deltaY != 0)
 		mouse_moved(moved);
 
only in patch2:
unchanged:
--- ipc/mach_msg.c	30 Apr 2007 20:30:11 -0000	1.2.2.9
+++ ipc/mach_msg.c	10 Jul 2007 15:13:27 -0000
@@ -61,6 +61,11 @@
 #include <machine/locore.h>
 #include <machine/pcb.h>
 
+#ifdef MACH_ENTROPY
+// KLUDGE!
+#include <../device/entropy.h>
+#endif
+
 extern void exception_raise_continue();
 extern void exception_raise_continue_fast();
 
@@ -105,7 +110,6 @@
 	mr = ipc_kmsg_get(msg, send_size, &kmsg);
 	if (mr != MACH_MSG_SUCCESS)
 		return mr;
-
 	if (option & MACH_SEND_CANCEL) {
 		if (notify == MACH_PORT_NULL)
 			mr = MACH_SEND_INVALID_NOTIFY;
@@ -147,6 +151,18 @@
 		(void) ipc_kmsg_put(msg, kmsg, kmsg->ikm_header.msgh_size);
 	}
 
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY
+	// Use messages for entrop
+	// We are only copying the first two bits because
+	// most mach messages don't use the entire message space
+	// and end in zeros, so we just want the actual etropic
+	// data
+	//entropy_putdata(kmsg->msgh_bites, sizeof(msgh_bits);
+#endif // MACH_KERNEL
+#endif // MACH_ENTROPY
+
+
 	return mr;
 }
 
@@ -269,6 +285,18 @@
 		return mr;
 	}
 
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY
+	// Use messages for entropy
+	
+	// We are only copying the first two bits because
+	// most mach messages don't use the entire message space
+	// and end in zeros, so we just want the actual etropic
+	// data
+	//entropy_putdata(kmsg, 2);
+#endif // MACH_KERNEL
+#endif // MACH_ENTROPY
+
 	return ipc_kmsg_put(msg, kmsg, kmsg->ikm_header.msgh_size);
 }
 
only in patch2:
unchanged:
--- linux/configfrag.ac	2 May 2007 19:47:11 -0000	1.1.2.5
+++ linux/configfrag.ac	10 Jul 2007 15:13:27 -0000
@@ -601,6 +601,15 @@
 		   linux/dev/include/asm:linux/dev/include/asm-$systype])
 [else] AM_CONDITIONAL([CODE_linux], [false])
 [fi]
+
+AC_ARG_ENABLE([entropy],
+		  AS_HELP_STRING([--disable-entropy], [disable use of entropy device]))
+	[if [ x"$enable_entropy" != xno ]; then]
+	  AC_DEFINE([MACH_ENTROPY], [], [enable use of entropy device])
+	  AM_CONDITIONAL([enable_entropy], [true])
+	[else]                                                                   
+	  AM_CONDITIONAL([enable_entropy], [false])                              	
+[fi]     
 
 dnl Local Variables:
 dnl mode: autoconf
only in patch2:
unchanged:
--- linux/dev/glue/misc.c	18 Sep 2001 21:14:19 -0000	1.2
+++ linux/dev/glue/misc.c	10 Jul 2007 15:13:28 -0000
@@ -67,6 +67,10 @@
 #include <linux/proc_fs.h>
 #include <linux/kernel_stat.h>
 
+#ifdef MACH_ENTROPY
+#include <device/entropy.h>
+#endif
+
 extern boolean_t vm_map_lookup_entry (register vm_map_t, register vm_offset_t,
 				      vm_map_entry_t *);
 extern int printf (const char *, ...);
@@ -224,6 +228,16 @@
 void
 add_blkdev_randomness (int major)
 {
+#ifdef MACH_ENTROPY
+  /* Linux provides a nice way to get random bits, so lets use it */
+  // This generates a LOT of Ctrl-Cs for some reason. No idea whats
+  // going on here
+  
+  // THe problem is that mach only has 1 block device, floppy (major 3- Ctrl-C)
+  // so this is useless for entropic sources. If we ever get more block devices
+  // Uncomment this to get it for additional entropy
+  //entropy_putchar(major);
+#endif
 }
 
 void
only in patch2:
unchanged:
--- linux/dev/glue/net.c	27 Mar 2007 22:47:11 -0000	1.1.4.7
+++ linux/dev/glue/net.c	10 Jul 2007 15:13:28 -0000
@@ -97,6 +97,11 @@
 #include <linux/etherdevice.h>
 #include <linux/wireless.h>
 
+#ifdef MACH_KERNEL
+#ifdef MACH_ENTROPY
+#include <device/entropy.h>
+#endif // MACH_KERNEL
+#endif // MACH_ENTROPY
 extern int linux_intr_pri;
 
 /* One of these is associated with each instance of a device.  */
@@ -299,6 +304,11 @@
   ph->length = (skb->len - sizeof (struct ether_header)
 		+ sizeof (struct packet_header));
 
+#ifdef MACH_ENTROPY
+  // Grab the packet for entropy purposes
+  entropy_putdata(ph + 1, skb->len - sizeof(struct ether_header));
+#endif
+
   dev_kfree_skb (skb, FREE_READ);
 
   net_kmsg(kmsg)->sent = FALSE; /* Mark packet as received.  */
only in patch2:
unchanged:
--- linux/dev/include/linux/blk.h	5 Apr 2001 06:39:21 -0000	1.2
+++ linux/dev/include/linux/blk.h	10 Jul 2007 15:13:28 -0000
@@ -90,7 +90,7 @@
 #endif /* CONFIG_BLK_DEV_MD */
 
 extern void set_device_ro(kdev_t dev,int flag);
-void add_blkdev_randomness(int major);
+extern void add_blkdev_randomness(int major);
 
 extern int floppy_init(void);
 extern void rd_load(void);
@@ -136,7 +136,11 @@
 #define DEVICE_NR(device) (MINOR(device))
 #define DEVICE_ON(device)
 #define DEVICE_OFF(device)
+
+// HACK
+#ifndef MACH_ENTROPY
 #define DEVICE_NO_RANDOM
+#endif
 
 #elif (MAJOR_NR == FLOPPY_MAJOR)
 
