Netboot Mailing List (by thread)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible to cross build mknbi-dos under DOS?



Hello,

Mike Hammer <mike-hammer@usa.net> wrote:
> It seems there's Dev86 tools (bcc, as86 and ld86) for DOS
> in the form of binaries.  Would it be possible to build
> "mknbi-dos" under DOS?

You would definitely have to change a couple of things in the source code,
most probably the file handling stuff. Why not simply try it? Please let
me know if you have any success.
I once got a patch for mknbi-dos, but for an older version, which I have
attached below. You will probably have to change the patch a little bit
for the later versions of netboot. Oh, and the patch required gcc and all
the other GNU tools for MSDOS. They are available on every simtel mirror.

gero.

--- netboot/mknbi-dos/mknbi.c	Wed Jan 29 12:17:36 1997
+++ mknbi-dos4msdos/mknbi.c	Tue Apr  8 13:14:52 1997
@@ -685,7 +685,7 @@
 	fprintf(stderr, "%s: No output file name given\n", progname);
 	exit(EXIT_FAILURE);
   }
-  if ((outfile = creat(outname, 0644)) < 0) {
+  if ((outfile = fileno(fopen(outname, "w+b"))) < 0) {
 	perror(outname);
 	exit(EXIT_FAILURE);
   }
@@ -745,5 +745,8 @@
   if (verbose > 1)
 	dump_header(&header);
 
+  close(rdimage);
+  if (remove("TMPFILE")<0)
+        printf("\nError while removing the temporary file!");
   exit(EXIT_SUCCESS);
 }
--- netboot/mknbi-dos/openrd.c	Sun Mar  9 12:56:50 1997
+++ mknbi-dos4msdos/openrd.c	Tue Apr  8 13:14:54 1997
@@ -120,7 +120,7 @@
   int i;
 
   /* Isolate file name */
-  if ((cp = strrchr(path, '/')) == NULL)
+  if ((cp = strrchr(path, '\\')) == NULL)
 	cp = path;
   else
 	cp++;
@@ -199,7 +199,7 @@
   while ((ent = readdir(dirp)) != NULL) {
 	if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
 		continue;
-	sprintf(tmppath, "%s/%s", path, ent->d_name);
+        sprintf(tmppath, "%s\\%s", path, ent->d_name);
 	if (stat(tmppath, &sbuf) != 0) {
 		perror(tmppath);
 		exit(EXIT_FAILURE);
@@ -434,7 +435,7 @@
   int readsize;
   int infile;
 
-  if ((infile = open(fsp->path, O_RDONLY)) < 0) {
+  if ((infile = fileno(fopen(fsp->path, "r+b"))) < 0) {
 	perror(fsp->path);
 	exit(EXIT_FAILURE);
   }
@@ -571,7 +572,7 @@
 	exit(EXIT_FAILURE);
   }
   if ((sbuf.st_mode & S_IFMT) == S_IFREG) {
-	if ((rdfile = open(name, O_RDONLY)) < 0) {
+        if ((rdfile = fileno(fopen(name, "r+b"))) < 0) {
 		perror(name);
 		exit(EXIT_FAILURE);
 	}
@@ -592,7 +593,7 @@
   /*
    * Create a temporary file to receive the ramdisk image.
    */
-  if ((tmprd = tmpfile()) == NULL) {
+  if ((tmprd = fopen("tmpfile","w+b")) == NULL) {
 	fprintf(stderr, "%s: cannot create temporary file\n", progname);
 	exit(EXIT_FAILURE);
   }
--- netboot/common.h	Sun Mar  2 17:00:46 1997
+++ mknbi-dos4msdos/common.h	Tue Apr  8 13:14:47 1997
@@ -20,6 +20,20 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+/* geaendert von Karsten am 27.03.1997 */
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned long __u32;
+
+#define SIZEOF_UNSIGNED_CHAR 1
+#define SIZEOF_UNSIGNED_INT 4
+#define SIZEOF_UNSIGNED_SHORT 2
+#define SIZEOF_UNSIGNED_LONG 4
+
+#define MAXNAMLEN 255
+
+/* bis hier*/
+
 
 /*
  * Some general definitions for compiling on different systems
@@ -40,7 +54,7 @@
 # include <stdlib.h>
 #else
 # ifdef HAVE_MALLOC_H
-#  include <malloc.h>
+#  include <\gnu\include\malloc.h>
 # else
 voidstar malloc();
 void free();

-- 
Unix: it's a nice place to live, but you wouldn't want to visit there.
--
Gero Kuhlmann, Hannover     0511/6497525 (Voice)        gero@gkminix.han.de



For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.