Kirill Elagin | 10 Jun 2011 23:48
Picon
Gravatar

[sysvinit-devel] Unmounting root fs

Hello,

I'm currently working on a project which requires booting Gentoo from a file on an NTFS partition.

We've encountered a problem related to unmounting root fs (we need this to close underlying NTFS partition gracefully). It is impossible to unmount root while init is running so we had to add a new 'exec' command to inittab which replaces init whith another executable (capable of unmounting root). Please, take a look at our patch and consider adding proposed feature to sysvinit.

Thank you.


--
Кирилл Елагин
Florian H. | 14 Jun 2011 17:31
Favicon

[sysvinit-devel] sysvinit-2.88dsf will not compile

Hey,

I am trying to make sysvinit 2.88 on an embedded linux system (Motorola
Set Top Box VIP1710).

$ uname -a
Linux 192.168.1.121 2.4.30 #1 Thu Jan 11 14:28:39 CET 2007 mips
GNU/Linux

But it throws following error:

192.168.1.121/usr/local/sysvinit-2.88dsf$ make all
make -C src all
make[1]: Entering directory `/usr/local/sysvinit-2.88dsf/src'
cc -ansi -O2 -fomit-frame-pointer -W -Wall -D_GNU_SOURCE   -c -o
hddown.o hddown.c
In file included from /usr/include/linux/fs.h:26,
                 from hddown.c:39:
/usr/include/asm/bitops.h:585: error: syntax error before "int"
make[1]: *** [hddown.o] Error 1
make[1]: Leaving directory `/usr/local/sysvinit-2.88dsf/src'
make: *** [all] Error 2

Any idea?

--
Florian Hülsmann
f <at> fpg.de.hm

Petter Reinholdtsen | 14 Jun 2011 18:11

Re: [sysvinit-devel] sysvinit-2.88dsf will not compile

[Florian Hülsmann]
> In file included from /usr/include/linux/fs.h:26,
>                  from hddown.c:39:
> /usr/include/asm/bitops.h:585: error: syntax error before "int"
> make[1]: *** [hddown.o] Error 1
> make[1]: Leaving directory `/usr/local/sysvinit-2.88dsf/src'
> make: *** [all] Error 2
> 
> Any idea?

Looking at the content of linee 585 in /usr/include/asm/bitops.h on
your system seem like the most obvious way forward.  When you did
this, what did you discover?

Happy hacking,
--

-- 
Petter Reinhodtsen

Mike Frysinger | 14 Jun 2011 18:37
Picon
Favicon
Gravatar

Re: [sysvinit-devel] sysvinit-2.88dsf will not compile

On Tue, Jun 14, 2011 at 11:31, Florian H. wrote:
> $ uname -a
> Linux 192.168.1.121 2.4.30 #1 Thu Jan 11 14:28:39 CET 2007 mips
>
> cc -ansi -O2 -fomit-frame-pointer -W -Wall -D_GNU_SOURCE   -c -o
> hddown.o hddown.c
> In file included from /usr/include/linux/fs.h:26,
>                 from hddown.c:39:
> /usr/include/asm/bitops.h:585: error: syntax error before "int"
> make[1]: *** [hddown.o] Error 1

this is a problem with your distro kernel headers.  i doubt it's a bug
in sysvinit.
-mike

Florian H. | 14 Jun 2011 18:35
Favicon

Re: [sysvinit-devel] sysvinit-2.88dsf will not compile

[Petter Reinholdtsen] 
> Looking at the content of linee 585 in /usr/include/asm/bitops.h on
> your system seem like the most obvious way forward.  When you did
> this, what did you discover?

Lines from 585 of that file on:

static inline int test_bit(int nr, volatile void *addr)
{
        return 1UL & (((const volatile unsigned long *) addr)[nr >>
SZLONG_LOG] >> (nr & SZLONG_MASK));
}

As I'm not that familiar with C coding for Linux, I simply compared this
function to some of the surrounding ones that have the keyword
"__inline__" instead of "inline". Changing this keyword for the function
test_bit made 'make' running through compilation.

--
Florian Hülsmann

Karel Zak | 21 Jun 2011 12:01
Picon
Favicon
Gravatar

[sysvinit-devel] deprecate sysvinit mountpoint(1)


 Hi,

 I have reimplemented the mountpoint(1) command for libmount. The new
 implementation will be available in the next util-linux release
 (2.20).  I think that the command should be maintained in the same
 place as mount(8) command.

 Would be possible to disable the old version in sysvinit suite and
 not install this version by default?

    Karel

--

-- 
 Karel Zak  <kzak <at> redhat.com>
 http://karelzak.blogspot.com

Dr. Werner Fink | 21 Jun 2011 13:16
Picon
Gravatar

Re: [sysvinit-devel] deprecate sysvinit mountpoint(1)

On Tue, Jun 21, 2011 at 12:01:16PM +0200, Karel Zak wrote:
> 
>  Hi,
> 
>  I have reimplemented the mountpoint(1) command for libmount. The new
>  implementation will be available in the next util-linux release
>  (2.20).  I think that the command should be maintained in the same
>  place as mount(8) command.
> 
>  Would be possible to disable the old version in sysvinit suite and
>  not install this version by default?

What about the attached patch?  If OK I'd like to submit it ;)

     Werner

--

-- 
System V style init programs - http://savannah.nongnu.org/projects/sysvinit/

Dr. Werner Fink | 21 Jun 2011 13:19
Picon
Gravatar

Re: [sysvinit-devel] deprecate sysvinit mountpoint(1)

On Tue, Jun 21, 2011 at 01:16:59PM +0200, Werner Fink wrote:
> On Tue, Jun 21, 2011 at 12:01:16PM +0200, Karel Zak wrote:
> > 
> >  Hi,
> > 
> >  I have reimplemented the mountpoint(1) command for libmount. The new
> >  implementation will be available in the next util-linux release
> >  (2.20).  I think that the command should be maintained in the same
> >  place as mount(8) command.
> > 
> >  Would be possible to disable the old version in sysvinit suite and
> >  not install this version by default?
> 
> What about the attached patch?  If OK I'd like to submit it ;)
> 
>      Werner

Oops pressed enter to early

--

-- 
System V style init programs - http://savannah.nongnu.org/projects/sysvinit/
Attachment (x): text/x-patch, 1350 bytes
Dr. Werner Fink | 21 Jun 2011 13:27
Picon
Gravatar

Re: [sysvinit-devel] [PATCH] automatically spawn agetty on kernel consoles

On Thu, May 26, 2011 at 08:23:30AM +0200, Ludwig Nussel wrote:
> The feature is useful for developers and admins that occasionally need
> to boot with e.g. console=ttyS0.
> The built in default can be overridden via inittab for each device. An
> entry like "S0::off:" turns off the getty on ttyS0.
> ---
>  src/init.c |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 74 insertions(+), 0 deletions(-)

Ludwig?

Please check out the code of src/consoles.c and src/consoles.h
which does a similar job by not only using "/proc/cmdline" but
also "/proc/consoles" or "/sys/class/tty" if available.

Nonetheless a configure option as mentioned by Mike should be also
added.

   Werner

> diff --git a/src/init.c b/src/init.c
> index d379fb2..13deef7 100644
> --- a/src/init.c
> +++ b/src/init.c
>  <at>  <at>  -1243,6 +1243,76  <at>  <at>  void startup(CHILD *ch)
>  	}
>  }
>  
> +#ifdef __linux__
> +static
> +void check_kernel_console()
> +{
> +	FILE* fp;
> +	char buf[4096];
> +	if ((fp = fopen("/proc/cmdline", "r")) == 0) {
> +		return;
> +	}
> +	if (fgets(buf, sizeof(buf), fp)) {
> +		char* p = buf;
> +		while ((p = strstr(p, "console="))) {
> +			char* e;
> +			p += strlen("console=");
> +			for (e = p; *e; ++e) {
> +				switch (*e) {
> +					case '-' ... '9':
> +					case 'A' ... 'Z':
> +					case '_':
> +					case 'a' ... 'z':
> +						continue;
> +				}
> +				break;
> +			}
> +			if (p != e) {
> +				CHILD* old;
> +				int dup = 0;
> +				char id[8] = {0};
> +				char dev[32] = {0};
> +				strncpy(dev, p, MIN(sizeof(dev), (unsigned)(e-p)));
> +				if (!strncmp(dev, "tty", 3))
> +					strncpy(id, dev+3, sizeof(id));
> +				else
> +					strncpy(id, dev, sizeof(id));
> +
> +				for(old = newFamily; old; old = old->next) {
> +					if (!strcmp(old->id, id)) {
> +						dup = 1;
> +					}
> +				}
> +				if (!dup) {
> +					CHILD* ch = imalloc(sizeof(CHILD));
> +					ch->action = RESPAWN;
> +					strcpy(ch->id, id);
> +					strcpy(ch->rlevel, "2345");
> +					sprintf(ch->process, "/sbin/agetty -L -s 115200,38400,9600 %s vt102", dev);
> +					ch->next = NULL;
> +					for(old = family; old; old = old->next) {
> +						if (strcmp(old->id, ch->id) == 0) {
> +							old->new = ch;
> +							break;
> +						}
> +					}
> +					/* add to end */
> +					for(old = newFamily; old; old = old->next) {
> +						if (!old->next) {
> +							old->next = ch;
> +							break;
> +						}
> +					}
> +
> +					initlog(L_VB, "added agetty on %s with id %s", dev, id);
> +				}
> +			}
> +		}
> +	}
> +	fclose(fp);
> +	return;
> +}
> +#endif
>  
>  /*
>   *	Read the inittab file.
>  <at>  <at>  -1455,6 +1525,10  <at>  <at>  void read_inittab(void)
>     */
>    if (fp) fclose(fp);
>  
> +#ifdef __linux__
> +  check_kernel_console();
> +#endif
> +
>    /*
>     *	Loop through the list of children, and see if they need to
>     *	be killed. 
> -- 
> 1.7.3.4
> 

--

-- 
 Dr. Werner Fink -- Software Engineer Consultant
 SuSE LINUX Products GmbH,  Maxfeldstrasse 5,  Nuernberg,  Germany
 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer,  HRB 21284 (AG Nuernberg)
 phone: +49-911-740-53-0,  fax: +49-911-3206727,  www.opensuse.org
------------------------------------------------------------------
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Ludwig Nussel | 21 Jun 2011 14:37
Picon
Gravatar

Re: [sysvinit-devel] [PATCH] automatically spawn agetty on kernel consoles

Dr. Werner Fink wrote:
> On Thu, May 26, 2011 at 08:23:30AM +0200, Ludwig Nussel wrote:
> > The feature is useful for developers and admins that occasionally need
> > to boot with e.g. console=ttyS0.
> > The built in default can be overridden via inittab for each device. An
> > entry like "S0::off:" turns off the getty on ttyS0.
> > ---
> >  src/init.c |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 74 insertions(+), 0 deletions(-)
> 
> Ludwig?
> 
> Please check out the code of src/consoles.c and src/consoles.h
> which does a similar job by not only using "/proc/cmdline" but
> also "/proc/consoles" or "/sys/class/tty" if available.
> 
> Nonetheless a configure option as mentioned by Mike should be also
> added.

Yes, I'm on it but other work got more important.

cu
Ludwig

--

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 


Gmane