2008-06-05 00:20:16     How to make the linux run a program at startup?

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-06-05 00:20:16     How to make the linux run a program at startup?

Zhi Qiang Zhang (CHINA)

Message: 56712   

 

Hi,

 

I want to make linux to run a program after startup, I add a line to /etc/rc to run my program. It is ok to run my program after startup if I connect the console by UART, but the program can't be run if I disconnect the UART console, what is the problem?

 

 

 

Regards,

 

ZhangZQ

QuoteReplyEditDelete

 

 

2008-06-05 06:33:58     Re: How to make the linux run a program at startup?

Yi Li (CHINA)

Message: 56729   

 

Why not start the program in background using "&"?

QuoteReplyEditDelete

 

 

2008-06-05 10:28:22     Re: How to make the linux run a program at startup?

Mike Frysinger (UNITED STATES)

Message: 56733   

 

what do you mean by "disconnect the UART console" ?

QuoteReplyEditDelete

 

 

2008-06-05 10:44:08     Re: How to make the linux run a program at startup?

Zhi Qiang Zhang (CHINA)

Message: 56738   

 

That is not the problem. Let me explain more detail.

 

Supposing the /etc/rc file contains these lines

 

#

# Do random network setup

#

#dhcpcd &

ifconfig eth0 192.168.1.133 up

ifconfig lo 127.0.0.1

inetd &

 

 

after the system startup, the IP was set to 192.168.1.133 and there is a telnetd in the system, I can telnet to this system. Now I disconnect the the UART console cable, and power on the system, but can't telnet.

 

It seems that, the system can bootup and run the command specified in /etc/rc file correctly with a UART console cable plugged, while the system can't bootup without a UART console cable. Is that true?

 

 

 

Regards,

 

ZhangZQ

QuoteReplyEditDelete

 

 

2008-06-05 10:57:16     Re: How to make the linux run a program at startup?

Mike Frysinger (UNITED STATES)

Message: 56742   

 

you have not provided a proper /etc/iniittab then.  simpleinit exits because you've given it nothing to do.  review your /etc/inittab and give it something to monitor.

QuoteReplyEditDelete

 

 

2008-06-05 11:26:37     Re: How to make the linux run a program at startup?

Zhi Qiang Zhang (CHINA)

Message: 56747   

 

Here is my /etc/inittab file

 

root:/> cat /etc/inittab

# inittab for uClinux

# Format:

# ttyline:termcap-entry:getty-command

#inet:ttyS0:/bin/inetd

#httpd:unknown:/bin/httpd

#sh:unknown:/bin/sh

#ttyS0::respawn:-/bin/sh

#sh:console:respawn:/bin/sh

#console::askfirst:-/bin/sh

 

slog:unknown:/sbin/syslogd -n

klog:unknown:/sbin/klogd -n

root:/>

 

 

 

Is there something need to be modified? Thanks.

 

 

 

Regards,

 

ZhangZQ

QuoteReplyEditDelete

 

 

2008-06-05 11:40:29     Re: How to make the linux run a program at startup?

Mike Frysinger (UNITED STATES)

Message: 56749   

 

so all you did was unplug the serial cable ?  you didnt modify your console= in your bootargs ?

QuoteReplyEditDelete

 

 

2008-06-05 20:51:46     Re: How to make the linux run a program at startup?

Zhi Qiang Zhang (CHINA)

Message: 56776   

 

Actually, not only unplug the serial cable, my board has not a RS-232 transceiver(such as MAX3232) in my board because it is only for debug. I made a external RS-232 transceiver module and connect to the pin TX,RX in BF531(pin 81, 82).

 

What I mean "unplug the serial cable" is remove that external RS-232 transceiver module, so that PIN 81, 82 will be floated. Is that the problem?

 

 

 

Regards,

 

ZhangZQ

QuoteReplyEditDelete

 

 

2008-06-05 22:45:23     Re: How to make the linux run a program at startup?

Mike Frysinger (UNITED STATES)

Message: 56779   

 

i really dont know how you've wired things, so you'd need to hook up a different debugging channel (like jtag) to see what the Blackfin is doing

 

QuoteReplyEditDelete

 

 

2008-06-05 23:35:22     Re: How to make the linux run a program at startup?

Zhi Qiang Zhang (CHINA)

Message: 56781   

 

Please view this picture, http://www.pro-eda.net/BF531.jpg.

 

 

 

Regards,

 

ZhangZQ

Attachments

    Outcomes