Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on setting up the pinmux on a BeagleBone so that I can access multiple UARTS. The OS is Angstrom Linux (the demo image, if that helps). I have a shell script:


echo "Configuring Pinmux"

echo 0 > /sys/kernel/debug/omap_mux/uart1_txd
echo 20> /sys/kernel/debug/omap_mux/uart1_rxd

echo "UART 1 (TX):"
cat /sys/kernel/debug/omap_mux/uart1_txd

echo "UART 1 (RX):"
cat /sys/kernel/debug/omap_mux/uart1_rxd

echo 1 > /sys/kernel/debug/omap_mux/spi0_d0
echo 21> /sys/kernel/debug/omap_mux/spi0_sclk

echo "UART 2 (TX):"
cat /sys/kernel/debug/omap_mux/spi0_d0

echo "UART 2 (RX):"
cat /sys/kernel/debug/omap_mux/spi0_sclk

Which sets up the UARTS for use. Now, I want this script to run on boot, so that I don't have to mess with it every time. Where should I put this/ make a link in order to do that?

share|improve this question

Just checked Angstrom Linux, it's Debian based, so copy these lines to /etc/rc.local would work for you:

echo 0 > /sys/kernel/debug/omap_mux/uart1_txd
echo 20> /sys/kernel/debug/omap_mux/uart1_rxd
echo 1 > /sys/kernel/debug/omap_mux/spi0_d0
echo 21> /sys/kernel/debug/omap_mux/spi0_sclk
share|improve this answer
up vote 2 down vote accepted

So, after much digging, I found the correct way to do this. Angstrom uses systemd to launch things on boot, so putting things in /etc/rc*n*.d doesn't work correctly. Instead, you make a service, tell systemd about it, and then it works automagically.

In /lib/systemd/system, I created a file called pinmux.service:

Description=Setting up Pinmux

ExecStart = /home/**username**/pinmux.sh


This calls the shell script in my home directory called pinmux.sh, which does all the setting, as noted in my question.

To enable it, call systemctl enable pinmux.service, followed by systemctl start pinmux.service.

Now, the script will be called on boot.

share|improve this answer
I wonder if there is a way to "systemctl start" within the image creation. Apart from the dirty way of creating a link in /etc/systemd/system – SlashV May 7 '13 at 17:19

As a newbie, I know two ways to do that, easy one comes: in /etc/rc5.d you can see some files whose names starting with some numbers which assigns who is going to start first, and they are started from the first number to last number respectively. Put your script here with the last number:

vi /etc/rc5.d/S25yourScript.sh

I assume S25 the last number :) paste your script here and exit. When you reboot once your script will work

share|improve this answer
Don't use a file in /etc/rc*.d, use a link instead, put the real file to /etc/init.d – warl0ck Sep 28 '12 at 9:51
yes thats true, im sorry. You should put the same script to /etc/init.d also. Without it, its not working. Thank you Warl0ck – Ibrahim Arli Sep 28 '12 at 10:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.