历史上的今天
今天是:2025年04月06日(星期日)
2020年04月06日 | arm-linux之为开发板写上电自启动程序之方法
2020-04-06 来源:eefocus
开发环境
开发板:AM335
虚拟机:ubuntu 14.04
编译器:gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf
开发板内核:linux 4.4.12
首先开发板的文件使用的是systemd 并没有/etc/rc.local文件 所以要想修改rc.local这一简单的操作已经不存在 但是也是可以用systemd和initd两种方式解决这个问题
1.systemd
我这里是修改自带的service
root@am335x-evm:/etc/rc5.d# ls /lib/systemd/system/rc-local.service
/lib/systemd/system/rc-local.service
在开发板这个目录我找到了rc-local.service文件 查看其内容
root@am335x-evm:/etc/rc5.d# cat /lib/systemd/system/rc-local.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
可见开发板是支持/etc/rc.local文件的使用的 但是开发板下又没有/etc/rc.local文件 所以我们只能自己去建立了
在/lib/systemd/system/rc-local.service下加多一段文字
[Install]
WantedBy=multi-user.target
multi-user.target指明的是非图形界面的多用户方式
然后就去创建rc.local文件
vi /etc/rc.cal
然后加入以下代码
#!/bin/sh
case "$1" in
start)
/file_creat Tronlong
;;
stop)
exit 0;;
esac
然后就输入以下命令
# chmod +x /etc/rc.local
# systemctl enable rc-local.service
# systemctl --system daemon-reload
# systemctl start rc-local.service
然后重启后就可以看到Tronlong这个文件了
2.initd
首先创建/etc/init.d/helloworld文件
vi /etc/init.d/helloworld
内容为
#!/bin/sh
xxxxxxxx //你要启动的程序命令
# chmod +x /etc/init.d/helloworld //加可执行权限
# ln -sf /etc/init.d/helloworld /etc/rc5.d/S99helloworld //建立链接
# update-rc.d helloworld start 99 2 . //设置成开机启动项
然后重启就能看到程序运行了
史海拾趣
|
@@MAX7132学习板电路图完整版 https://bbs.eeworld.com.cn/thread-50800-1-1.html@@ @@EP2C学习板原理图 https://bbs.eeworld.com.cn/thread-72861-1-4.html@@ @@ ...… 查看全部问答> |
|
【转】电子设计竞赛经验汇总(11楼以后更新获奖团队的成功感言) 本帖最后由 paulhyde 于 2014-9-15 03:22 编辑 竞赛时应该注意的问题: 1、软件与硬件电路最好是同时做,不要前几天都在搞软件,等到最后才来焊板,到时如果出问题都没时间改了,我参加时就是遇到了这种情况。要么也可以在面包板实践下,有人可 ...… 查看全部问答> |
|
再好几个论坛发帖,没人鸟窝 首先说明一下问题 我用的是ad 08 在画一个BGA封装的FPGA板子,看到别人在管脚中间放置焊盘,我也试着做,但是放置好以后,无法布线,老是连不上线,也不知道是什么问题,搜了半天,也没结果,就问问大家,谢谢… 查看全部问答> |
|
各位, 我在6410上调试三星opengl es的例子。 1.1 和2.0的 exe文件都可以正常运行,但调试三星带的源码时,初始化全部成功,但一运行到glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);时串口就会输出如下错误信息: Exception \' ...… 查看全部问答> |
|
高级软件开发工程师/软件QA. 职位要求: 1、计算机或相关专业本科及以上学历; 2、必需精通C/C++编程; 3、熟悉嵌入式软件开发原则,设计模式及调试技巧; 4、掌握嵌入式操作系统(如Linux, WinCE)平台上的系统及应用程序开发; 5、3年以上嵌 ...… 查看全部问答> |
|
7.在有限的IO中扩展按键数量 前面我们讲到两种多按键的处理方法,仔细观察可以发现,这两种处理方法都是基于多个IO的,也就是说有多少个IO我们就能扩展出多少个按键。如果我只有6个可用的IO,那么能不能实现多于6个按键呢?答案是肯 ...… 查看全部问答> |
|
我用的是5510的一块开发板,上面的codec用的是tlv320aic23,我的程序需要对外界输入的电压值进行判断,如果大于某幅度就怎样,这时候程序该怎样写这个判断语句,不知道模拟电压经codec转换后对应的关系 高手帮忙,不胜感激… 查看全部问答> |




