Panel For Example Panel For Example Panel For Example

A Startup Script Trick for Embedded Linux

Author : Adrian September 04, 2025

This article introduces a technique for using a custom startup script during system boot. This method is particularly useful for systems with a read-only filesystem, providing a convenient way to temporarily modify system configurations or launch additional programs without altering the main filesystem.

 

Implementation

The standard startup script in many embedded Linux systems is /etc/init.d/rcS. While applications can be launched directly from here, it is better practice to call a separate application-specific script. This approach simplifies future modifications, as you only need to update the application script, not the core system script.

First, add a call to your application's main startup script, which we'll call init_app.sh, within /etc/init.d/rcS. The purpose of init_app.sh is to launch your primary application and initialize its configuration parameters.

Next, to create a hook for a custom script, add the following logic inside init_app.sh. This code checks for a script named run.sh located in a read-write partition (e.g.,/mnt/data/) and executes it if found.

if [ -f /mnt/data/run.sh ] then /bin/sh /mnt/data/run.sh & fi

There are two key points about this implementation:

  1. The script is launched using/bin/sh. This ensures it will run regardless of whether it has execute permissions.
  2. The ampersand (&) runs the script in the background, which prevents it from blocking the execution of the main init_app.sh script.

 

Common Use Cases

With this hook in place, you can easily perform temporary modifications in the field. For example, to launch an extra program, you can simply add the command to run.sh without altering the core application startup process.

This method is also frequently used for applying system configuration changes. Commands for tasks such as modifying the network routing table, creating symbolic links, or clearing log files can be placed in therun.sh script as needed.

Recommended Reading
Differences: DSP vs Microcontroller vs Embedded Microprocessor

Differences: DSP vs Microcontroller vs Embedded Microprocessor

March 20, 2026

Compare DSP, microcontroller, and embedded microprocessor designs: DSP signal processing optimizations, microcontroller peripheral integration, and power/performance tradeoffs.

Article
Choosing Peripherals for Embedded Systems

Choosing Peripherals for Embedded Systems

March 20, 2026

Guide to selecting peripherals in embedded systems: compare memory, clock sources, timers, communication interfaces, I/O and ADCs with factors like speed, power, and stability.

Article
Determinism in Embedded Real-Time Systems and EDMS

Determinism in Embedded Real-Time Systems and EDMS

March 20, 2026

EDMS middleware for ADAS/AD: explains data-driven and time-driven scheduling, data determinism, and deterministic recompute with virtual drives for reproducible validation.

Article
Two Embedded Microprocessor Architectures and Their Pros and Cons

Two Embedded Microprocessor Architectures and Their Pros and Cons

March 20, 2026

Overview of embedded microprocessor architectures (CISC vs RISC), trade-offs, advantages and limitations for embedded system design, power, performance, and integration.

Article
What Is an Embedded Microprocessor and Its Uses

What Is an Embedded Microprocessor and Its Uses

March 20, 2026

Survey of embedded microprocessor concepts, architecture, characteristics and applications, highlighting real-time performance, reliability, and trends in IoT and AI.

Article
Three Main Components of an Embedded Microprocessor

Three Main Components of an Embedded Microprocessor

March 20, 2026

Technical overview of the embedded microprocessor architecture, summarizing its three cooperating subsystems and how the compute unit enables arithmetic and logical execution.

Article