[uClibc]uclib and sysVinit

Simon Posnjak simon.posnjak at siol.net
Mon Sep 23 08:49:31 UTC 2002


On Mon, 2002-09-23 at 00:48, Erik Andersen wrote:
> On Sun Sep 22, 2002 at 10:28:44PM +0200, Simon Posnjak wrote:
> > #include <stdio.h>
> > #include <sys/reboot.h>
> > 
> > int
> > main ()  {
> >     fprintf (stdout, "Rebooting system!\n");
> >     reboot (RB_AUTOBOOT);
> >     return 0;
> > }
> > 
> > but when reboot line is called from sysvinits halt
> > it hangs the board and I have to reset the power supply. Can anybody
> > tell me why this could happen. (Oh, this works correctly with libc)
> 
> That is truly wierd.  I just checked and the reboot system call
> in uClibc (uClibc/libc/sysdeps/linux/common/syscalls.c) matches
> up with glibc-2.2.5/sysdeps/unix/sysv/linux/reboot.c almost
> exactly (names and style differ, actual code is the same).
> Perhaps what you are seeing is really a symptom of some other
> problem...  Can you boot with 'init=/bin/sh' and try the above
> reboot program?  Does that make a difference?

The above program all ways works correctly. The halt program from
sysVinit is problematic. While digging through src I found this:

#if defined(__GLIBC__)
#  include <sys/reboot.h>
#endif

#define BMAGIC_HARD     0x89ABCDEF
#define BMAGIC_SOFT     0
#define BMAGIC_REBOOT   0x01234567
#define BMAGIC_HALT     0xCDEF0123
#define BMAGIC_POWEROFF 0x4321FEDC

#if defined(__GLIBC__)
  #define init_reboot(magic) reboot(magic)
#else
  #define init_reboot(magic) _reboot(0xfee1dead, 672274793, magic)
#endif

Could this make some weird problems? I'm kind of lost here (I spend the
whole weekend trying to find what is the couse of this and it seams it
is some have connecteted to uClib)

	Regards Simon

-- 
Simon Posnjak
http://klada.dyndns.org




More information about the uClibc mailing list