Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

editing rc.local how to?

Status
Not open for further replies.
The first link does not work (unix.stackexchange.com) and the second one is clear enough.

I usually put my stuff in rc.local which is usually empty (dummied) and you need to put your program before the exit(0).

It should be easy but you have not given any details.
 

Yes, all are valid and are different ways to make your app work.

I use rc.local because it runs last and after the system has fully booted.

If you can run it from the command line, it will run from the rc.lcoal without fuss.
 

The 'systemd' method can start your program as a service. It is basically a small text file containing a link to your application and a list of dependencies so it can work out whether all the necessary support programs are running and if not, start them. It is probably better suited to programs you want to run in the background rather than ones interacting directly with the user but it can do both.

'rc.local' as c_mitra explained is just a script that runs after a user is logged in. It is just plain text and contains exactly what you would type at a command prompt achieve the same thing. 'rc.local' lives in '/etc' so to edit it you may need root privileges, for example you might need to use 'sudo nano /etc/rc.local' if nano is the text editor you want to use.

Brian.
 

Hi Mitra,

Since I use powerpc which does not have hard-disk, all I have to do is to rebuild rootfs and do suitable modifications in rc.local as you suggested. Now for the steps, please confirm if the following procedure is valid

1. I place my application (say hello) in /usr/bin directory
2. I edit rc.local and add line hello &
3. rebuild rootfs and fuse it into my target
4. after rebooting, application should auto start

Is that ok and any other steps
 

I guess so; in case the executable is not in found or you want to be sure, just add the full path before the executable.
 

Hi mitra
please excuse me. I am reconfirming this because in several links, they talk about permissions to execute the application, create symlink and so on. So I want to absolutely sure that the method indicated in #7 will actually work. Otherwise my experiment will be iterative one trying to figure out the right method
 

they talk about permissions to execute the application
I usually put all startup routines at the crontab, adding the @reboot prefix, but this file should not be manually eddited, but called from the command line with the sufix -e. It is worthy to be aware that sometimes it is needed to add the sufix sudo before the program/script that is being called there.
 

I am reconfirming this because in several links, they talk about permissions to execute the application,

It runs when you execute the program from command line, right? Just to confirm, run it as root and verify (sudo su) that it is going to run as root also. If in doubt, change permissions for all (a+x) so that anyone can run it.

But I admit that I have never build rootfs for another target.
 

Hi mitra

The proposed method mentioned in #6 actually works like a charm. Now I would like to exit this infinite loop and come back to login prompt. Is there any way to do it?
 

You need to use keypress as a check in the routine. If any key is pressed then exit the routine. Else you can use Ctrl-C to terminate the program. You can also trap Ctrl-C and do something else.
 

Thanks and one last final question. I have to mknode and insmod custom drivers in rc.local. Any proven method? custom drivers are kernel module. Where should I store them and how do i invoke them in rc.local?
 

You can store them anywhere you like but you must provide the full path.

By the way, LSB tells which file should be placed where... (https://en.wikipedia.org/wiki/Linux_Standard_Base)

The usual place is under /lib/modules/ and you will find lots of directories there. Put it in the most appropriate place. It is supposed to look up the right one...

Loading the driver is the first of a series of steps before you can use the driver well. But that depends on the exact nature of the device (assuming it is a device driver).

From the I/O point, all device drivers are files: either character or block based. Writing a driver is easy; but writing a driver that works well is going to cost you many nights.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top