应用程序自动启动(busybox)
(2014-09-23 08:37:30)
标签:
busybox应用程序自动启动linux |
#!/bin/sh # #Sets necessary environment variables and runs the desktop # export TSLIB_TSDEVICE=/dev/touchscreen-1wire export TSLIB_TSEVENTTYPE=INPUT export TSLIB_FBDEVICE=/dev/fb0 export TSLIB_PLUGINDIR=/usr/lib/ts/ export TSLIB_CONSOLEDEVICE=none export TSLIB_CONFFILE=/etc/ts.conf export TSLIB_CALIBFILE=/etc/pointercal export LD_LIBRARY_PATH=/usr/lib export QTDIR=/usr/lib/qt export QWS_MOUSE_PROTO=tslib:/dev/touchscreen-1wire /path/to/application -qws
Then made it executable with:
$chmod +x startup.sh
then added this line to inittab:
tty1::once:/path/to/startup.sh
测试表明,这个方法没有
用户登录,没有tty连接。用户程序虽然能够正常执行,但是似乎影响到了tty连接建立的后续语句的执行。
#!/bin/sh
#!/bin/sh #
# rcS Call all S??* scripts in
/etc/rcS.d in
# numerical/alphabetical
order.
#
# Version: @(#)/etc/init.d/rcS
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel
prevlevel
# Make sure proc is
mounted
#
[ -d "/proc/1" ] || mount
/proc
#
# Source defaults.
#
. /etc/default/rcS
#
# Trap CTRL-C &c only in this shell
so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
#
# Call all parts in order.
#
exec /etc/init.d/rc S
|
可以在 rc5.d 下放置 启动用户程序的脚本或者链接。一般是软链接。不过由于 petalinux sdk 是自动生成 rootfs 的,所以把脚本直接拷贝(文件名必须以Sxx开头)到了 rc5.d 下,可以运行,运行效果 与 在 inittab 中加一行的效果类似,程序(图形界面)运行完(关闭)后,没有任何shell可用。有人建议放在这里的程序应该是“可感知tty的”,在tty建立前等待,建立后挂接,实现方法待查。
这个文件是sh用的,当用户获得一个shell后,sh就会根据这个文件配置用户的登陆环境。
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). PATH="/usr/local/bin:/usr/bin:/bin" EDITOR="/bin/vi" # needed for packages like cron test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc. if [ ! -e /etc/localtime ]; then TZ="UTC" # Time Zone. Look at
http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html # for an explanation of how to set this to your local timezone. export TZ fi if [ "$HOME" = "/home/root" ]; then fi if [ "$PS1" ]; then # works for bash and ash (no other shells known to be in use here) fi if [ -d /etc/profile.d ]; then fi export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM umask 022 |