OKA6818 Linux + Qt5 应用程序的开机自启动

OKA6818 Linux + Qt5 应用程序的开机自启动

1,编写Qt5应用程序QtApp并且远程调试成功。
2,利用XShell远程登陆后可在命令行输入命令/qt/QtApp启动成功
3,使用如下方法可以开机自动运行

  • /etc/profile最后添加(1)
    /qt/QtApp
  • /etc/inittab种找到
    console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
    注释,并添加一行
    ::respawn:-bin/sh
    (2)
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id        == tty to run on, or empty for /dev/console
# runlevels == ignored
# action    == one of sysinit, respawn, askfirst, wait, and once
# process   == program to run

# Startup the system
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mkdir -p /dev/shm
::sysinit:/bin/mount -a
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS

# Put a getty on the serial port
#console::respawn:/sbin/getty -L  console 0 vt100 # GENERIC_SERIAL
::respawn:-bin/sh

# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r

  • 重新启动,开机自动运行成功

后记20191202:

用以上的方法,因为/etc/profile只要用ssh或者超级终端登陆一次就会执行一次,所以一旦有多个终端登陆,QtApp也会执行多次。
将/etc/profile最后添加的 /qt/QtApp 删除,然后再rsC最后添加:
source /etc/profile
/qt/QtApp &
这样就真正实现了开机启动一次的效果了。



  1. 这里不能添加在/etc/init.d/rcS文件中,因为rcS启动的时候QT的环境变量还没有建立起来,在这里启动会失败 ↩︎

  2. 如果不进行此步修改,每次都需要使用XShell连接ARM一次才会运行QtApp ↩︎

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tanghuihuayyc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值