How to disable Ctrl-C during init (initial ramdisk / normal init )

Yoann Allain yallain at avilinks.com
Tue May 30 01:07:46 PDT 2006


Rob Landley a écrit :

>On Monday 29 May 2006 3:59 am, Yoann Allain wrote:
>  
>
>>>According to http://busybox.net/downloads/BusyBox.html#item_init the first
>>>field of busybox init lines is the device to run it on (the /dev/ prefix
>>>is
>>>
>>>optional), and the default is tty0, so you might want to change:
>>>::sysinit:/etc/init.d/rcS
>>>
>>>into:
>>>
>>>console::sysinit:/etc/init.d/rcS
>>>
>>>Not that I've tried it...
>>>
>>>Rob
>>>      
>>>
>>Well I've tried with
>>
>>console::sysinit:/etc/init.d/rcS
>>
>>but I was still able to stop the init with Ctrl-C... But with
>>
>>null::sysinit:/etc/init.d/rcS
>>
>>All the signals seems to be ignored so the init goes till the end, although
>>I have no more messages printed, but in my case this is not a problem.
>>    
>>
>
>In theory /dev/console shouldn't send a signal for ctrl-c no matter what it's 
>hooked up to.  (That's the kernel handling that, not us.)  That said, I 
>haven't personally tried hitting ctrl-c under /dev/console when 
>console=ttyS0, so I can't say for sure.
>
>Are you using a vanilla kernel, or one somebody pated?
>
>  
>
Yes we're actually using a patched kernel, but nothing seems different 
on this part. In the other hand, I'm using ttyS0 for console so perhaps 
this is it...


>>The next thing was to do the same with /linuxrc file that I use in a
>>initial ramdisk. His purpose is to load a MMC driver which is used to mount
>>the root filesystem during last part of init. I could also stop this script
>>with Ctrl-C. I found one solution by modifying the kernel file do_mount.c :
>>I replace /dev/console by /dev/null in do_linuxrc function. And this way I
>>cannot stop the driver loading. I was also thinking of replacing /linuxrc
>>script by a small C program which would do something like system("insmod
>>mmc_drv.o") after having disabled signals (SIGINT). But I don't know what
>>solution is best, if there is one enough good...
>>    
>>
>
>*shrug*.  You also have the source to busybox init.  init/init.c around line 
>419 or so is where the signal handlers are reset to run a child process.  The 
>only problem is, when you get around to running the other things (like login) 
>it goes through the same general code path...
>
>  
>
>Rob
>  
>

Yes I've noticed it. So thank you very much.

Yoann



More information about the busybox mailing list