最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

在嵌入式Linux的rootfs中,添加环境变量到启动脚本中 -> /etc/profile

工作和技术 crifan 3635浏览 0评论

【目的】

需要用export导出一些环境变量,才能使得QT的demo正常运行。

希望把这些export导致变量的动作,加到启动脚本中。

【解决过程】

以为是在家/etc/inittab下面的,结果不对。

最后搞懂了,类似于PC的Linux中的.bashrc,嵌入式Linux中的rootfs中,是变量定义是放在/etc/profile中的,本身已经有的内容如下:

# ~/.bashrc: executed by bash(1) for non-login interactive shells.

export PATH=
/bin:
/sbin:
/usr/bin:
/usr/sbin:
/usr/bin/X11:
/usr/local/bin

。。。
    export PAGER=’/bin/more ‘
    export EDITOR=’/bin/vi’
    export INPUTRC=/etc/inputrc
    export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile

    ### Some aliases
    alias ps2=’ps facux ‘
    alias ps1=’ps faxo "%U %t %p %a" ‘
    alias af=’ps af’
。。。

所以,加到对应位置后,就可以了:

# ~/.bashrc: executed by bash(1) for non-login interactive shells.

。。。

    export EDITOR=’/bin/vi’
    export INPUTRC=/etc/inputrc
    export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile

   ### add for QT
   export QTDIR=/usr
   export LD_LIBRARY_PATH=$QTDIR/lib
   export QT_QWS_FONTDIR=$QTDIR/lib/fonts
   export QWS_DISPLAY="LinuxFb:/dev/fb0"

    ### Some aliases
    alias ps2=’ps facux ‘
    alias ps1=’ps faxo "%U %t %p %a" ‘
。。。

转载请注明:在路上 » 在嵌入式Linux的rootfs中,添加环境变量到启动脚本中 -> /etc/profile

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. 我知道你的这种方法,但是我的这个文件不能修改,或者说修改了以后无法保存(不是chmod的事)
    yyjbluesword14年前 (2010-07-16)回复
82 queries in 0.154 seconds, using 22.11MB memory