Re: savecore broken because kern.bootfile is set wrong

2000-11-14 Thread Matthew Jacob


Should be fixed.


 Savecore isn't working in -current, dying in my case with "read:
 invalid argument".  (This is on an Alpha -- I don't have an i386
 -current machine to test it on at the moment.)  I traced it down to
 the fact that getbootfile() is returning "kernel" -- not the full
 pathname as the man page promises.  This seems to be because the
 "kern.bootfile" sysctl variable isn't getting set correctly:
 
 alpha# sysctl kern.bootfile
 kern.bootfile: kernel
 
 Because I had an old "/kernel" file and savecore runs in "/", it was
 finding the wrong kernel.
 
 This seems to be some sort of coordination problem between the loader
 and the kernel and, maybe, the Alpha SRM.  Can anybody shed some light
 on it?
 
 Also, in "src/sys/boot/common/boot.c" we still have this:
 
 static const char *default_bootfiles = "kernel.ko";
 
 which isn't right any more.
 
 John
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-current" in the body of the message
 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-13 Thread Matthew Jacob


 
 Though the alpha code (alpha/libalpha/bootinfo.c) also fill in a lot of
 stuff in bi, it has no reference at all to "kernelname". Did it ever
 work? :-)
 

Hmm. Maybe not. I'd convinced myself that the loader is currently just
passing "kernel" either as an environmental variable or in bootinfo, but
you're right about the loader.

Time to fix...

-matt




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-12 Thread Daniel C. Sobral

Matthew Jacob wrote:
 
  Also, in "src/sys/boot/common/boot.c" we still have this:
 
  static const char *default_bootfiles = "kernel.ko";
 
  which isn't right any more.
 
 Absolutely wrong, yes.
 
 Look at kern_mib.c:
 
 
 char kernelname[MAXPATHLEN] = "/kernel";/* XXX bloat */
 
 SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
 kernelname, sizeof kernelname, "Name of kernel file booted");
 
 This is also wrong now.

In loader(8), the environment variable "bootfile" contains a list of
file names that will be tried for the kernel name. The environment
variable "kernelname" is set to the full path name to the kernel (or so
I believe :) when the kernel is loaded. This is done in
common/load_elf.c and common/load_aout.c. The function elf_loadfile(),
for instance, receives the name of the module/kernel to be loaded, and
set kernelname to that if it is a kernel and the load is succesful.

Since that function uses open(filename, ...), it is garanteed that it
needs to receive the full path.

Of course, none of this works with the device/slice[/partition] that has
the kernel isn't mounted later as root. :-)

Afterwards, I don't know how this information gets passed to the kernel.
On i386, this happens:

kernelname = getenv("kernelname");
i386_getdev(NULL, kernelname, kernelpath);
bi.bi_kernelname = VTOP(kernelpath);

Though the alpha code (alpha/libalpha/bootinfo.c) also fill in a lot of
stuff in bi, it has no reference at all to "kernelname". Did it ever
work? :-)

-- 
Daniel C. Sobral(8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

He has been convicted of criminal possession of a clue with intent to
distribute.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-12 Thread Daniel C. Sobral

Matthew Jacob wrote:
 
 Something actually was changed at some point perhaps?
 On i386, kernelname is dug out of bootinfo and copied
 (in assembler).
 
 On alpha:
 
 p = getenv("kernelname");
 if (p)
 strncpy(kernelname, p, sizeof(kernelname) - 1);
 
 
 Did the loader used to set kernelname as an environment variable?

Yes, kernelname is set in common/load_elf.c. The i386 code strips it of
any device prefix, though. The alpha code would do well to do the same.

-- 
Daniel C. Sobral(8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

He has been convicted of criminal possession of a clue with intent to
distribute.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-12 Thread Daniel C. Sobral

Mike Smith wrote:
 
  Did the loader used to set kernelname as an environment variable?
 
 It should still do it. (The forth code handles this)  My only Alpha is
 running -stable, and $kernelname is set correctly there (see the output
 of 'kenv').

Not the forth code. The forth code doesn't get anywhere near kernelname.

-- 
Daniel C. Sobral(8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

He has been convicted of criminal possession of a clue with intent to
distribute.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-11 Thread Bruce Evans

On Fri, 10 Nov 2000, Matthew Jacob wrote:

 Something actually was changed at some point perhaps?
 On i386, kernelname is dug out of bootinfo and copied
 (in assembler).

i386's used to have this bug.  This was fixed in:

RCS file: /home/ncvs/src/sys/i386/i386/locore.s,v
Working file: locore.s
head: 1.138
...

revision 1.53
date: 1995/06/28 04:42:25;  author: davidg;  state: Exp;  lines: +10 -4
Make path to kernel absolute if it is passed in relative. This fixes
a related bug in some of the new 'foo'boot bootstrap code that has been
added over the past months. This change makes it no longer necessary
for the bootstrap to fix up the path (i.e. it can be removed).


This is still necessary, because at least old bootstraps (and boot2)
don't pass the full pathname (except someone broke old bootstraps
(and boot2)).

 On alpha:
 
 p = getenv("kernelname");
 if (p)
 strncpy(kernelname, p, sizeof(kernelname) - 1);

Bruce



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



savecore broken because kern.bootfile is set wrong

2000-11-10 Thread John Polstra

Savecore isn't working in -current, dying in my case with "read:
invalid argument".  (This is on an Alpha -- I don't have an i386
-current machine to test it on at the moment.)  I traced it down to
the fact that getbootfile() is returning "kernel" -- not the full
pathname as the man page promises.  This seems to be because the
"kern.bootfile" sysctl variable isn't getting set correctly:

alpha# sysctl kern.bootfile
kern.bootfile: kernel

Because I had an old "/kernel" file and savecore runs in "/", it was
finding the wrong kernel.

This seems to be some sort of coordination problem between the loader
and the kernel and, maybe, the Alpha SRM.  Can anybody shed some light
on it?

Also, in "src/sys/boot/common/boot.c" we still have this:

static const char *default_bootfiles = "kernel.ko";

which isn't right any more.

John


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread Matthew Jacob



 Savecore isn't working in -current, dying in my case with "read:
 invalid argument".  (This is on an Alpha -- I don't have an i386
 -current machine to test it on at the moment.)  I traced it down to
 the fact that getbootfile() is returning "kernel" -- not the full
 pathname as the man page promises.  This seems to be because the
 "kern.bootfile" sysctl variable isn't getting set correctly:
 
 alpha# sysctl kern.bootfile
 kern.bootfile: kernel
 
 Because I had an old "/kernel" file and savecore runs in "/", it was
 finding the wrong kernel.
 
 This seems to be some sort of coordination problem between the loader
 and the kernel and, maybe, the Alpha SRM.  Can anybody shed some light

Not SRM. SRM cares not.


 on it?
 
 Also, in "src/sys/boot/common/boot.c" we still have this:
 
 static const char *default_bootfiles = "kernel.ko";
 
 which isn't right any more.


Absolutely wrong, yes.

Look at kern_mib.c:

 
char kernelname[MAXPATHLEN] = "/kernel";/* XXX bloat */
 
SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
kernelname, sizeof kernelname, "Name of kernel file booted");


This is also wrong now.

It's somewhat problematic in that the actual kernel name is kernel, still, but
the path that it is found in depends on where the loader actually found it-
that's contingent on module_path.

I don't know whether the loader is supposed to modify kernelname in the loaded
kernel to have the actual path or not. 

-matt




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread John Baldwin


On 11-Nov-00 Matthew Jacob wrote:
 
 
 Savecore isn't working in -current, dying in my case with "read:
 invalid argument".  (This is on an Alpha -- I don't have an i386
 -current machine to test it on at the moment.)  I traced it down to
 the fact that getbootfile() is returning "kernel" -- not the full
 pathname as the man page promises.  This seems to be because the
 "kern.bootfile" sysctl variable isn't getting set correctly:
 
 alpha# sysctl kern.bootfile
 kern.bootfile: kernel
 
 Because I had an old "/kernel" file and savecore runs in "/", it was
 finding the wrong kernel.
 
 This seems to be some sort of coordination problem between the loader
 and the kernel and, maybe, the Alpha SRM.  Can anybody shed some light
 
 Not SRM. SRM cares not.
 
 
 on it?
 
 Also, in "src/sys/boot/common/boot.c" we still have this:
 
 static const char *default_bootfiles = "kernel.ko";
 
 which isn't right any more.
 
 
 Absolutely wrong, yes.
 
 Look at kern_mib.c:
 
  
 char kernelname[MAXPATHLEN] = "/kernel";/* XXX bloat */
  
 SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
 kernelname, sizeof kernelname, "Name of kernel file booted");
 
 
 This is also wrong now.
 
 It's somewhat problematic in that the actual kernel name is kernel, still,
 but
 the path that it is found in depends on where the loader actually found it-
 that's contingent on module_path.
 
 I don't know whether the loader is supposed to modify kernelname in the
 loaded
 kernel to have the actual path or not. 

It is supposed to.  Looks like a bug in the alpha startup code somewhere:

 uname -a
FreeBSD laptop.baldwin.cx 5.0-CURRENT FreeBSD 5.0-CURRENT #40: Fri Nov 10
15:17:48 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/LAPTOP-card 
i386
 sysctl kern.bootfile
kern.bootfile: /boot/kernel.card/kernel
 uname -a
FreeBSD baz.osd.bsdi.com 5.0-CURRENT FreeBSD 5.0-CURRENT #48: Fri Nov  3
12:37:16 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/BAZ  alpha
 sysctl kern.bootfile
kern.bootfile: kernel

 -matt

-- 

John Baldwin [EMAIL PROTECTED] -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread Matthew Jacob

  kernel to have the actual path or not. 
 
 It is supposed to.  Looks like a bug in the alpha startup code somewhere:
 
  uname -a
 FreeBSD laptop.baldwin.cx 5.0-CURRENT FreeBSD 5.0-CURRENT #40: Fri Nov 10
 15:17:48 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/LAPTOP-card 
 i386
  sysctl kern.bootfile
 kern.bootfile: /boot/kernel.card/kernel
  uname -a
 FreeBSD baz.osd.bsdi.com 5.0-CURRENT FreeBSD 5.0-CURRENT #48: Fri Nov  3
 12:37:16 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/BAZ  alpha
  sysctl kern.bootfile
 kern.bootfile: kernel
 

Urgle. Okay.




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread Matthew Jacob


   kernel to have the actual path or not. 
  
  It is supposed to.  Looks like a bug in the alpha startup code somewhere:
  
   uname -a
  FreeBSD laptop.baldwin.cx 5.0-CURRENT FreeBSD 5.0-CURRENT #40: Fri Nov 10
  15:17:48 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/LAPTOP-card 
  i386
   sysctl kern.bootfile
  kern.bootfile: /boot/kernel.card/kernel
   uname -a
  FreeBSD baz.osd.bsdi.com 5.0-CURRENT FreeBSD 5.0-CURRENT #48: Fri Nov  3
  12:37:16 PST 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/BAZ  alpha
   sysctl kern.bootfile
  kern.bootfile: kernel
  
 
 Urgle. Okay.


Something actually was changed at some point perhaps?
On i386, kernelname is dug out of bootinfo and copied
(in assembler).

On alpha:

p = getenv("kernelname");
if (p)
strncpy(kernelname, p, sizeof(kernelname) - 1);
 

Did the loader used to set kernelname as an environment variable?
At any rate, this should be easy enough to fix (doing so right now).

-matt






To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread Mike Smith

 Something actually was changed at some point perhaps?
 On i386, kernelname is dug out of bootinfo and copied
 (in assembler).
 
 On alpha:
 
 p = getenv("kernelname");
 if (p)
 strncpy(kernelname, p, sizeof(kernelname) - 1);
  
 
 Did the loader used to set kernelname as an environment variable?

It should still do it. (The forth code handles this)  My only Alpha is 
running -stable, and $kernelname is set correctly there (see the output 
of 'kenv').

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
   V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: savecore broken because kern.bootfile is set wrong

2000-11-10 Thread Matthew Jacob


Well, things are more broken than I thought.

The -current loader for alpha is passing "kernel"
in the bootinfo structure- not the full pathname.
Loader bug.

What's amusing is that kenv does see a full pathname.

So, now why did the lines below fail to see the pathname?

Hmmm.. ponders

-matt




  Something actually was changed at some point perhaps?
  On i386, kernelname is dug out of bootinfo and copied
  (in assembler).
  
  On alpha:
  
  p = getenv("kernelname");
  if (p)
  strncpy(kernelname, p, sizeof(kernelname) - 1);
   
  
  Did the loader used to set kernelname as an environment variable?
 
 It should still do it. (The forth code handles this)  My only Alpha is 
 running -stable, and $kernelname is set correctly there (see the output 
 of 'kenv').
 
 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message