本次經驗基于創龍TL437x-IDK開發板,對上電動運行程序進行步驟分析,希望能幫助大家~ 創龍TL437x-IDK開發板基于TI AM4379 ARM Cortex-A9 CPU,主頻高達1GHz,低功耗DDR3L,這里就不細說,可自百度搜索,圖片如下:
進入主題,步驟如下: 將可執行文件helloworld復制到開發板文件系統"/home/root/"目錄下。
進入開發板系統,在"/lib/systemd/system/"目錄下新建和可執行文件名對應的service文件,比如helloworld.service。 Target# cd /lib/systemd/system/ Target# vi helloworld.service
service文件添加如下代碼: [Unit] Description=helloworld //可執行文件名稱,請根據實際情況修改 After=basic.service X.service thermal-zone-init.service [Service] Environment=DISPLAY=0:0 ExecStartPre=/bin/echo "****Start to run myscript.service****" ExecStart=/home/root/helloworld //可執行文件路徑,請根據實際情況修改 StandardOutput=tty KillMode=process KillSignal=SIGKILL SendSIGKILL=yes [Install] WantedBy=multi-user.target
輸入以下命令使能該服務: Target# systemctl -f enable /lib/systemd/system/helloworld.service
重啟開發板后可看到helloworld程序已經自動啟動
|