--- ecos-2.0/packages/hal/i386/arch/v2_0/cdl/hal_i386.cdl	2008-02-16 16:09:08.000000000 +0100
+++ ecos-2.0-rdc/packages/hal/i386/arch/v2_0/cdl/hal_i386.cdl	2006-03-14 19:45:36.000000000 +0100
@@ -164,7 +164,8 @@
                                                                                                                                
         cdl_component CYGPKG_REDBOOT_I386_LINUX_EXEC {
             display        "Provide the exec command in RedBoot"
-            flavor         none
+            flavor         bool
+            default_value  1 
             parent         CYGPKG_REDBOOT_I386_OPTIONS
             active_if      CYGBLD_BUILD_REDBOOT_WITH_EXEC
             description    "
--- ecos-2.0/packages/hal/i386/arch/v2_0/src/redboot_linux_exec.c	2008-02-16 16:09:08.000000000 +0100
+++ ecos-2.0-rdc/packages/hal/i386/arch/v2_0/src/redboot_linux_exec.c.org	2005-02-25 04:29:47.000000000 +0100
@@ -88,6 +88,12 @@
 
 #define PARAM_ALT_MEM_K		*(cyg_uint32*)(PARAM+0x1e0)
 #define PARAM_E820NR		*(cyg_uint8*) (PARAM+0x1e8)
+// hlin ==>
+#define PARAM_DF_ROOT		*(cyg_uint16*) (PARAM+0x1fc)
+#define PARAM_LOADER		*(cyg_uint8*) (PARAM+0x210)
+#define PARAM_INITRD_ADDR	*(cyg_uint32*)(PARAM+0x218)
+#define PARAM_INITRD_LEN	*(cyg_uint32*)(PARAM+0x21c)
+// hlin <==
 #define PARAM_VID_MODE		*(cyg_uint16*)(PARAM+0x1fa)
 #define PARAM_E820MAP		(struct e820entry*)(PARAM+0x2d0);
 #define PARAM_CMDLINE		(char *)(PARAM+0x3400)
@@ -100,13 +106,19 @@
     int  wait_time, res;
     bool  base_addr_set, length_set, cmd_line_set;
     bool ramdisk_addr_set, ramdisk_size_set;
+    // hlin ==>
+    // bool initrd_size_set = true ;
+    // cyg_uint32 initrd_size ;
+    // hlin <==
     unsigned long base_addr, length;
     unsigned long ramdisk_addr, ramdisk_size;
     struct option_info opts[6];
+    // struct option_info opts[7];		// hlin
     char *cmd_line;
     char line[8];
     cyg_uint32 mem_size;
     cyg_uint32 int15_e801;
+    cyg_uint32 off ;
     extern char __tramp_start__[], __tramp_end__[];
     trampoline_func trampoline = (trampoline_func)CYGHWR_REDBOOT_I386_TRAMPOLINE_ADDRESS;
     struct bootsect_header *bs_header;
@@ -119,7 +131,7 @@
     // Round length up to the next quad word
     length = (length + 3) & ~0x3;
 
-    ramdisk_size = 4096*1024;
+    ramdisk_size = 0x3d000 ;
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM,
               &wait_time, &wait_time_set, "wait timeout");
     init_opts(&opts[1], 'b', true, OPTION_ARG_TYPE_NUM,
@@ -132,6 +144,10 @@
               &ramdisk_addr, &ramdisk_addr_set, "ramdisk_addr");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM,
               &ramdisk_size, &ramdisk_size_set, "ramdisk_size");
+    /* hlin
+    init_opts(&opts[6], 'i', true, OPTION_ARG_TYPE_NUM,
+              &initrd_size, &initrd_size_set, "initrd_size");
+     */
     if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "starting address"))
     {
         return;
@@ -162,6 +178,42 @@
         return;
     }
 
+    // hlin
+#define TSOP_FLASH 1
+    mem_size = HAL_MEM_REAL_REGION_TOP(0x2000000);  // hlin 16M -> 32M
+    //mem_size = HAL_MEM_REAL_REGION_TOP(0x1000000);  // hlin 16M -> 32M
+    // hlin
+    diag_printf("\nmem_size: %04x\n",mem_size) ;
+    // mem_size = 0x2000000 ;  // hlin 16M -> 32M
+    mem_size >>= 10;   // convert from bytes to kilobytes.
+    // Result of int15 ax=0xe801
+    int15_e801 = mem_size - 1024 ; // 1M+ only
+    off = (cyg_uint32)( ((mem_size<<10)-ramdisk_size-(128<<10)) & 0xfffff000 ) ;
+#ifdef TSOP_FLASH
+    asm volatile (
+	"	movw	$0xcf8, %%dx;\n"
+	"	movl	$0x80003840, %%eax;\n"
+	"	outl	%%eax, %%dx;\n"
+	"	movb	$0xfc, %%dl;\n"
+	"	inl	%%dx, %%eax;\n"
+	"	orl	$0x07ff0000, %%eax;\n"
+	"	outl	%%eax, %%dx;\n"
+       	: : : "eax","edx" ) ;
+    // copy kernel to 0x400000
+    memcpy( (char *)base_addr,(char *)0xffc00000,0x200000 ) ;
+    // copy initrd to high memory
+    memcpy( (char *)off,(char *)0xffe00000,ramdisk_size ) ;
+    asm volatile (
+	"	movw	$0xcf8, %%dx;\n"
+	"	movl	$0x80003840, %%eax;\n"
+	"	outl	%%eax, %%dx;\n"
+	"	movb	$0xfc, %%dl;\n"
+	"	inl	%%dx, %%eax;\n"
+	"	andl	$0xf000ffff, %%eax;\n"
+	"	orl	$0x00010000, %%eax;\n"
+	"	outl	%%eax, %%dx;\n"
+	: : : "eax","edx" ) ;
+#endif TSOP_FLASH
     bs_header = (struct bootsect_header *)base_addr;
     s_header = (struct setup_header *)(base_addr + SECTSIZE);
 
@@ -186,14 +238,10 @@
     base_addr += (setup_sects + 1 ) * SECTSIZE;
     length -= (setup_sects + 1 ) * SECTSIZE;
 
-    mem_size = HAL_MEM_REAL_REGION_TOP(0x1000000);
-    mem_size >>= 10;   // convert from bytes to kilobytes.
-    // Result of int15 ax=0xe801
-    int15_e801 = mem_size - 1024 ; // 1M+ only
 
     // Stop all network devices
 #ifdef CYGPKG_IO_ETH_DRIVERS
-    eth_drv_stop();
+//    eth_drv_stop();
 #endif
 
 #ifdef CYGPKG_IO_PCI
@@ -205,12 +253,14 @@
 #endif
 
     HAL_DISABLE_INTERRUPTS(oldints);
+/* hlin
     HAL_DCACHE_SYNC();
     HAL_ICACHE_DISABLE();
     HAL_DCACHE_DISABLE();
     HAL_DCACHE_SYNC();
     HAL_ICACHE_INVALIDATE_ALL();
     HAL_DCACHE_INVALIDATE_ALL();
+ */
 
     // Clear the data area
     memset ( (void*)PARAM, 0, 512 );
@@ -233,11 +283,12 @@
 
     // Fill in the interesting bits of data area...
     // ... Memory sizes
-    PARAM_EXT_MEM_K = int15_e801;
-    PARAM_ALT_MEM_K = int15_e801;
+    // PARAM_EXT_MEM_K = int15_e801;
+    PARAM_EXT_MEM_K = (cyg_uint16)0 ;
+    PARAM_ALT_MEM_K = (cyg_uint32)int15_e801;
 
     // ... No e820 map!
-    PARAM_E820NR = 0; 	// Length of map
+    PARAM_E820NR = (cyg_uint8)0; 	// Length of map
 
     // ... Video stuff
     PARAM_ORIG_X = xpos;
@@ -247,6 +298,15 @@
     PARAM_ORIG_VIDEO_LINES = 25;
     PARAM_ORIG_VIDEO_ISVGA = 0;
 
+    // hlin
+    PARAM_DF_ROOT = (cyg_uint16)0x0100 ;	// default root device
+    PARAM_LOADER = (cyg_uint8)0x20 ;		// type of loader
+    // off = (cyg_uint32)( (((int15_e801)<<10)-ramdisk_size-(128<<10)) & 0xfffff000 ) ;
+    PARAM_INITRD_ADDR = (cyg_uint32)off ;		// ramdisk address
+    PARAM_INITRD_LEN = (cyg_uint32)ramdisk_size ;	// ramdisk size
+    // hlin
+    diag_printf("initrd %04x len %04x\n",off,ramdisk_size) ;
+
     // Copy trampoline to trampoline address
     memcpy((char *)CYGHWR_REDBOOT_I386_TRAMPOLINE_ADDRESS,
            __tramp_start__,
@@ -352,5 +412,6 @@
 	    "        [-r <ramdisk addr> [-s <ramdisk length>]]\n"
             "        [-c \"kernel command line\"]",
 	    do_linux
+//	    "        [-i <initrd_size>]\n"
     );
 
--- ecos-2.0/packages/hal/i386/pc/v2_0/cdl/hal_i386_pc.cdl	2008-02-16 16:09:08.000000000 +0100
+++ ecos-2.0-rdc/packages/hal/i386/pc/v2_0/cdl/hal_i386_pc.cdl	2005-05-19 13:21:25.000000000 +0200
@@ -384,7 +384,7 @@
                     $(OBJCOPY) -O binary $(PREFIX)/bin/romboot.elf $(PREFIX)/bin/romboot.img
                     dd if=/dev/zero of=$@ bs=1024 count=64 conv=sync
                     dd if=$(@:.bin=.img) of=$@ bs=512 conv=notrunc,sync
-                    dd if=$(PREFIX)/bin/romboot.img of=$@ bs=256 count=1 seek=255 conv=notrunc
+                    dd if=$(PREFIX)/bin/romboot.img of=$@ bs=256 count=5 seek=507 conv=notrunc
                 }
             }
         }            
