From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] /etc//init.d init scripts in buildroot
Date: Fri, 14 Jul 2017 14:38:18 +0200 [thread overview]
Message-ID: <87shhzb3d1.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <CALtfCQZAis0fX+J6NWTX+u=ZJB-0ZKoKgkBcteAJU4f+c46BJA@mail.gmail.com> (Oscar Gomez Fuente's message of "Fri, 14 Jul 2017 12:16:36 +0200")
>>>>> "Oscar" == Oscar Gomez Fuente <oscargomezf@gmail.com> writes:
> Hi everyone,
> I'm trying to use init scripts from /etc/init.d to activate one gpio just
> before to halt my HW platform (a raspberry Pi): S00gpioff
> I've created a script like this:
> #!/bin/sh
> #
> # S00gpioff
> #
> GPIO_CMD_OFF=13
> case "$1" in
> start)
> echo $GPIO_CMD_OFF > /sys/class/gpio/export
> ;;
> stop)
> echo "Activated CMD OFF output"
> echo 1 > /sys/class/gpio$GPIO_CMD_OFF/value
> ;;
> *)
> exit 1
> ;;
> esac
> The problem is I need to activate the gpio just before halt:
How late does this need to happen? You cannot do much later than this in
user space. E.G. the default inittab is:
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
rcK calls you init script (as the very last one because of S00), and
then only swapoff + umount gets executed before the kernel is asked to
power down.
If this is not good enough then you need to handle the gpio in a kernel
driver instead by registering a reboot notifier.
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2017-07-14 12:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 10:16 [Buildroot] /etc//init.d init scripts in buildroot Oscar Gomez Fuente
2017-07-14 12:38 ` Peter Korsgaard [this message]
2017-07-14 13:18 ` Thomas Petazzoni
2017-07-14 13:31 ` Peter Korsgaard
2017-07-14 13:31 ` Oscar Gomez Fuente
2017-07-14 13:42 ` Oscar Gomez Fuente
2017-07-19 15:00 ` Oscar Gomez Fuente
2017-07-19 15:03 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87shhzb3d1.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.