Skip to contentSkip to conversation

init.asm - 0.03 (19-Jun-2002) - asmutils 0.18

DISCUSSION Bodo Giannone 4 participants 6 messages Apr 29, 2008 – May 30, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

I am the maintainer of BG-Tiny Linux Bootdisk.

The tiny init version included in asmutils-0.18 (init.asm 0.03, 19-Jun-2002) is exactly what I was looking for to integrate into BG-Tiny Linux Bootdisk. Unfortunately I am havging some problems I cannot resolve myself due to lacking assembler skills.

I want to start /bin/sh on tty1-4 without using getty or login. Unfortunately directly after booting I get the following error message:
"can't access tty, job control turned off". This could mean that init does not activate the ttys completely. Is there a possibility to change that?

The sh I am using is ash from BusyBox 1.3.2. If I try to use sh.asm from asmutils-0.18 I only get a segfault.

I am using linux kernel 2.4.36.2 and uClibc 0.9.27 (linked statically).

It would be great if someone had a suggestion.

Many thanks in andvance.

Greetings,

Bodo Giannone

#1 lore raw
Quoted 3 lines · Bodo Giannone

Hello,

I am the maintainer of BG-Tiny Linux Bootdisk.

Thank you. I downloaded it and tried it. Sure is tiny! Seemed to work fine. (unlike "a-linux" which hung on me the last time I tried it, IIRC)

Quoted 10 lines

The tiny init version included in asmutils-0.18 (init.asm 0.03, 19-Jun-2002) is exactly what I was looking for to integrate into BG-Tiny Linux Bootdisk. Unfortunately I am havging some problems I cannot resolve myself due to lacking assembler skills.

I want to start /bin/sh on tty1-4 without using getty or login. Unfortunately directly after booting I get the following error message:
"can't access tty, job control turned off". This could mean that init does not activate the ttys completely. Is there a possibility to change that?

Always a "possibility"! I'm gradually acquiring a few assembly skills... but I'm not sure what "init" is supposed to do. Quite a difference between the asmutils "init" and /sbin/init on my system!!! The "init" you're using comes from Busybox, right?

Quoted 2 lines

The sh I am using is ash from BusyBox 1.3.2. If I try to use sh.asm from asmutils-0.18 I only get a segfault.

Hmmm. It seems to work okay for me - that's launching it from my "usual" shell or from the shell from Busybox (I guess) that I get after booting your disk... and mounting the partition with asmutils on it - not "from scratch". How would I see this segfault?

Quoted 3 lines

I am using linux kernel 2.4.36.2 and uClibc 0.9.27 (linked statically).

It would be great if someone had a suggestion.

I'd be willing to attempt to modify the asmutils "init", if I knew what it needed to do differently. Anyone know where I can find a "newbie's quickstart guide to init"? Maybe I should look at the Busybox code...

That's not much of a "suggestion". I just wanted to give ya some encouragement. It "should" be a "possibility" to fix any problems you're having with asmutils.

Best,
Frank

#2 lore raw

When running your shell on a tty, you may be missing such fun syscalls as setsid, setpgid, tcsetpgrp, etc., that may be necessary for the process to feel like it's in control of its destiny and its terminal. Double check what the C version of init does before you do the same.

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] A programming language is low level
when its programs require attention to the irrelevant.
-- Alan Perlis

2008/5/1 Frank Kotler <[email protected]>:

Quoted 60 lines
Quoted 4 lines · Bodo Giannone

Hello,

I am the maintainer of BG-Tiny Linux Bootdisk.

Thank you. I downloaded it and tried it. Sure is tiny! Seemed to work fine.
(unlike "a-linux" which hung on me the last time I tried it, IIRC)

Quoted 11 lines

The tiny init version included in asmutils-0.18 (init.asm 0.03, 19-Jun-2002) is exactly what I was looking for to integrate into BG-Tiny Linux Bootdisk. Unfortunately I am havging some problems I cannot resolve myself due to lacking assembler skills.

I want to start /bin/sh on tty1-4 without using getty or login. Unfortunately directly after booting I get the following error message:
"can't access tty, job control turned off". This could mean that init does not activate the ttys completely. Is there a possibility to change that?

Always a "possibility"! I'm gradually acquiring a few assembly skills...
but I'm not sure what "init" is supposed to do. Quite a difference between the asmutils "init" and /sbin/init on my system!!! The "init" you're using comes from Busybox, right?

Quoted 3 lines

The sh I am using is ash from BusyBox 1.3.2. If I try to use sh.asm from asmutils-0.18 I only get a segfault.

Hmmm. It seems to work okay for me - that's launching it from my "usual"
shell or from the shell from Busybox (I guess) that I get after booting your disk... and mounting the partition with asmutils on it - not "from scratch". How would I see this segfault?

Quoted 4 lines

I am using linux kernel 2.4.36.2 and uClibc 0.9.27 (linked statically).

It would be great if someone had a suggestion.

I'd be willing to attempt to modify the asmutils "init", if I knew what it
needed to do differently. Anyone know where I can find a "newbie's quickstart guide to init"? Maybe I should look at the Busybox code...

That's not much of a "suggestion". I just wanted to give ya some
encouragement. It "should" be a "possibility" to fix any problems you're having with asmutils.

Best,
Frank

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-assembly"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Frank Kotler

Hello Frank and all others,

Quoted 16 lines
Quoted 1 line

I am the maintainer of BG-Tiny Linux Bootdisk.

Thank you. I downloaded it and tried it. Sure is tiny! Seemed to work fine. (unlike "a-linux" which hung on me the last time I tried it, IIRC)

Quoted 10 lines

The tiny init version included in asmutils-0.18 (init.asm 0.03, 19-Jun-2002) is exactly what I was looking for to integrate into BG-Tiny Linux Bootdisk. Unfortunately I am havging some problems I cannot resolve myself due to lacking assembler skills.

I want to start /bin/sh on tty1-4 without using getty or login. Unfortunately directly after booting I get the following error message:
"can't access tty, job control turned off". This could mean that init does not activate the ttys completely. Is there a possibility to change that?

Quoted 3 lines

Always a "possibility"! I'm gradually acquiring a few assembly skills... but I'm not sure what "init" is supposed to do. Quite a difference between the asmutils "init" and /sbin/init on my system!!!

You are right. Normally init is supposed to execute some initscripts at bootup time and then to start getty on several virtual terminals. At shutdown time it should start/stop again some initscripts and then shut down the system. However most of this is not really required for a small rescue system like BG-Tiny Linux Bootdisk.

The init from asmutils at bootup first starts an init script and then executes /sbin/sh (or whatever is hardcoded) on /dev/tty1-4. It is something like a simple but effective combination of init/getty/login.

Quoted 1 line

The "init" you're using comes from Busybox, right?

Yes, the init used until now comes from Busybox. But due to ram- and diskspace reasons I would like to change it to the one from asmutils.

Quoted 7 lines
Quoted 2 lines

The sh I am using is ash from BusyBox 1.3.2. If I try to use sh.asm from asmutils-0.18 I only get a segfault.

Hmmm. It seems to work okay for me - that's launching it from my "usual" shell or from the shell from Busybox (I guess) that I get after booting your disk... and mounting the partition with asmutils on it - not "from scratch". How would I see this segfault?

sh from asmutils taken by itself works fine. It segfaults only in combination with init from asmutils. At least it does so on my system.

If I use another type of sh, for example ash from busybox I get the following error and no segfault: "can't access tty, job control turned off".

I think the cause could be the same. It could probably mean that init does not activate the ttys completely.

Quoted 11 lines
Quoted 3 lines

I am using linux kernel 2.4.36.2 and uClibc 0.9.27 (linked statically).

It would be great if someone had a suggestion.

I'd be willing to attempt to modify the asmutils "init", if I knew what it needed to do differently. Anyone know where I can find a "newbie's quickstart guide to init"? Maybe I should look at the Busybox code...

That's not much of a "suggestion". I just wanted to give ya some encouragement. It "should" be a "possibility" to fix any problems you're having with asmutils.

Thank You very much. I am looking forward to Your answer. Have a nice weekend.

Greetings,

Bodo Giannone

#4 lore raw

Bodo Giannone wrote:

...

Quoted 2 lines

If I use another type of sh, for example ash from busybox I get the following error and no segfault: "can't access tty, job control turned off".

From the Busybox FAQ:

--------------------
Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell?

Job control will be turned off since your shell can not obtain a
controlling
terminal. This typically happens when you run your shell on
/dev/console.
The kernel will not provide a controlling terminal on the /dev/console device. Your should run your shell on a normal tty such as tty1 or
ttyS0
and everything will work perfectly. If you <em>REALLY</em> want
your shell
to run on /dev/console, then you can hack your kernel (if you are
into that
sortof thing) by changing drivers/char/tty_io.c to change the lines
where
it sets "noctty = 1;" to instead set it to "0". I recommend you
instead
run your shell on a real console...
-------------------

That's what it says...

Quoted 2 lines

I think the cause could be the same. It could probably mean that init does not activate the ttys completely.

Agreed. I took a quick look at tty_io.c to see what noctty=1/0 does for us - that may be what init needs to do(?). No enlightenment yet (I'm not a good C programmer and not "oriented" in the kernel... don't expect too much).

The asmutils init does this:

sys_ioctl [tty_fd], TCGETS, tty_termios
sys_ioctl [tty_fd], TCSETSW, tty_termios

As a wild-asmed guess, I'm guessing we may want to tweak some flags in between. I need to study it some more, but that's the current theory...

I don't know if I know enough to help you with this, Bodo, but it's an "interesting puzzle".

Best,
Frank

#5 lore raw

Hello,

Quoted 19 lines
Quoted 3 lines

If I use another type of sh, for example ash from busybox I get the following error and no segfault: "can't access tty, job control turned off".

From the Busybox FAQ:

--------------------
Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell?

Job control will be turned off since your shell can not obtain a
controlling
terminal. This typically happens when you run your shell on
/dev/console.
The kernel will not provide a controlling terminal on the /dev/console device. Your should run your shell on a normal tty such as tty1 or
ttyS0
and everything will work perfectly. If you <em>REALLY</em> want your
shell

Quoted 8 lines

to run on /dev/console, then you can hack your kernel (if you are into
that
sortof thing) by changing drivers/char/tty_io.c to change the lines
where
it sets "noctty = 1;" to instead set it to "0". I recommend you
instead
run your shell on a real console...
-------------------

Bodo haven't you got my mail from april ?

i've sent you a test program in C to determine if the controlling tty stuff would fix the problem ... haven't got an answer so far from you

karsten