[ipxe-devel] [PATCH 1/2] Remove non-working image loaders.

Marin Hannache mareo at mareo.fr
Thu Apr 12 21:14:08 UTC 2012


The WinCE, a.out and FreeBSD loaders have been around for a while (since 2005)
and have been designed to be #included by 'core/loader.c' which changed into
'core/image.c'. Since the way it works changed, these old loaders are not
usable anymore and cause compilation failures when enabled in
'config/general.h'.

Signed-off-by: Marin Hannache <mareo at mareo.fr>
---
 src/arch/i386/Makefile              |    7 -
 src/arch/i386/core/aout_loader.c    |  144 -------------
 src/arch/i386/core/freebsd_loader.c |  377 -----------------------------------
 src/arch/i386/core/wince_loader.c   |  273 -------------------------
 src/config/config.c                 |    9 -
 src/config/general.h                |    3 -
 6 files changed, 0 insertions(+), 813 deletions(-)
 delete mode 100644 src/arch/i386/core/aout_loader.c
 delete mode 100644 src/arch/i386/core/freebsd_loader.c
 delete mode 100644 src/arch/i386/core/wince_loader.c

diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
index 068fbd6..ca25833 100644
--- a/src/arch/i386/Makefile
+++ b/src/arch/i386/Makefile
@@ -88,13 +88,6 @@ SRCDIRS 	+= arch/i386/interface/syslinux
 SRCDIRS		+= arch/i386/interface/vmware
 SRCDIRS		+= arch/i386/hci/commands
 
-# The various xxx_loader.c files are #included into core/loader.c and
-# should not be compiled directly.
-#
-NON_AUTO_SRCS	+= arch/i386/core/aout_loader.c
-NON_AUTO_SRCS	+= arch/i386/core/freebsd_loader.c
-NON_AUTO_SRCS	+= arch/i386/core/wince_loader.c
-
 # Include common x86 Makefile
 #
 MAKEDEPS	+= arch/x86/Makefile
diff --git a/src/arch/i386/core/aout_loader.c b/src/arch/i386/core/aout_loader.c
deleted file mode 100644
index f85620e..0000000
--- a/src/arch/i386/core/aout_loader.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* a.out */
-struct exec {
-	unsigned long      a_midmag;	/* flags<<26 | mid<<16 | magic */
-	unsigned long      a_text;	/* text segment size */
-	unsigned long      a_data;	/* initialized data size */
-	unsigned long      a_bss;	/* uninitialized data size */
-	unsigned long      a_syms;	/* symbol table size */
-	unsigned long      a_entry;	/* entry point */
-	unsigned long      a_trsize;	/* text relocation size */
-	unsigned long      a_drsize;	/* data relocation size */
-};
-
-struct aout_state {
-	struct exec head;
-	unsigned long curaddr;
-	int segment;			/* current segment number, -1 for none */
-	unsigned long loc;		/* start offset of current block */
-	unsigned long skip;		/* padding to be skipped to current segment */
-	unsigned long toread;		/* remaining data to be read in the segment */
-};
-
-static struct aout_state astate;
-
-static sector_t aout_download(unsigned char *data, unsigned int len, int eof);
-static inline os_download_t aout_probe(unsigned char *data, unsigned int len)
-{
-	unsigned long start, mid, end, istart, iend;
-	if (len < sizeof(astate.head)) {
-		return 0;
-	}
-	memcpy(&astate.head, data, sizeof(astate.head));
-	if ((astate.head.a_midmag & 0xffff) != 0x010BL) {
-		return 0;
-	}
-	
-	printf("(a.out");
-	aout_freebsd_probe();
-	printf(")... ");
-	/* Check the aout image */
-	start  = astate.head.a_entry;
-	mid    = (((start + astate.head.a_text) + 4095) & ~4095) + astate.head.a_data;
-	end    = ((mid + 4095) & ~4095) + astate.head.a_bss;
-	istart = 4096;
-	iend   = istart + (mid - start);
-	if (!prep_segment(start, mid, end, istart, iend))
-		return dead_download;
-	astate.segment = -1;
-	astate.loc = 0;
-	astate.skip = 0;
-	astate.toread = 0;
-	return aout_download;
-}
-
-static sector_t aout_download(unsigned char *data, unsigned int len, int eof)
-{
-	unsigned int offset;	/* working offset in the current data block */
-
-	offset = 0;
-
-#ifdef AOUT_LYNX_KDI
-	astate.segment++;
-	if (astate.segment == 0) {
-		astate.curaddr = 0x100000;
-		astate.head.a_entry = astate.curaddr + 0x20;
-	}
-	memcpy(phys_to_virt(astate.curaddr), data, len);
-	astate.curaddr += len;
-	return 0;
-#endif
-
-	do {
-		if (astate.segment != -1) {
-			if (astate.skip) {
-				if (astate.skip >= len - offset) {
-					astate.skip -= len - offset;
-					break;
-				}
-				offset += astate.skip;
-				astate.skip = 0;
-			}
-
-			if (astate.toread) {
-				if (astate.toread >= len - offset) {
-					memcpy(phys_to_virt(astate.curaddr), data+offset,
-						len - offset);
-					astate.curaddr += len - offset;
-					astate.toread -= len - offset;
-					break;
-				}
-				memcpy(phys_to_virt(astate.curaddr), data+offset, astate.toread);
-				offset += astate.toread;
-				astate.toread = 0;
-			}
-		}
-
-		/* Data left, but current segment finished - look for the next
-		 * segment.  This is quite simple for a.out files.  */
-		astate.segment++;
-		switch (astate.segment) {
-		case 0:
-			/* read text */
-			astate.curaddr = astate.head.a_entry;
-			astate.skip = 4096;
-			astate.toread = astate.head.a_text;
-			break;
-		case 1:
-			/* read data */
-			/* skip and curaddr may be wrong, but I couldn't find
-			 * examples where this failed.  There is no reasonable
-			 * documentation for a.out available.  */
-			astate.skip = ((astate.curaddr + 4095) & ~4095) - astate.curaddr;
-			astate.curaddr = (astate.curaddr + 4095) & ~4095;
-			astate.toread = astate.head.a_data;
-			break;
-		case 2:
-			/* initialize bss and start kernel */
-			astate.curaddr = (astate.curaddr + 4095) & ~4095;
-			astate.skip = 0;
-			astate.toread = 0;
-			memset(phys_to_virt(astate.curaddr), '\0', astate.head.a_bss);
-			goto aout_startkernel;
-		default:
-			break;
-		}
-	} while (offset < len);
-
-	astate.loc += len;
-
-	if (eof) {
-		unsigned long entry;
-
-aout_startkernel:
-		entry = astate.head.a_entry;
-		done(1);
-
-		aout_freebsd_boot();
-#ifdef AOUT_LYNX_KDI
-		xstart32(entry);
-#endif
-		printf("unexpected a.out variant\n");
-		longjmp(restart_etherboot, -2);
-	}
-	return 0;
-}
diff --git a/src/arch/i386/core/freebsd_loader.c b/src/arch/i386/core/freebsd_loader.c
deleted file mode 100644
index 464f6d9..0000000
--- a/src/arch/i386/core/freebsd_loader.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* bootinfo */
-#define BOOTINFO_VERSION 1
-#define NODEV           (-1)    /* non-existent device */
-#define PAGE_SHIFT      12              /* LOG2(PAGE_SIZE) */
-#define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
-#define PAGE_MASK       (PAGE_SIZE-1)
-#define N_BIOS_GEOM     8
-
-struct bootinfo {
-        unsigned int            bi_version;
-        const unsigned char     *bi_kernelname;
-        struct nfs_diskless     *bi_nfs_diskless;
-                                /* End of fields that are always present. */
-#define bi_endcommon            bi_n_bios_used
-        unsigned int            bi_n_bios_used;
-        unsigned long           bi_bios_geom[N_BIOS_GEOM];
-        unsigned int            bi_size;
-        unsigned char           bi_memsizes_valid;
-        unsigned char           bi_pad[3];
-        unsigned long           bi_basemem;
-        unsigned long           bi_extmem;
-        unsigned long           bi_symtab;
-        unsigned long           bi_esymtab;
-	/* Note that these are in the FreeBSD headers but were not here... */
-	unsigned long           bi_kernend;		/* end of kernel space */
-	unsigned long           bi_envp;		/* environment */
-	unsigned long           bi_modulep;		/* preloaded modules */
-};
-
-static struct bootinfo bsdinfo;
-
-#ifdef ELF_IMAGE
-static Elf32_Shdr *shdr;	/* To support the FreeBSD kludge! */
-static Address symtab_load;
-static Address symstr_load;
-static int symtabindex;
-static int symstrindex;
-#endif
-
-static enum {
-	Unknown, Tagged, Aout, Elf, Aout_FreeBSD, Elf_FreeBSD,
-} image_type = Unknown;
-
-static unsigned int off;
-
-
-#ifdef ELF_IMAGE
-static void elf_freebsd_probe(void)
-{
-	image_type = Elf;
-	if (	(estate.e.elf32.e_entry & 0xf0000000) && 
-		(estate.e.elf32.e_type == ET_EXEC))
-	{
-		image_type = Elf_FreeBSD;
-		printf("/FreeBSD");
-		off = -(estate.e.elf32.e_entry & 0xff000000);
-		estate.e.elf32.e_entry += off;
-	}
-	/* Make sure we have a null to start with... */
-	shdr = 0;
-	
-	/* Clear the symbol index values... */
-	symtabindex = -1;
-	symstrindex = -1;
-	
-	/* ...and the load addresses of the symbols  */
-	symtab_load = 0;
-	symstr_load = 0;
-}
-
-static void elf_freebsd_fixup_segment(void)
-{
-	if (image_type == Elf_FreeBSD) {
-		estate.p.phdr32[estate.segment].p_paddr += off;
-	}
-}
-
-static void elf_freebsd_find_segment_end(void)
-{
-	/* Count the bytes read even for the last block
-	 * as we will need to know where the last block
-	 * ends in order to load the symbols correctly.
-	 * (plus it could be useful elsewhere...)
-	 * Note that we need to count the actual size,
-	 * not just the end of the disk image size.
-	 */
-	estate.curaddr += 
-		(estate.p.phdr32[estate.segment].p_memsz - 
-		estate.p.phdr32[estate.segment].p_filesz);
-}
-
-static int elf_freebsd_debug_loader(unsigned int offset)
-{
-	/* No more segments to be loaded - time to start the
-	 * nasty state machine to support the loading of
-	 * FreeBSD debug symbols due to the fact that FreeBSD
-	 * uses/exports the kernel's debug symbols in order
-	 * to make much of the system work!  Amazing (arg!)
-	 *
-	 * We depend on the fact that for the FreeBSD kernel,
-	 * there is only one section of debug symbols and that
-	 * the section is after all of the loaded sections in
-	 * the file.  This assumes a lot but is somewhat required
-	 * to make this code not be too annoying.  (Where do you
-	 * load symbols when the code has not loaded yet?)
-	 * Since this function is actually just a callback from
-	 * the network data transfer code, we need to be able to
-	 * work with the data as it comes in.  There is no chance
-	 * for doing a seek other than forwards.
-	 *
-	 * The process we use is to first load the section
-	 * headers.  Once they are loaded (shdr != 0) we then
-	 * look for where the symbol table and symbol table
-	 * strings are and setup some state that we found
-	 * them and fall into processing the first one (which
-	 * is the symbol table) and after that has been loaded,
-	 * we try the symbol strings.  Note that the order is
-	 * actually required as the memory image depends on
-	 * the symbol strings being loaded starting at the
-	 * end of the symbol table.  The kernel assumes this
-	 * layout of the image.
-	 *
-	 * At any point, if we get to the end of the load file
-	 * or the section requested is earlier in the file than
-	 * the current file pointer, we just end up falling
-	 * out of this and booting the kernel without this
-	 * information.
-	 */
-
-	/* Make sure that the next address is long aligned... */
-	/* Assumes size of long is a power of 2... */
-	estate.curaddr = (estate.curaddr + sizeof(long) - 1) & ~(sizeof(long) - 1);
-	
-	/* If we have not yet gotten the shdr loaded, try that */
-	if (shdr == 0)
-	{
-		estate.toread = estate.e.elf32.e_shnum * estate.e.elf32.e_shentsize;
-		estate.skip = estate.e.elf32.e_shoff - (estate.loc + offset);
-		if (estate.toread)
-		{
-#if ELF_DEBUG
-			printf("shdr *, size %lX, curaddr %lX\n", 
-				estate.toread, estate.curaddr);
-#endif
-			
-			/* Start reading at the curaddr and make that the shdr */
-			shdr = (Elf32_Shdr *)phys_to_virt(estate.curaddr);
-			
-			/* Start to read... */
-			return 1;
-		}
-	}
-	else
-	{
-		/* We have the shdr loaded, check if we have found
-		 * the indexs where the symbols are supposed to be */
-		if ((symtabindex == -1) && (symstrindex == -1))
-		{
-			int i;
-			/* Make sure that the address is page aligned... */
-			/* Symbols need to start in their own page(s)... */
-			estate.curaddr = (estate.curaddr + 4095) & ~4095;
-			
-			/* Need to make new indexes... */
-			for (i=0; i < estate.e.elf32.e_shnum; i++)
-			{
-				if (shdr[i].sh_type == SHT_SYMTAB)
-				{
-					int j;
-					for (j=0; j < estate.e.elf32.e_phnum; j++)
-					{
-						/* Check only for loaded sections */
-						if ((estate.p.phdr32[j].p_type | 0x80) == (PT_LOAD | 0x80))
-						{
-							/* Only the extra symbols */
-							if ((shdr[i].sh_offset >= estate.p.phdr32[j].p_offset) &&
-								((shdr[i].sh_offset + shdr[i].sh_size) <=
-									(estate.p.phdr32[j].p_offset + estate.p.phdr32[j].p_filesz)))
-							{
-								shdr[i].sh_offset=0;
-								shdr[i].sh_size=0;
-								break;
-							}
-						}
-					}
-					if ((shdr[i].sh_offset != 0) && (shdr[i].sh_size != 0))
-					{
-						symtabindex = i;
-						symstrindex = shdr[i].sh_link;
-					}
-				}
-			}
-		}
-		
-		/* Check if we have a symbol table index and have not loaded it */
-		if ((symtab_load == 0) && (symtabindex >= 0))
-		{
-			/* No symbol table yet?  Load it first... */
-			
-			/* This happens to work out in a strange way.
-			 * If we are past the point in the file already,
-			 * we will skip a *large* number of bytes which
-			 * ends up bringing us to the end of the file and
-			 * an old (default) boot.  Less code and lets
-			 * the state machine work in a cleaner way but this
-			 * is a nasty side-effect trick... */
-			estate.skip = shdr[symtabindex].sh_offset - (estate.loc + offset);
-			
-			/* And we need to read this many bytes... */
-			estate.toread = shdr[symtabindex].sh_size;
-			
-			if (estate.toread)
-			{
-#if ELF_DEBUG
-				printf("db sym, size %lX, curaddr %lX\n", 
-					estate.toread, estate.curaddr);
-#endif
-				/* Save where we are loading this... */
-				symtab_load = estate.curaddr;
-				
-				*((long *)phys_to_virt(estate.curaddr)) = estate.toread;
-				estate.curaddr += sizeof(long);
-				
-				/* Start to read... */
-				return 1;
-			}
-		}
-		else if ((symstr_load == 0) && (symstrindex >= 0))
-		{
-			/* We have already loaded the symbol table, so
-			 * now on to the symbol strings... */
-			
-			
-			/* Same nasty trick as above... */
-			estate.skip = shdr[symstrindex].sh_offset - (estate.loc + offset);
-			
-			/* And we need to read this many bytes... */
-			estate.toread = shdr[symstrindex].sh_size;
-			
-			if (estate.toread)
-			{
-#if ELF_DEBUG
-				printf("db str, size %lX, curaddr %lX\n", 
-					estate.toread, estate.curaddr);
-#endif
-				/* Save where we are loading this... */
-				symstr_load = estate.curaddr;
-				
-				*((long *)phys_to_virt(estate.curaddr)) = estate.toread;
-				estate.curaddr += sizeof(long);
-				
-				/* Start to read... */
-				return 1;
-			}
-		}
-	}
-	/* all done */
-	return 0;
-}
-
-static void elf_freebsd_boot(unsigned long entry) 
-{
-	if (image_type != Elf_FreeBSD)
-		return;
-
-	memset(&bsdinfo, 0, sizeof(bsdinfo));
-	bsdinfo.bi_basemem = meminfo.basememsize;
-	bsdinfo.bi_extmem = meminfo.memsize;
-	bsdinfo.bi_memsizes_valid = 1;
-	bsdinfo.bi_version = BOOTINFO_VERSION;
-	bsdinfo.bi_kernelname = virt_to_phys(KERNEL_BUF);
-	bsdinfo.bi_nfs_diskless = NULL;
-	bsdinfo.bi_size = sizeof(bsdinfo);
-#define RB_BOOTINFO     0x80000000      /* have `struct bootinfo *' arg */  
-	if(freebsd_kernel_env[0] != '\0'){
-		freebsd_howto |= RB_BOOTINFO;
-		bsdinfo.bi_envp = (unsigned long)freebsd_kernel_env;
-	}
-	
-	/* Check if we have symbols loaded, and if so,
-	 * made the meta_data needed to pass those to
-	 * the kernel. */
-	if ((symtab_load !=0) && (symstr_load != 0))
-	{
-		unsigned long *t;
-		
-		bsdinfo.bi_symtab = symtab_load;
-		
-		/* End of symbols (long aligned...) */
-		/* Assumes size of long is a power of 2... */
-		bsdinfo.bi_esymtab = (symstr_load +
-			sizeof(long) +
-			*((long *)phys_to_virt(symstr_load)) +
-			sizeof(long) - 1) & ~(sizeof(long) - 1);
-		
-		/* Where we will build the meta data... */
-		t = phys_to_virt(bsdinfo.bi_esymtab);
-		
-#if ELF_DEBUG
-		printf("Metadata at %lX\n",t);
-#endif
-		
-		/* Set up the pointer to the memory... */
-		bsdinfo.bi_modulep = virt_to_phys(t);
-		
-		/* The metadata structure is an array of 32-bit
-		 * words where we store some information about the
-		 * system.  This is critical, as FreeBSD now looks
-		 * only for the metadata for the extended symbol
-		 * information rather than in the bootinfo.
-		 */
-		/* First, do the kernel name and the kernel type */
-		/* Note that this assumed x86 byte order... */
-		
-		/* 'kernel\0\0' */
-		*t++=MODINFO_NAME; *t++= 7; *t++=0x6E72656B; *t++=0x00006C65;
-		
-		/* 'elf kernel\0\0' */
-		*t++=MODINFO_TYPE; *t++=11; *t++=0x20666C65; *t++=0x6E72656B; *t++ = 0x00006C65;
-		
-		/* Now the symbol start/end - note that they are
-		 * here in local/physical address - the Kernel
-		 * boot process will relocate the addresses. */
-		*t++=MODINFOMD_SSYM | MODINFO_METADATA; *t++=sizeof(*t); *t++=bsdinfo.bi_symtab;
-		*t++=MODINFOMD_ESYM | MODINFO_METADATA; *t++=sizeof(*t); *t++=bsdinfo.bi_esymtab;
-		
-		*t++=MODINFO_END; *t++=0; /* end of metadata */
-		
-		/* Since we have symbols we need to make
-		 * sure that the kernel knows its own end
-		 * of memory...  It is not _end but after
-		 * the symbols and the metadata... */
-		bsdinfo.bi_kernend = virt_to_phys(t);
-		
-		/* Signal locore.s that we have a valid bootinfo
-		 * structure that was completely filled in. */
-		freebsd_howto |= 0x80000000;
-	}
-	
-	xstart32(entry, freebsd_howto, NODEV, 0, 0, 0, 
-		virt_to_phys(&bsdinfo), 0, 0, 0);
-	longjmp(restart_etherboot, -2);
-}
-#endif
-
-#ifdef AOUT_IMAGE
-static void aout_freebsd_probe(void)
-{
-	image_type = Aout;
-	if (((astate.head.a_midmag >> 16) & 0xffff) == 0) {
-		/* Some other a.out variants have a different
-		 * value, and use other alignments (e.g. 1K),
-		 * not the 4K used by FreeBSD.  */
-		image_type = Aout_FreeBSD;
-		printf("/FreeBSD");
-		off = -(astate.head.a_entry & 0xff000000);
-		astate.head.a_entry += off;
-	}
-}
-
-static void aout_freebsd_boot(void)
-{
-	if (image_type == Aout_FreeBSD) {
-		memset(&bsdinfo, 0, sizeof(bsdinfo));
-		bsdinfo.bi_basemem = meminfo.basememsize;
-		bsdinfo.bi_extmem = meminfo.memsize;
-		bsdinfo.bi_memsizes_valid = 1;
-		bsdinfo.bi_version = BOOTINFO_VERSION;
-		bsdinfo.bi_kernelname = virt_to_phys(KERNEL_BUF);
-		bsdinfo.bi_nfs_diskless = NULL;
-		bsdinfo.bi_size = sizeof(bsdinfo);
-		xstart32(astate.head.a_entry, freebsd_howto, NODEV, 0, 0, 0, 
-			virt_to_phys(&bsdinfo), 0, 0, 0);
-		longjmp(restart_etherboot, -2);
-	}
-}
-#endif
diff --git a/src/arch/i386/core/wince_loader.c b/src/arch/i386/core/wince_loader.c
deleted file mode 100644
index f452b65..0000000
--- a/src/arch/i386/core/wince_loader.c
+++ /dev/null
@@ -1,273 +0,0 @@
-#define LOAD_DEBUG	0
-
-static int get_x_header(unsigned char *data, unsigned long now);
-static void jump_2ep();
-static unsigned char ce_signature[] = {'B', '0', '0', '0', 'F', 'F', '\n',};
-static char ** ep;
-
-#define BOOT_ARG_PTR_LOCATION 0x001FFFFC
-
-typedef struct _BOOT_ARGS{
-	unsigned char ucVideoMode;
-	unsigned char ucComPort;
-	unsigned char ucBaudDivisor;
-	unsigned char ucPCIConfigType;
-	
-	unsigned long dwSig;
-	#define BOOTARG_SIG 0x544F4F42
-	unsigned long dwLen;
-	
-	unsigned char ucLoaderFlags;
-	unsigned char ucEshellFlags;
-	unsigned char ucEdbgAdapterType;
-	unsigned char ucEdbgIRQ;
-	
-	unsigned long dwEdbgBaseAddr;
-	unsigned long dwEdbgDebugZone;	
-	unsigned long dwDHCPLeaseTime;
-	unsigned long dwEdbgFlags;
-	
-	unsigned long dwEBootFlag;
-	unsigned long dwEBootAddr;
-	unsigned long dwLaunchAddr;
-	
-	unsigned long pvFlatFrameBuffer;
-	unsigned short vesaMode;
-	unsigned short cxDisplayScreen;
-	unsigned short cyDisplayScreen;
-	unsigned short cxPhysicalScreen;
-	unsigned short cyPhysicalScreen;
-	unsigned short cbScanLineLength;
-	unsigned short bppScreen;
-	
-	unsigned char RedMaskSize;
-	unsigned char REdMaskPosition;
-	unsigned char GreenMaskSize;
-	unsigned char GreenMaskPosition;
-	unsigned char BlueMaskSize;
-	unsigned char BlueMaskPosition;
-} BOOT_ARGS;
-
-BOOT_ARGS BootArgs;
-
-static struct segment_info{
-	unsigned long addr;		// Section Address
-	unsigned long size;		// Section Size
-	unsigned long checksum;		// Section CheckSum
-} X;
-
-#define PSIZE	(1500)			//Max Packet Size
-#define DSIZE  (PSIZE+12)
-static unsigned long dbuffer_available =0;
-static unsigned long not_loadin =0;
-static unsigned long d_now =0;
-
-unsigned long entry;
-static unsigned long ce_curaddr;
-
-
-static sector_t ce_loader(unsigned char *data, unsigned int len, int eof);
-static os_download_t wince_probe(unsigned char *data, unsigned int len)
-{
-	if (strncmp(ce_signature, data, sizeof(ce_signature)) != 0) {
-		return 0;
-	}
-	printf("(WINCE)");
-	return ce_loader;
-}
-
-static sector_t ce_loader(unsigned char *data, unsigned int len, int eof)
-{
-	static unsigned char dbuffer[DSIZE];
-	int this_write = 0;
-	static int firsttime = 1;
-
-	/*
-	 *	new packet in, we have to 
-	 *	[1] copy data to dbuffer,
-	 *
-	 *	update...
-	 *	[2]  dbuffer_available
-	 */
-	memcpy( (dbuffer+dbuffer_available), data, len);	//[1]
-	dbuffer_available += len;	// [2]
-	len = 0;
-
-	d_now = 0;
-	
-#if 0
-	printf("dbuffer_available =%ld \n", dbuffer_available);
-#endif 
-	
-	if (firsttime) 
-	{
-		d_now = sizeof(ce_signature);
-		printf("String Physical Address = %lx \n", 
-			*(unsigned long *)(dbuffer+d_now));
-		
-		d_now += sizeof(unsigned long);
-		printf("Image Size = %ld [%lx]\n", 
-			*(unsigned long *)(dbuffer+d_now), 
-			*(unsigned long *)(dbuffer+d_now));
-		
-		d_now += sizeof(unsigned long);
-		dbuffer_available -= d_now;			
-		
-		d_now = (unsigned long)get_x_header(dbuffer, d_now);
-		firsttime = 0;
-	}
-	
-	if (not_loadin == 0)
-	{
-		d_now = get_x_header(dbuffer, d_now);
-	}
-	
-	while ( not_loadin > 0 )
-	{
-		/* dbuffer do not have enough data to loading, copy all */
-#if LOAD_DEBUG
-		printf("[0] not_loadin = [%ld], dbuffer_available = [%ld] \n", 
-			not_loadin, dbuffer_available);
-		printf("[0] d_now = [%ld] \n", d_now);
-#endif
-		
-		if( dbuffer_available <= not_loadin)
-		{
-			this_write = dbuffer_available ;
-			memcpy(phys_to_virt(ce_curaddr), (dbuffer+d_now), this_write );
-			ce_curaddr += this_write;
-			not_loadin -= this_write;
-			
-			/* reset index and available in the dbuffer */
-			dbuffer_available = 0;
-			d_now = 0;
-#if LOAD_DEBUG
-			printf("[1] not_loadin = [%ld], dbuffer_available = [%ld] \n", 
-				not_loadin, dbuffer_available);
-			printf("[1] d_now = [%ld], this_write = [%d] \n", 
-				d_now, this_write);
-#endif
-				
-			// get the next packet...
-			return (0);
-		}
-			
-		/* dbuffer have more data then loading ... , copy partital.... */
-		else
-		{
-			this_write = not_loadin;
-			memcpy(phys_to_virt(ce_curaddr), (dbuffer+d_now), this_write);
-			ce_curaddr += this_write;
-			not_loadin = 0;
-			
-			/* reset index and available in the dbuffer */
-			dbuffer_available -= this_write;
-			d_now += this_write;
-#if LOAD_DEBUG
-			printf("[2] not_loadin = [%ld], dbuffer_available = [%ld] \n", 
-				not_loadin, dbuffer_available);
-			printf("[2] d_now = [%ld], this_write = [%d] \n\n", 
-				d_now, this_write);
-#endif
-			
-			/* dbuffer not empty, proceed processing... */
-			
-			// don't have enough data to get_x_header..
-			if ( dbuffer_available < (sizeof(unsigned long) * 3) )
-			{
-//				printf("we don't have enough data remaining to call get_x. \n");
-				memcpy( (dbuffer+0), (dbuffer+d_now), dbuffer_available);
-				return (0);
-			}
-			else
-			{
-#if LOAD_DEBUG				
-				printf("with remaining data to call get_x \n");
-				printf("dbuffer available = %ld , d_now = %ld\n", 
-					dbuffer_available, d_now);
-#endif					
-				d_now = get_x_header(dbuffer, d_now);
-			}
-		}
-	}
-	return (0);
-}
-
-static int get_x_header(unsigned char *dbuffer, unsigned long now)
-{
-	X.addr = *(unsigned long *)(dbuffer + now);
-	X.size = *(unsigned long *)(dbuffer + now + sizeof(unsigned long));
-	X.checksum = *(unsigned long *)(dbuffer + now + sizeof(unsigned long)*2);
-
-	if (X.addr == 0)
-	{
-		entry = X.size;
-		done(1);
-		printf("Entry Point Address = [%lx] \n", entry);
-		jump_2ep();		
-	}
-
-	if (!prep_segment(X.addr, X.addr + X.size, X.addr + X.size, 0, 0)) {
-		longjmp(restart_etherboot, -2);
-	}
-
-	ce_curaddr = X.addr;
-	now += sizeof(unsigned long)*3;
-
-	/* re-calculate dbuffer available... */
-	dbuffer_available -= sizeof(unsigned long)*3;
-
-	/* reset index of this section */
-	not_loadin = X.size;
-	
-#if 1
-	printf("\n");
-	printf("\t Section Address = [%lx] \n", X.addr);
-	printf("\t Size = %d [%lx]\n", X.size, X.size);
-	printf("\t Checksum = %ld [%lx]\n", X.checksum, X.checksum);
-#endif
-#if LOAD_DEBUG
-	printf("____________________________________________\n");
-	printf("\t dbuffer_now = %ld \n", now);
-	printf("\t dbuffer available = %ld \n", dbuffer_available);
-	printf("\t not_loadin = %ld \n", not_loadin);
-#endif
-
-	return now;
-}
-
-static void jump_2ep()
-{
-	BootArgs.ucVideoMode = 1;
-	BootArgs.ucComPort = 1;
-	BootArgs.ucBaudDivisor = 1;
-	BootArgs.ucPCIConfigType = 1;	// do not fill with 0
-	
-	BootArgs.dwSig = BOOTARG_SIG;
-	BootArgs.dwLen = sizeof(BootArgs);
-	
-	if(BootArgs.ucVideoMode == 0)
-	{
-		BootArgs.cxDisplayScreen = 640;
-		BootArgs.cyDisplayScreen = 480;
-		BootArgs.cxPhysicalScreen = 640;
-		BootArgs.cyPhysicalScreen = 480;
-		BootArgs.bppScreen = 16;
-		BootArgs.cbScanLineLength  = 1024;
-		BootArgs.pvFlatFrameBuffer = 0x800a0000;	// ollie say 0x98000000
-	}	
-	else if(BootArgs.ucVideoMode != 0xFF)
-	{
-		BootArgs.cxDisplayScreen = 0;
-		BootArgs.cyDisplayScreen = 0;
-		BootArgs.cxPhysicalScreen = 0;
-		BootArgs.cyPhysicalScreen = 0;
-		BootArgs.bppScreen = 0;
-		BootArgs.cbScanLineLength  = 0;
-		BootArgs.pvFlatFrameBuffer = 0;	
-	}
-
-	ep = phys_to_virt(BOOT_ARG_PTR_LOCATION);
-	*ep= virt_to_phys(&BootArgs);
-	xstart32(entry);
-}
diff --git a/src/config/config.c b/src/config/config.c
index 513f054..77cf37b 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -155,18 +155,9 @@ REQUIRE_OBJECT ( nbi );
 #ifdef IMAGE_ELF
 REQUIRE_OBJECT ( elfboot );
 #endif
-#ifdef IMAGE_FREEBSD
-REQUIRE_OBJECT ( freebsd );
-#endif
 #ifdef IMAGE_MULTIBOOT
 REQUIRE_OBJECT ( multiboot );
 #endif
-#ifdef IMAGE_AOUT
-REQUIRE_OBJECT ( aout );
-#endif
-#ifdef IMAGE_WINCE
-REQUIRE_OBJECT ( wince );
-#endif
 #ifdef IMAGE_PXE
 REQUIRE_OBJECT ( pxe_image );
 #endif
diff --git a/src/config/general.h b/src/config/general.h
index ec09502..22a901d 100644
--- a/src/config/general.h
+++ b/src/config/general.h
@@ -94,10 +94,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
  */
 //#define	IMAGE_NBI		/* NBI image support */
 //#define	IMAGE_ELF		/* ELF image support */
-//#define	IMAGE_FREEBSD		/* FreeBSD kernel image support */
 //#define	IMAGE_MULTIBOOT		/* MultiBoot image support */
-//#define	IMAGE_AOUT		/* a.out image support */
-//#define	IMAGE_WINCE		/* WinCE image support */
 //#define	IMAGE_PXE		/* PXE image support */
 //#define	IMAGE_SCRIPT		/* iPXE script image support */
 //#define	IMAGE_BZIMAGE		/* Linux bzImage image support */
-- 
1.7.3.4


-- 
Marin "Mareo" Hannache - hannac_m at epita.fr - EPITA 2015
« C'est donner aux fantasmes, un goût divin
  De les toujours chasser, en les sachant vains. »



More information about the ipxe-devel mailing list