arm-linux之为开发板写上电自启动程序之方法
来源:互联网 发布:nginx跳转保持url不变 编辑:程序博客网 时间:2024/05/20 10:22
开发环境
开发板: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 CompatibilityConditionFileIsExecutable=/etc/rc.localAfter=network.target[Service]Type=forkingExecStart=/etc/rc.local startTimeoutSec=0RemainAfterExit=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/shcase "$1" instart)/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/shxxxxxxxx //你要启动的程序命令
# chmod +x /etc/init.d/helloworld //加可执行权限# ln -sf /etc/init.d/helloworld /etc/rc5.d/S99helloworld //建立链接# update-rc.d helloworld start 99 2 . //设置成开机启动项
然后重启就能看到程序运行了
阅读全文
0 0
- arm-linux之为开发板写上电自启动程序之方法
- ARM-Linux开机自启动设置-mini2440开发板
- ARM-Linux开机自启动设置-mini2440开发板
- ARM-Linux开机自启动设置-mini2440开发板
- ARM-Linux开机自启动设置ARM9开发板
- ARM-Linux开机自启动设置-mini2440开发板
- ARM-Linux开机自启动设置-mini2440开发板
- ARM-Linux开机自启动设置-ok6410开发板
- Linux之设置服务为开机自启动
- Linux程序自启动设置方法
- Linux程序自启动设置方法
- Linux下程序开机自启动方法
- linux开机自启动程序设置方法
- linux程序开机自启动方法
- ARM学习笔记012之mini2440上电的启动和初始化程序分析(即Bootloader分析)
- BroadcastReceiver之开机自启动程序
- arm linux 启动流程之 ppcboot
- arm linux 启动流程之 解压内核
- coremark测试
- 理解Python的With语句
- java 值类型和引用类型
- HDU3874 (树状数组+离线操作)
- python zip 变成元组数组之后如何解压?
- arm-linux之为开发板写上电自启动程序之方法
- IE7下浮动元素margin-bottom失效
- linux 修改mysql端口
- LoadMenu使用方法
- Base64编码原理分析
- stm32 printf 死机
- xcode模拟器默认弹出默认键盘
- android应用与Linux内核驱动数据交互
- wampserver修改默认端口80问题