Subject: Re: Why don't we have 'options GATEWAY' in GENERIC?
To: None <curt@portal.ca>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 05/22/1996 15:39:05
> Date: Tue, 21 May 1996 23:46:04 -0700 (PDT)
> From: Curt Sampson <curt@portal.ca>

> On Tue, 21 May 1996, Scott Ellis wrote:

[ ...about lack of various options in GENERIC... ]

> This is more than a matter of curiousity for me. I've got a colour
> 3/60 at home which is also the Internet gateway for my network. We
> have to use this because for some reason on my girlfriend's PC, on
> which we just installed Windows 95, the mouse pointer stops working
> as soon as we start a PPP connection. (It works just fine otherwise.
> I don't even want to think about it.)
> 
> Unfortunately, the kernels since 1.1B crash when they try to
> autoconfig the cgfour. So if I compile a new kernel, I don't get
> a cgfour, and thus don't get X. (I can config the bwtwo plane on
> that card to bwtwo0, but unfortunately XSunMono doesn't seem to
> want to find it.)

Has anybody found out what happened with the cg4 driver?
I haven't had much time to work on it...

> Now I do have a 1.1A kernel where the cgfour and X work, but
> unfortuantely it doesn't have options GATEWAY enabled. I thought
> I'd just set the _ipforwarding variable to 1, but I can't do that
> because I can't debug it with gdb because the magic number is wrong.

That is easy to fix.  Attached is a program that can be used to
change the magic number of a file that was "cross-built" on SunOS
(as was the file you are using).  Use it as follows:

	setmagic netbsd 0x870107

Of course, this only works if the files are otherwise compatible,
which they are when I use standard sparc-hosted m68k tools.

Gordon

[ setmagic.c attached ]

/*
 * Set the magic number on an executable.
 */

#include <fcntl.h>
#include <stdio.h>

main(argc,argv)
	int argc;
	char **argv;
{
	int magic_old, magic_new;
	int fd, sz;

	if (argc < 2) {
		fprintf(stderr, "usage: %s filename [0x_newmagic]\n", argv[0]);
		exit(1);
	}
	fd = open(argv[1], ((argc <= 2) ? O_RDONLY : O_RDWR), 0);
	if (fd < 0) {
		perror(argv[1]);
		exit(1);
	}
	sz = read(fd, &magic_old, sizeof(magic_old));
	if (sz != sizeof(magic_old)) {
		fprintf(stderr, "%s: read failed\n", argv[0]);
		exit(1);
	}

	printf("old magic: 0x%x\n", magic_old);

	if (argc > 2) {
		magic_new = strtol(argv[2], NULL, 0);
		lseek(fd, (off_t) 0, 0);
		sz = write(fd, &magic_new, sizeof(magic_new));
		if (sz != sizeof(magic_new)) {
			fprintf(stderr, "%s: write failed\n", argv[0]);
			exit(1);
		}
	}
	exit(0);
}