LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 09-27-2019, 07:42 AM   #1
admiral-helmut
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Rep: Reputation: Disabled
How are programs usually started in linux-based embedded systems?


Hello dear people,
I try to find out how programs are usually started in embedded Linux-based devices. In addition to own considerations and web research i wanted to resolve this as a kind of "expert interview" to interview Linux experts. Maybe you can help me?

The idea is to find the actually running programs statically in the file system or dynamically with tools. Therefore, I have to know in which ways these are started after booting. Of course, I have already done my first research. Please correct me:

1.) Directly at / after booting: You adapt your own init start program, in which you start external programs. (Is this realistic?)

2.) Autostart function of the respective distribution, usually in a special config file. Unfortunately very distribution specific. Example gnome-sessionproperties (Ubuntu, Mint) ... rc.local unter Debian... My question: Are there other standardized ways, especially in the embedded environment?

3.) bashrc, is a configuration file of the bash, Entries are executed when the terminal is called. Since bash is under many Linux systems the standard shell, it is possibly a solution. However, the terminal must first be called, which does not happen automatically at system startup.

4.)cron jobs.

How is this usually done in embedded systems? Are there other ways that are possible? Many many thanks
 
Old 09-27-2019, 12:44 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I'm afraid, there is no usual way, it always depends on the requirements.
All what you listed may work. I don't really understand how is it related to "The idea is to find the actually running programs statically in the file system or dynamically with tools."
 
Old 09-27-2019, 12:51 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
I don't see why this should be fundamentally different on embedded Linux systems, as opposed to normal Linux systems?
 
Old 09-30-2019, 05:50 AM   #4
admiral-helmut
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
First of all, thank you both for your answers.

@pan64
"All what you listed may work." This is already a useful information for me. For the context. I want to (Security-) test and fuzz embedded systems, there i need to extract the important programs. I want to write a tool that automatically analizes the filesystem of an firmware image and automatically tries to bring it up and running (qemu...) Then finds the important binaries in filesystem for other tests. So i want to anaylse the init process, the autostart config files, the cron job files etc, for the automatically started programs. I am very new to linux and try to use your expert knowledge to find the ways embedded linux systems start their software. So my question is: Have I forgotten an important start way? How are the important programs in such a system normally started?

@ondoho
Also your answer contains information for me thank you. What would be the expected way in your opinion. The important way to analyse and find the binaries.

Thank you both in advance.

Helmut
 
Old 10-01-2019, 10:54 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

Welcome to LQ!

Quote:
Originally Posted by admiral-helmut View Post
Hello dear people,
I try to find out how programs are usually started in embedded Linux-based devices. In addition to own considerations and web research i wanted to resolve this as a kind of "expert interview" to interview Linux experts. Maybe you can help me?

The idea is to find the actually running programs statically in the file system or dynamically with tools. Therefore, I have to know in which ways these are started after booting. Of course, I have already done my first research. Please correct me:

1.) Directly at / after booting: You adapt your own init start program, in which you start external programs. (Is this realistic?)

2.) Autostart function of the respective distribution, usually in a special config file. Unfortunately very distribution specific. Example gnome-sessionproperties (Ubuntu, Mint) ... rc.local unter Debian... My question: Are there other standardized ways, especially in the embedded environment?

3.) bashrc, is a configuration file of the bash, Entries are executed when the terminal is called. Since bash is under many Linux systems the standard shell, it is possibly a solution. However, the terminal must first be called, which does not happen automatically at system startup.

4.)cron jobs.

How is this usually done in embedded systems? Are there other ways that are possible? Many many thanks
Maybe some of these links may help you from Slackware®-Links
Quote:
Bash:
Bash Reference Manual <- 'Great Manual'
Bash Beginners Guide
Advanced Bash-Scripting Guide 6.1 <- 'Revised + This document is both a tutorial and a reference on shell scripting with Bash' + By Mendel Cooper, <thegrendel.abs(at)gmail.com>
Advanced Bash-Scripting Guide 6.0.05 <- 'This document is both a tutorial and a reference on shell scripting with Bash' + by Mendel Cooper, <thegrendel.abs(at)gmail.com>
Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook <- 'This tutorial is designed for beginners who wish to learn the basics of shell scripting/programming plus introduction to power tools such as awk, sed, etc. It is not help or manual for the shell; while reading this tutorial you can find manual quite useful (type man bash at $ prompt to see manual pages).'
Command Line One liners <- 'commandlinefu.com is the place to record those command-line gems that you return to again and again. Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down'
Guides:
Linux Command Guide <- 'Linux Shortcuts & Commands'
Ultimate Linux Newbie Guide <- 'A complete reference for new Linux users who wish to set up and administer their own Linux home computer, workstation and/or their home or small office network.'
LinuxSelfHelp <- 'Need help with linux? Help yourself...'
Linux Help tuXfiles <- Learn your system
Getting Started with Linux <- 'The purpose of this article is to help get you over some rough spots typically encountered by first-time users.'
Boot:
Linux Boot process <- IA32 Hardware
Boot loader showdown: Getting to know LILO and GRUB <- 'pros and cons of two of the more popular boot loaders -- LILO and GRUB' + A good summary for basic understanding
The Linux Boot Process <- 'What happens before the login prompt'
Giving it the Boot <- 'This is motivated primarily by the desire to help new Linux users get started. The basics are applicable to virtually any computer system. The discussion assumes the “PC” architecture originally developed by IBM using Intel and compatible processors.'
EasyBCD 1.6 <- 'NeoSmart Technologies' multiple award-winning answer to tweaking the new Windows Vista bootloader. There is no easier way to quickly boot right into Linux, Mac OS X, or BSD straight from the Windows Vista bootloader'
10 boot time parameters you should know about the Linux kernel <- 'The Linux kernel accepts boot time parameters as it starts to boot system. This is used to inform kernel about various hardware parameter. You need boot time parameters to; Troubleshoot system + Hardware parameters that the kernel would not able to determine on its own + Force kernel to override the default hardware parameters in order to increase performance + Password and other recovery operations'
Just booting tips <- 'saikee's techniques for Lilo, Grub or Windows (Win9x, Win2k, XP, Vista or Windows 7)' + very helpful + informative
Remember that when you boot into a graphical environment then it is true that you must invoke a terminal(VT) to use bash with a ~.bashrc but if you boot a Linux non-graphical (X) to a terminal then bash will be invoked at login. You could then use your ~.bashrc to setup alias or functions for desired operation/functions. I suggest that you look at 'man bash' along with the before bash links above.

'/etc/rc.d/rc.local' is used to invoke additional programs/scripts when using Slackware & a few other distributions.

The command line can be used to execute a script directly in a terminal or VT while in a DE.
Hope this helps.
Have fun & enjoy!
 
Old 10-04-2019, 05:22 AM   #6
admiral-helmut
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hello onebuck,

thank you very much for your detailed answer. This helps me a lot.

One question to the point "/etc/rc.d/rc.local":

Am i right: This is part of the SysVinit system, that is the old standard init system. Now SystemD is the standard but on embedded systems SysVinit is still the most used.
In such an SysVinit system you can specify your startup programs on 3 ways: (this depends on the specific distro/implementation)
/etc/rd.c
/etc/rc.d/rc.local
/etc/init.d

Am i right?

Thank you very much
Helmut
 
Old 10-04-2019, 08:00 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

For Slackware the '/etc/rc.d/rc.local' is used too;
Quote:
!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
#
I use '/etc/rc.d/rc.local' to setup anything that is needed after the system has been booted/initialized. If you have access to a Slackware based system it would do you good to look through the '/etc/rc.d' files to understand the initialization of the system since Slackware real init directory is '/etc/rc.d/';
Code:
# ls /etc/rc.d
init.d/      rc.atalk        rc.cups*              rc.inet1.conf-501SMain              rc.inet1.conf-working  rc.modules.local*  rc.saslauthd  rc.wireless*
rc.0@        rc.autofs       rc.cups-browsed       rc.inet1.conf-FrontierBuck          rc.inet2*              rc.mysqld          rc.sendmail   rc.wireless.conf
rc.4*        rc.bind         rc.dnsmasq            rc.inet1.conf-FrontierBuck-5G       rc.inetd*              rc.networkmanager  rc.serial     rc.yp
rc.6*        rc.bluetooth*   rc.font               rc.inet1.conf-FrontierBuck-working  rc.ip_forward          rc.nfsd            rc.snmpd      rc0.d/
rc.K*        rc.cgconfig     rc.fuse*              rc.inet1.conf-FrontierBuckASUS      rc.local*              rc.ntpd*           rc.sshd*      rc1.d/
rc.M*        rc.cgmanager*   rc.gpm*               rc.inet1.conf-ciscoE2500            rc.loop*               rc.pcmcia          rc.syslog*    rc2.d/
rc.S*        rc.cgproxy*     rc.httpd              rc.inet1.conf-frontierbuck-now      rc.lxc                 rc.php-fpm         rc.sysstat    rc3.d/
rc.acpid*    rc.cgred        rc.inet1*             rc.inet1.conf-sue                   rc.mcelog*             rc.pulseaudio      rc.sysvinit*  rc4.d/
rc.alsa      rc.consolekit*  rc.inet1.conf         rc.inet1.conf-tplink                rc.messagebus*         rc.rpc*            rc.udev*      rc5.d/
rc.alsa-oss  rc.cpufreq*     rc.inet1.conf-223Sue  rc.inet1.conf-tplink-working        rc.modules*            rc.samba*          rc.ulogd*     rc6.d/
Hope this helps.
Have fun & enjoy Slackware!
 
Old 10-07-2019, 05:56 AM   #8
admiral-helmut
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hello onebuck,

thank you very much, really.

May i ask you two more questions?

1) Is this for slackware in specific or is this for all distributions and linux systems that use the SysVinit (the old init system)as init system in exactly the same manner?


2) Do I understand this in the right manner: SysVinit manages the rc.d folder. There are many configuratuion files. rc.local contains all programs that are started after the system bootup, rc.shutdown contains tasks before shut down. All other files are config files for SysVinit but none of them contains startup programs?

Thynk you
 
Old 10-07-2019, 06:32 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
SysVinit works [almost] the same way on every distribution.
and here is it explained: https://wiki.archlinux.org/index.php/SysVinit
 
Old 10-07-2019, 09:04 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

Quote:
Originally Posted by admiral-helmut View Post
Hello onebuck,

thank you very much, really.

May i ask you two more questions?

1) Is this for slackware in specific or is this for all distributions and linux systems that use the SysVinit (the old init system)as init system in exactly the same manner?
As noted by pan64 & link most SysV init is done in this way. If you are referring to 'init.d' then I suggest that you look at Red Hat or Fedora as noted by Slackware's '/etc/rc.d/init.d/README.functions'
Quote:
If you're reading this in /etc/init.d/, Slackware's real init directory is
/etc/rc.d/. Maybe you already knew this, but it never hurts to say. :-)

This script was taken from Fedora (and is presumably licensed under the GPL).
While I don't see Slackware init scripts making much use of it (but use it
if you wish), some third party init scripts (such as for commercial software
designed to run on Red Hat based systems) expect this script and use it in
their own init scripts, so it's a good idea to make it available here.

These functions are provided solely for commercial (or other) software that
expects to find "Red Hat-isms". I wouldn't use them to write new init
scripts (personally), but if you've had experience with them in the past
and like them, by all means feel free.

It's planned to continue support for them.
Quote:
Originally Posted by admiral-helmut View Post
2) Do I understand this in the right manner: SysVinit manages the rc.d folder. There are many configuratuion files. rc.local contains all programs that are started after the system bootup, rc.shutdown contains tasks before shut down. All other files are config files for SysVinit but none of them contains startup programs?

Thynk you

If you are speaking of startup programs as being done independent of the initialization then 'Yes'. I suggest that you look at the referenced link; https://wiki.archlinux.org/index.php...n_Boot_Scripts to see how arch runs init that is/was similar to Slackware before arch switch to 'systemd'. If you wish to know Slackware Sysinit then I would suggest using a Slackware installation to look through the init scripts.
As to shutdown as related to '/etc/rc.d/rc.local' please notice this note in '/etc/rc.d/rc.local';
Quote:
!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
If you have any additional questions as related to Slackware maybe https://docs.slackware.com/start would be of use to you.
Hope this helps.
Have fun & enjoy Slackware!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which linux Operating systems applied to Embedded systems? ubun2os Linux - Embedded & Single-board computer 3 03-14-2013 04:24 PM
Read only file systems, custom live CDs, and embedded systems coffeecoffee Linux - Newbie 2 02-24-2009 11:09 PM
How to configure wireless on Linux (usually works!) perry Linux - Hardware 0 09-25-2007 11:07 AM
What programs do you usually use for linux? GuySkarpz Linux - General 10 09-25-2006 03:58 PM
Which Linux/Security portals you usually visit? serz Linux - Security 13 09-13-2004 12:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration