Here are my current diffs from filo. 

They produce a working filo on ubuntu and I have used the filo on dbe62 
and alix1c. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Index: makerules
===================================================================
--- makerules	(revision 53)
+++ makerules	(working copy)
@@ -7,7 +7,7 @@
 CPPFLAGS = -nostdinc -imacros $(TOPDIR)/config.h -I$(TOPDIR)/include -I$(GCCINCDIR) -MD
 # grub part needs no-strict-aliasing!
 CFLAGS = -Wall -Os -fomit-frame-pointer -fno-common -ffreestanding \
-	 -fno-strict-aliasing -Wno-unused 
+	 -fno-strict-aliasing -Wno-pointer-sign -Wno-unused  -fno-stack-protector
 
 ASFLAGS = -D__ASSEMBLY__
 RANLIB = ranlib
Index: i386/timer.c
===================================================================
--- i386/timer.c	(revision 53)
+++ i386/timer.c	(working copy)
@@ -105,7 +105,7 @@
 	return (end - start) * CLOCK_TICK_RATE / (1000*LATCH);
 }
 
-static unsigned long long cpu_khz;
+static unsigned long long cpu_khz = 100000;
 void setup_timers(void)
 {
 	if (!cpu_khz) {
Index: i386/segment.c
===================================================================
--- i386/segment.c	(revision 53)
+++ i386/segment.c	(working copy)
@@ -49,7 +49,6 @@
     unsigned d0, d1, d2;
     struct gdtarg gdtarg;
 #define ALIGNMENT 0x1000
-
     prog_addr = virt_to_phys(&_start);
     prog_size = virt_to_phys(&_end) - virt_to_phys(&_start);
     debug("Current location: %#lx-%#lx\n", prog_addr, prog_addr+prog_size-1);
Index: drivers/ide.c
===================================================================
--- drivers/ide.c	(revision 53)
+++ drivers/ide.c	(working copy)
@@ -1125,21 +1125,31 @@
 #ifdef SUPPORT_PCI
 static int find_ide_controller(struct controller *ctrl, int ctrl_index)
 {
-	int pci_index;
+	int compat_index;
+	int cur_index;
 	struct pci_dev *dev;
 	unsigned int mask;
 
-	/* A PCI IDE controller has two channels (pri, sec) */
-	pci_index = ctrl_index >> 1;
-
-	/* Find a IDE storage class device */
-	dev = pci_find_device(-1, -1, 0x0180, -1, pci_index); // S-ATA first.
+	/* Find a IDE storage class device and count the compatability*/
+	compat_index=0;
+	dev=0;
+	for (cur_index=0;cur_index<=ctrl_index;cur_index++)
+	{
+		//SATA first.
+		if (!(cur_index&1)) dev = pci_find_device(-1, -1, 0x0180, -1, cur_index/2);
+		if (!dev) break;
+	}
+	for (;cur_index<=ctrl_index;cur_index++)
+	{
+		//IDE.
+		if (!(cur_index&1)) dev = pci_find_device(-1, -1, 0x0101, -1, cur_index/2);
+		if (!dev) break;
+		if (!(dev->prog_if&(cur_index&1?4:1))) compat_index++;
+	}
+	if (compat_index) compat_index--;
 	if (!dev) {
-		dev = pci_find_device(-1, -1, 0x0101, -1, pci_index);
-		if (!dev) {
-			debug("PCI IDE #%d not found\n", pci_index);
-			return -1;
-		}
+		debug("PCI IDE #%d not found\n", ctrl_index);
+		return -1;
 	}
 
 	debug("found PCI IDE controller %04x:%04x prog_if=%#x\n",
@@ -1163,7 +1173,7 @@
 		ctrl->ctrl_base &= ~3;
 	} else {
 		debug("compatibility mode\n");
-		if (find_ide_controller_compat(ctrl, ctrl_index) != 0)
+		if (find_ide_controller_compat(ctrl, compat_index) != 0)
 			return -1;
 	}
 	debug("cmd_base=%#x ctrl_base=%#x\n", ctrl->cmd_base, ctrl->ctrl_base);
@@ -1192,7 +1202,7 @@
 	struct controller *ctrl;
 	int ctrl_index;
 	struct harddisk_info *info;
-
+	debug("ide_probe drive #%d\n", drive);
 	if (drive >= IDE_MAX_DRIVES) {
 		printf("Unsupported drive number\n");
 		return -1;
@@ -1202,6 +1212,7 @@
 	ctrl_index = drive >> 1;
 
 	ctrl = &controllers[ctrl_index];
+	debug("ctrl %d base %x\n", ctrl, ctrl->cmd_base);
 	if (ctrl->cmd_base == 0) {
 		if (find_ide_controller(ctrl, ctrl_index) != 0) {
 			printf("IDE channel %d not found\n", ctrl_index);
