[BusyBox] question : how to run my shell on /dev/ttyS0 instead of /dev/console

Bernhard Fischer rep.nop at aon.at
Fri May 27 09:43:25 UTC 2005


On Fri, May 27, 2005 at 05:04:19PM +0800, Tomko wrote:
>Thank you very much for your reply, but there is something i am not clear:
>
>1. Why kernel default to not providing controlling terminal on /dev/console 
>? 
>2. what is the relationship of /dev/console and /dev/tty?
>
>3. which device do /dev/console pointing to ? 
>
>4. It is not surprising that we can use ctrl-C to terminate process on our 
>i386 linux , is that means the shell of it is not running on /dev/console ? 
>If so , where the shell is running on for our Desktop computer?
>
>5. where should i put the script :
>sh </dev/ttyS0 >/dev/ttyS0 2>&1 &
>in order to run my shell on /dev/ttyS0 at startup ?
>
>
>Hope anyone can give me a hand.
>
>
>Regards,
>TOM
>
>On Friday 27 May 2005 07:12, Tomko wrote:
>
>>>Hi everyone,
>>>
>>>I find that the control-C doesn't work with my shell and i find the 
>>>message talking about this problem in the FAQ of the homepage, but i am 
>>>new to linux and can i ask the following questions?
>>>
>>>1. how do i know where my shell running on ?  And what means "run on" as 
>>>shell is one of the process in the kernel.
running "tty" should print the tty you're running on. 
>> 
>>
>
>"To run on" a char device = to have this device opened for stdin/out/err
>and to have it as a controlling tty for the process.
>
>Controlling tty is a tty from which user can send SIGINT via Ctrl-C, etc.
>It is possible to run without one, but it isn't fun. You won't be able
>to Ctrl-C.
>
>
>>>2. i am actually using /dev/ttyS0 (UART) to be the inout of my embedded 
>>>linux system , is that means i am using /dev/ttyS0 to be the console?
>> 
>>
>
>just spawn sh on it from init process:
>
>sh </dev/ttyS0 >/dev/ttyS0 2>&1 &

I may be misunderstanding what you are trying to do, but can't you just boot
with tty=/dev/ttyS0 and then run your getty on ttyS0?
>
>>>3. i find that in the init process of kernel , it write  
>>>"sys_open("/dev/console", O_RDWR, 0) " , it seems the kernel default to 
>>>open /dev/console , do i need to make any changes to this ?
>> 
>>
>
>You can, but you don't really need to.
>
>NB: /dev/console is deliberately made so that it can never be a controlling
>tty for anything.
>
>
>>>4.  the most important one : how can i run my shell on /dev/ttyS0 
>>>instead of running on /dev/console ? Do i need to change any code?
>> 
>>
>
>See above.
>--
>vda



More information about the busybox mailing list