-
Notifications
You must be signed in to change notification settings - Fork 83
SD card autorun script
Yihui Xiong edited this page Jul 26, 2017
·
2 revisions
The system will automatically run autorun
file of the sd card's first part if the sd card is mounted. The start-up sequence is /etc/init.d/autorun
-> /root/autorun.sh
-> /root/sd_daemon.sh
-> /tmp/run/mountd/mmcblk0p1/autorun
.
When a sd card is inserted, its first part will be mounted at /tmp/run/mountd/mmcblk0p1/
. If your sd card is not automatically mounted, try to format it with sd card formatter.
We can add firstboot
to sd card's autorun
to perform a factory reset. For example, copy the following script and save it to the sd card's root directory with filename autorun
.
#!/bin/sh
if [ ! -f /tmp/run/mountd/mmcblk0p1/reset_once ]; then
firstboot
touch /tmp/run/mountd/mmcblk0p1/reset_once # add a flag file to run `firstboot` once
reboot -f
fi
#!/bin/sh
if [ ! -f /tmp/run/mountd/mmcblk0p1/done ]; then
/etc/init.d/mopidy stop # stop mopidy if it's running, mopidy-hallo plugin will use SPI
/etc/init.d/alexa stop # stop alexa if it's running
mt7688_pinmux set ephy gpio
cd /etc/arduino
avrdude -c linuxgpio -p m32u4 -e -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xCB:m -U flash:w:Caterina-ReSpeaker.hex -u
touch /tmp/run/mountd/mmcblk0p1/done
fi