02全志R16平台tinav2.1系统下的开机自启动脚本的创建(分色排版)V1.1

来源:互联网 发布:淘宝落地页是什么 编辑:程序博客网 时间:2024/06/05 12:26

02全志R16平台tinav2.1系统下的开机自启动脚本的创建

2017/12/7 19:26

版本:V1.1

 

 

1、为了点亮客户提供的RGB屏幕,需要在R16平台tina v2.1的系统启动之后启动两个应用程序:spidev_test0、cb_test。让它俩开机自启动自然是最好的选择了!

准备工作(准备自启动脚本以及熟悉相应的权限):

百度关键词:openwrt 开机自启动

 

http://www.cnyubin.com/linux/364

Openwrt下设置程序开机自动启动

 

root@TinaLinux:/# ll

drwxr-xr-x    1 root     root          1024 Jan  1  1970 .

drwxr-xr-x    1 root     root          1024 Jan  1  1970 ..

drwxr-xr-x    2 root     root          1301 Dec  7 17:51 bin

drwxrwxrwx    2 root     root         16384 Jan  1  1970 boot

drwxrwxrwx    2 root     root          8192 Jan  1  1970 boot-res

drwxr-xr-x    8 root     root          3180 Dec 11 11:23 dev

drwxr-xr-x    1 root     root          1024 Jan  2  1970 etc

drwxr-xr-x   10 root     root           751 Nov 27 09:30 lib

drwx------    2 root     root         12288 Jan  1  1970 lost+found

drwxr-xr-x    1 root     root          1024 Jan  1  1970 mnt

drwxr-xr-x    9 root     root          1024 Jan  1  1970 overlay

dr-xr-xr-x   78 root     root             0 Jan  1  1970 proc

drwxr-xr-x   16 root     root           211 Dec  7 17:51 rom

drwxr-xr-x    1 root     root          1024 Jan  1  1970 root

drwxr-xr-x    2 root     root           881 Dec  7 17:51 sbin

dr-xr-xr-x   12 root     root             0 Dec 11 11:23 sys

drwxrwxrwt   13 root     root           360 Dec 11 11:23 tmp

drwxr-xr-x    1 root     root          1024 Jan  1  1970 usr

lrwxrwxrwx    1 root     root             4 Dec  7 17:51 var -> /tmp

drwxr-xr-x    2 root     root             3 Dec  7 17:50 www

root@TinaLinux:/# cd /etc/init.d/

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    1 root     root          1024 Dec  9 18:55 .

drwxr-xr-x    1 root     root          1024 Jan  2  1970 ..

-rwxr-xr-x    1 root     root           658 Dec 10 19:02 adbd

-rwxr-xr-x    1 root     root           254 Nov 27 09:29 aw_fstab

-rwxr-xr-x    1 root     root           373 Nov 27 09:29 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 17:50 boot

-rwxr-xr-x    1 root     root           741 Nov 27 09:30 cron

-rwxr-xr-x    1 root     root           376 Nov 27 09:31 dbus

-rwxr-xr-x    1 root     root         16062 Nov 27 09:30 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 17:50 done

-rwxr-xr-x    1 root     root           353 Nov 27 09:30 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 17:50 gpio_switch

-rwxr-xr-x    1 root     root           349 Dec 10 10:59 healthd

-rwxr-xr-x    1 root     root          2356 Dec  7 17:50 led

-rwxr-xr-x    1 root     root          2347 Nov 27 09:30 log

-rwxr-xr-x    1 root     root           313 Nov 27 09:31 nativepower

-rwxr-xr-x    1 root     root          2758 Nov 27 09:30 network

-rwxr-xr-x    1 root     root           239 Nov 27 09:32 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 17:50 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 17:50 sysfixtime

-rwxr-xr-x    1 root     root           931 Nov 27 09:30 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 17:50 system

-rwxr-xr-x    1 root     root           106 Dec  7 17:50 umount

-rwxr-xr-x    1 root     root           176 Dec  7 18:48 xxx

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# cd ../rc.d/

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ll

drwxr-xr-x    1 root     root          1024 Dec  8 18:50 .

drwxr-xr-x    1 root     root          1024 Jan  2  1970 ..

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 K10gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 K89log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 K90network -> ../init.d/network

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 K90sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K98boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 K98healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 K98nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 K98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K99adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K99dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 K99umount -> ../init.d/umount

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 S00sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S10boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S10dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 S10system -> ../init.d/system

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 S11sysctl -> ../init.d/sysctl

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 S12log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S13healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 S13nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S20network -> ../init.d/network

lrwxrwxrwx    1 root     root            15 Dec  7 17:51 S40fstab -> ../init.d/fstab

lrwxrwxrwx    1 root     root            18 Dec  7 17:51 S41aw_fstab -> ../init.d/aw_fstab

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S50cron -> ../init.d/cron

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S60dnsmasq -> ../init.d/dnsmasq

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S80adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S95done -> ../init.d/done

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 S96led -> ../init.d/led

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 S98gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 S98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S98sysntpd -> ../init.d/sysntpd

lrwxrwxrwx    1 root     root            28 Dec  7 17:51 S99aw_upgrade_autorun -> ../init.d/aw_upgrade_autorun

lrwxrwxrwx    1 root     root            15 Dec  8 18:50 S99xxx -> /etc/init.d/xxx

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d#

 

 

可以知道:

启动脚本在:/etc/init.d/healthd。

启动快捷方式在:/etc/rc.d/S13healthd -> ../init.d/healthd

 

 

根据经验知道,healthd和adbd都是开机自启动的!很容易知道healthd里面的脚本执行了,adbd里面的脚本不行,虽然我们能够使用adb连接全志R16平台的tina v2.1系统!原因不得而知了!

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# cat healthd 

#!/bin/sh /etc/rc.common

# Copyright (C) 2006-2011 OpenWrt.org

 

START=13

STOP=98

DEPEND=dbus

 

USE_PROCD=1

PROG=/bin/healthd

OOM_ADJ=-17

 

start_service() {

echo wyb

spidev_test0

ehco wyb2

cb_test &

procd_open_instance

procd_set_param oom_adj $OOM_ADJ

procd_set_param command $PROG -D

procd_close_instance

}

 

shutdown() {

echo shutdown

}

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# cat adbd 

#!/bin/sh /etc/rc.common

# Copyright (C) 2006-2011 OpenWrt.org

 

START=80

STOP=99

 

USE_PROCD=1

PROG=/bin/adbd

OOM_ADJ=-17

 

start_service() {

spidev_test0

cb_test

[ -e /sys/class/android_usb/android0 ] && {

        echo 0 > /sys/class/android_usb/android0/enable

        echo 18d1 > /sys/class/android_usb/android0/idVendor

        echo D002 > /sys/class/android_usb/android0/idProduct

        echo adb > /sys/class/android_usb/android0/functions

        echo 1 > /sys/class/android_usb/android0/enable

}

procd_open_instance

procd_set_param oom_adj $OOM_ADJ

procd_set_param command $PROG -D

procd_close_instance

}

 

shutdown() {

echo shutdown

}

root@TinaLinux:/etc/init.d#

 

 

很容易知道tina对openWRT进行了修改,start变成了start_service。tinav2.1启动之后,使用vi“依葫芦画瓢”创建一个启动脚本:vi init_rgb_lcd

 

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    1 root     root          1024 Dec 11 19:39 .

drwxr-xr-x    1 root     root          1024 Jan  2  1970 ..

-rwxr-xr-x    1 root     root           660 Dec 11 11:35 adbd

-rwxr-xr-x    1 root     root           254 Nov 27 09:29 aw_fstab

-rwxr-xr-x    1 root     root           373 Nov 27 09:29 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 17:50 boot

-rwxr-xr-x    1 root     root           741 Nov 27 09:30 cron

-rwxr-xr-x    1 root     root           376 Nov 27 09:31 dbus

-rwxr-xr-x    1 root     root         16062 Nov 27 09:30 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 17:50 done

-rwxr-xr-x    1 root     root           353 Nov 27 09:30 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 17:50 gpio_switch

-rwxr-xr-x    1 root     root           349 Dec 10 10:59 healthd

-rw-rw-rw-    1 root     root          1102 Dec 11 19:39 init_rgb_lcd

-rwxr-xr-x    1 root     root          2356 Dec  7 17:50 led

-rwxr-xr-x    1 root     root          2347 Nov 27 09:30 log

-rwxr-xr-x    1 root     root           313 Nov 27 09:31 nativepower

-rwxr-xr-x    1 root     root          2758 Nov 27 09:30 network

-rwxr-xr-x    1 root     root           239 Nov 27 09:32 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 17:50 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 17:50 sysfixtime

-rwxr-xr-x    1 root     root           931 Nov 27 09:30 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 17:50 system

-rwxr-xr-x    1 root     root           106 Dec  7 17:50 umount

-rwxr-xr-x    1 root     root           176 Dec  7 18:48 xxx

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# cat init_rgb_lcd 

#!/bin/sh /etc/rc.common

# Copyright (C) 2006-2011 OpenWrt.org

 

START=13

STOP=98

DEPEND=dbus

 

USE_PROCD=1

PROG=/bin/healthd

OOM_ADJ=-17

 

start_service() {

echo wyb10

spidev_test0

ehco wyb12

cb_test &

#procd_open_instance

#procd_set_param oom_adj $OOM_ADJ

#procd_set_param command $PROG -D

#procd_close_instance

}

 

shutdown() {

#echo shutdown

echo wyb14

}

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# chmod 755 init_rgb_lcd 

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    1 root     root          1024 Dec 11 19:40 .

drwxr-xr-x    1 root     root          1024 Jan  2  1970 ..

-rwxr-xr-x    1 root     root           660 Dec 11 11:35 adbd

-rwxr-xr-x    1 root     root           254 Nov 27 09:29 aw_fstab

-rwxr-xr-x    1 root     root           373 Nov 27 09:29 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 17:50 boot

-rwxr-xr-x    1 root     root           741 Nov 27 09:30 cron

-rwxr-xr-x    1 root     root           376 Nov 27 09:31 dbus

-rwxr-xr-x    1 root     root         16062 Nov 27 09:30 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 17:50 done

-rwxr-xr-x    1 root     root           353 Nov 27 09:30 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 17:50 gpio_switch

-rwxr-xr-x    1 root     root           349 Dec 10 10:59 healthd

-rwxr-xr-x    1 root     root           366 Dec  7 19:39 init_rgb_lcd

-rwxr-xr-x    1 root     root          2356 Dec  7 17:50 led

-rwxr-xr-x    1 root     root          2347 Nov 27 09:30 log

-rwxr-xr-x    1 root     root           313 Nov 27 09:31 nativepower

-rwxr-xr-x    1 root     root          2758 Nov 27 09:30 network

-rwxr-xr-x    1 root     root           239 Nov 27 09:32 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 17:50 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 17:50 sysfixtime

-rwxr-xr-x    1 root     root           931 Nov 27 09:30 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 17:50 system

-rwxr-xr-x    1 root     root           106 Dec  7 17:50 umount

-rwxr-xr-x    1 root     root           176 Dec  7 18:48 xxx

root@TinaLinux:/etc/init.d#

 

 

当然也可以编辑好之后通过adb来push进去了!

c:\>adb push init_rgb_lcd /etc/init.d

3 KB/s (366 bytes in 0.106s)

 

https://www.cnblogs.com/zhangwuyin/p/4283355.html

openwrt添加自动启动项

 

最后增加软链接(快捷方式),权限已经自动加好了!

ln -s /etc/init.d/my-plugin /etc/rc.d/S50my-plugin

ln -s /etc/init.d/init_rgb_lcd /etc/rc.d/S13init_rgb_lcd

S13init_rgb_lcd这个名称是合成的:START=13 +init_rgb_lcd

 

root@TinaLinux:/etc/rc.d# ln -s /etc/init.d/init_rgb_lcd /etc/rc.d/S13init_rgb_l

cd

root@TinaLinux:/etc/rc.d# ll

drwxr-xr-x    1 root     root          1024 Dec 11 19:43 .

drwxr-xr-x    1 root     root          1024 Jan  2  1970 ..

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 K10gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 K89log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 K90network -> ../init.d/network

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 K90sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K98boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 K98healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 K98nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 K98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K99adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 K99dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 K99umount -> ../init.d/umount

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 S00sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S10boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S10dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 S10system -> ../init.d/system

lrwxrwxrwx    1 root     root            16 Dec  7 17:51 S11sysctl -> ../init.d/sysctl

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 S12log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S13healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            24 Dec 11 19:43 S13init_rgb_lcd -> /etc/init.d/init_rgb_lcd

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 S13nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S20network -> ../init.d/network

lrwxrwxrwx    1 root     root            15 Dec  7 17:51 S40fstab -> ../init.d/fstab

lrwxrwxrwx    1 root     root            18 Dec  7 17:51 S41aw_fstab -> ../init.d/aw_fstab

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S50cron -> ../init.d/cron

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S60dnsmasq -> ../init.d/dnsmasq

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S80adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            22 Dec  7 17:51 S90init_rgb_lcd -> ../init.d/init_rgb_lcd

lrwxrwxrwx    1 root     root            14 Dec  7 17:51 S95done -> ../init.d/done

lrwxrwxrwx    1 root     root            13 Dec  7 17:51 S96led -> ../init.d/led

lrwxrwxrwx    1 root     root            21 Dec  7 17:51 S98gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            20 Dec  7 17:51 S98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            17 Dec  7 17:51 S98sysntpd -> ../init.d/sysntpd

lrwxrwxrwx    1 root     root            28 Dec  7 17:51 S99aw_upgrade_autorun -> ../init.d/aw_upgrade_autorun

lrwxrwxrwx    1 root     root            24 Dec  8 02:07 S99init_rgb_lcd -> /etc/init.d/init_rgb_lcd

lrwxrwxrwx    1 root     root            15 Dec  8 18:50 S99xxx -> /etc/init.d/xxx

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# sync

root@TinaLinux:/etc/rc.d# reboot

 

重启之后图像显示正常!

 

 

 

 

2、SDK中增加启动脚本

(内容已经在前文给出了,这里不再重复了!)

W:\liuxing_csdn_tinav2.1_ywj\package\allwinner\cb_test\files\init_rgb_lcd

W:\liuxing_csdn_tinav2.1_ywj\package\allwinner\cb_test\Makefile

# 软件包的安装方法

# 包括一系列拷贝编译好的文件到指定位置。

# 调用时会带一个参数,就是嵌入系统的镜像文件系统目录

# 因此 $(1) 表示嵌入系统的镜像目录。一般可以采用下面的方法

# INSTALL_DIR\INSTALL_BIN : 在 $(TOPDIR)/rules.mk 定义

# INSTALL_DIR : INSTALL_DIR :=install -d -m0755 意思是创建所属用户可读写

#   其他用户可读可执行的目录

# INSTALL_BIN : INSTALL_BIN :=install -m0755 意思是编译好的文件存放到镜像文件目录

 

define Package/cb_test/install

$(INSTALL_DIR) $(1)/bin

$(INSTALL_BIN) $(PKG_BUILD_DIR)/cb_test $(1)/bin/

$(CP) $(PKG_BUILD_DIR)/liuxu320x240.bmp $(1)/bin

#$(CP) $(PKG_BUILD_DIR)/files/init_rgb_lcd $(1)/etc/init.d

#$(CP) $(PKG_BUILD_DIR)/cbflower.bmp $(1)/bin

endef

 

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ make -j12

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ pack -d

 

 

刷机之后你会发现/etc/init.d中并没有启动脚本:init_rgb_lcd

[   19.096519] twi_start()434 - [i2c0] START can't sendout!

[   19.102948] twi_start()434 - [i2c0] START can't sendout!

[   19.639602] request_suspend_state: wakeup (3->0) at 19639583387 (2017-12-12 11:58:10.783061668 UTC)

[   19.650348] request_suspend_state: wakeup (0->0) at 19650329388 (2017-12-12 11:58:10.793808461 UTC)

 

 

 

BusyBox v1.24.1 () built-in shell (ash)

 

 _____  _              __     _

|_   _||_| ___  _ _   |  |   |_| ___  _ _  _ _

  | |   _ |   ||   |  |  |__ | ||   || | ||_'_|

  | |  | || | || _ |  |_____||_||_|_||___||_,_|

  |_|  |_||_|_||_|_|  Tina is Based on OpenWrt!

 ----------------------------------------------

 Tina Linux (Neptune, 593A1793)

 ----------------------------------------------

root@TinaLinux:/#

root@TinaLinux:/#

root@TinaLinux:/#

root@TinaLinux:/# cd /etc/init.d/

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    2 root     root           328 Dec  7 19:55 .

drwxr-xr-x    1 root     root          1024 Dec 12 19:58 ..

-rwxr-xr-x    1 root     root           635 Dec  7 18:49 adbd

-rwxr-xr-x    1 root     root           254 Dec  7 18:49 aw_fstab

-rwxr-xr-x    1 root     root           373 Dec  7 18:49 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 19:54 boot

-rwxr-xr-x    1 root     root           741 Dec  7 18:50 cron

-rwxr-xr-x    1 root     root           376 Dec  7 18:50 dbus

-rwxr-xr-x    1 root     root         16062 Dec  7 18:49 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 19:54 done

-rwxr-xr-x    1 root     root           353 Dec  7 18:50 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 19:54 gpio_switch

-rwxr-xr-x    1 root     root           300 Dec  7 18:50 healthd

-rwxr-xr-x    1 root     root          2356 Dec  7 19:54 led

-rwxr-xr-x    1 root     root          2347 Dec  7 18:50 log

-rwxr-xr-x    1 root     root           313 Dec  7 18:50 nativepower

-rwxr-xr-x    1 root     root          2758 Dec  7 18:50 network

-rwxr-xr-x    1 root     root           239 Dec  7 18:51 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 19:54 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 19:54 sysfixtime

-rwxr-xr-x    1 root     root           931 Dec  7 18:50 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 19:54 system

-rwxr-xr-x    1 root     root           106 Dec  7 19:54 umount

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d#

 

 

W:\liuxing_csdn_tinav2.1_ywj\package\allwinner\cb_test\Makefile

# 软件包的安装方法

# 包括一系列拷贝编译好的文件到指定位置。

# 调用时会带一个参数,就是嵌入系统的镜像文件系统目录

# 因此 $(1) 表示嵌入系统的镜像目录。一般可以采用下面的方法

# INSTALL_DIR\INSTALL_BIN : 在 $(TOPDIR)/rules.mk 定义

# INSTALL_DIR : INSTALL_DIR :=install -d -m0755 意思是创建所属用户可读写

#   其他用户可读可执行的目录

# INSTALL_BIN : INSTALL_BIN :=install -m0755 意思是编译好的文件存放到镜像文件目录

 

define Package/cb_test/install

$(INSTALL_DIR) $(1)/bin

$(INSTALL_BIN) $(PKG_BUILD_DIR)/cb_test $(1)/bin/

$(CP) $(PKG_BUILD_DIR)/liuxu320x240.bmp $(1)/bin

$(INSTALL_DIR) $(1)/etc/init.d

$(CP) files/init_rgb_lcd $(1)/etc/init.d

#$(CP) $(PKG_BUILD_DIR)/files/init_rgb_lcd $(1)/etc/init.d

#$(CP) $(PKG_BUILD_DIR)/cbflower.bmp $(1)/bin

endef

 

 

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ make -j12

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ pack -d

 

 

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ find . -name init_rgb_lcd

./package/allwinner/cb_test/files/init_rgb_lcd

./build/cb_test/ipkg-sunxi/cb_test/etc/init.d/init_rgb_lcd

./out/astar-parrot/compile_dir/target/rootfs/etc/init.d/init_rgb_lcd

./out/astar-parrot/staging_dir/target/rootfs/etc/init.d/init_rgb_lcd

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$ find . -name healthd

./package/allwinner/healthd

./package/allwinner/healthd/files/healthd

./out/astar-parrot/compile_dir/target/rootfs/etc/init.d/healthd

./out/astar-parrot/compile_dir/target/rootfs/etc/config/healthd

./out/astar-parrot/compile_dir/target/rootfs/bin/healthd

./out/astar-parrot/compile_dir/target/healthd

./out/astar-parrot/compile_dir/target/healthd/src/healthd

./out/astar-parrot/compile_dir/target/healthd/ipkg-sunxi/healthd

./out/astar-parrot/compile_dir/target/healthd/ipkg-sunxi/healthd/etc/init.d/healthd

./out/astar-parrot/compile_dir/target/healthd/ipkg-sunxi/healthd/etc/config/healthd

./out/astar-parrot/compile_dir/target/healthd/ipkg-sunxi/healthd/bin/healthd

./out/astar-parrot/compile_dir/target/healthd/ipkg-install/bin/healthd

./out/astar-parrot/staging_dir/target/rootfs/etc/init.d/healthd

./out/astar-parrot/staging_dir/target/rootfs/etc/config/healthd

./out/astar-parrot/staging_dir/target/rootfs/bin/healthd

rootroot@cm-System-Product-Name:/home/wwt/liuxing_csdn_tinav2.1_ywj$

 

 

刷机之后:

root@TinaLinux:/#

root@TinaLinux:/# cd /etc/init.d/

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    2 root     root           348 Dec  7 20:01 .

drwxr-xr-x    1 root     root          1024 Dec 13 12:05 ..

-rwxr-xr-x    1 root     root           635 Dec  7 18:49 adbd

-rwxr-xr-x    1 root     root           254 Dec  7 18:49 aw_fstab

-rwxr-xr-x    1 root     root           373 Dec  7 18:49 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 20:00 boot

-rwxr-xr-x    1 root     root           741 Dec  7 18:50 cron

-rwxr-xr-x    1 root     root           376 Dec  7 18:50 dbus

-rwxr-xr-x    1 root     root         16062 Dec  7 18:49 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 20:00 done

-rwxr-xr-x    1 root     root           353 Dec  7 18:50 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 20:00 gpio_switch

-rwxr-xr-x    1 root     root           300 Dec  7 18:50 healthd

-rwxr-xr-x    1 root     root           366 Dec  7 20:00 init_rgb_lcd

-rwxr-xr-x    1 root     root          2356 Dec  7 20:00 led

-rwxr-xr-x    1 root     root          2347 Dec  7 18:50 log

-rwxr-xr-x    1 root     root           313 Dec  7 18:50 nativepower

-rwxr-xr-x    1 root     root          2758 Dec  7 18:50 network

-rwxr-xr-x    1 root     root           239 Dec  7 18:51 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 20:00 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 20:00 sysfixtime

-rwxr-xr-x    1 root     root           931 Dec  7 18:50 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 20:00 system

-rwxr-xr-x    1 root     root           106 Dec  7 20:00 umount

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# cd ../rc.d/

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ll

drwxr-xr-x    2 root     root           618 Dec  7 20:01 .

drwxr-xr-x    1 root     root          1024 Dec 13 12:05 ..

lrwxrwxrwx    1 root     root            21 Dec  7 20:01 K10gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            13 Dec  7 20:01 K89log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 K90network -> ../init.d/network

lrwxrwxrwx    1 root     root            20 Dec  7 20:01 K90sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 K98boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 K98healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            22 Dec  7 20:01 K98init_rgb_lcd -> ../init.d/init_rgb_lcd

lrwxrwxrwx    1 root     root            21 Dec  7 20:01 K98nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            20 Dec  7 20:01 K98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 K99adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 K99dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 20:01 K99umount -> ../init.d/umount

lrwxrwxrwx    1 root     root            20 Dec  7 20:01 S00sysfixtime -> ../init.d/sysfixtime

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 S10boot -> ../init.d/boot

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 S10dbus -> ../init.d/dbus

lrwxrwxrwx    1 root     root            16 Dec  7 20:01 S10system -> ../init.d/system

lrwxrwxrwx    1 root     root            16 Dec  7 20:01 S11sysctl -> ../init.d/sysctl

lrwxrwxrwx    1 root     root            13 Dec  7 20:01 S12log -> ../init.d/log

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 S13healthd -> ../init.d/healthd

lrwxrwxrwx    1 root     root            22 Dec  7 20:01 S13init_rgb_lcd -> ../init.d/init_rgb_lcd

lrwxrwxrwx    1 root     root            21 Dec  7 20:01 S13nativepower -> ../init.d/nativepower

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 S20network -> ../init.d/network

lrwxrwxrwx    1 root     root            15 Dec  7 20:01 S40fstab -> ../init.d/fstab

lrwxrwxrwx    1 root     root            18 Dec  7 20:01 S41aw_fstab -> ../init.d/aw_fstab

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 S50cron -> ../init.d/cron

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 S60dnsmasq -> ../init.d/dnsmasq

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 S80adbd -> ../init.d/adbd

lrwxrwxrwx    1 root     root            14 Dec  7 20:01 S95done -> ../init.d/done

lrwxrwxrwx    1 root     root            13 Dec  7 20:01 S96led -> ../init.d/led

lrwxrwxrwx    1 root     root            21 Dec  7 20:01 S98gpio_switch -> ../init.d/gpio_switch

lrwxrwxrwx    1 root     root            20 Dec  7 20:01 S98smartlinkd -> ../init.d/smartlinkd

lrwxrwxrwx    1 root     root            17 Dec  7 20:01 S98sysntpd -> ../init.d/sysntpd

lrwxrwxrwx    1 root     root            28 Dec  7 20:01 S99aw_upgrade_autorun -> ../init.d/aw_upgrade_autorun

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# cat S13init_rgb_lcd 

#!/bin/sh /etc/rc.common

# Copyright (C) 2006-2011 OpenWrt.org

 

START=13

STOP=98

DEPEND=dbus

 

USE_PROCD=1

PROG=/bin/healthd

OOM_ADJ=-17

 

start_service() {

echo wyb10

spidev_test0

ehco wyb12

cb_test &

#procd_open_instance

#procd_set_param oom_adj $OOM_ADJ

#procd_set_param command $PROG -D

#procd_close_instance

}

 

shutdown() {

#echo shutdown

echo wyb14

}

 

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d#

 

 

可以看见已经有了启动脚本init_rgb_lcd了,但是屏幕还是没有显示。执行spidev_test0之后屏幕就有显示了!

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# spidev_test0 

spi mode: 0

bits per word: 8

max speed: 500000 Hz (500 KHz)

send spi message success!

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ps

  PID USER       VSZ STAT COMMAND

    1 root      1352 S    /sbin/procd

    2 root         0 SW   [kthreadd]

    3 root         0 SW   [ksoftirqd/0]

    4 root         0 SW   [kworker/0:0]

    5 root         0 SW   [kworker/u:0]

    6 root         0 SW   [migration/0]

   16 root         0 SW<  [khelper]

   17 root         0 SW<  [suspend]

   18 root         0 SW<  [sync_system_wor]

   19 root         0 SW   [kworker/0:1]

   23 root         0 SW   [sync_supers]

   24 root         0 SW   [bdi-default]

   25 root         0 SW<  [kblockd]

   26 root         0 SW   [sytem]

   27 root         0 SW   [khubd]

   28 root         0 SW<  [cfg80211]

   30 root         0 SW   [kdsm]

   31 root         0 SW   [kswapd0]

   32 root         0 SW   [fsnotify_mark]

   33 root         0 SW<  [crypto]

   49 root         0 SW   [kapmd]

   50 root         0 SW   [kworker/0:2]

   51 root         0 SW<  [spi.0]

   52 root         0 SW<  [f_mtp]

   53 root         0 SW   [file-storage]

   54 root         0 SW   [cfinteractive]

   55 root         0 SW   [auto_cpu_hotplu]

   56 root         0 SW   [kworker/u:1]

   57 root         0 SW   [mmcqd/0]

   58 root         0 SW   [mmcqd/0boot0]

   59 root         0 SW   [mmcqd/0boot1]

   60 root         0 SW   [kworker/u:2]

   61 root         0 SW<  [switch_resume]

   62 root         0 SW<  [codec_init]

   63 root         0 SW<  [krfcommd]

   64 root         0 SW<  [deferwq]

   65 root         0 SW<  [devfreq_wq]

   94 root         0 SW   [jbd2/mmcblk0p8-]

   95 root         0 SW<  [ext4-dio-unwrit]

  107 root       968 S    /sbin/ubusd

  115 root      1036 S    /bin/ash --login

  240 root      1032 S    /usr/sbin/ntpd -n -S /usr/sbin/ntpd-hotplug -p ntp5.

  241 root      1160 S    /bin/adbd -D

  242 root      1908 S    smartlinkd -d

  243 root      1312 S    /usr/sbin/dbus-daemon --system

  245 root      1012 S    /sbin/logd -S 64

  246 root      1128 S    /sbin/logread -f -F /root/.lastlog -p /var/run/logre

  282 root      1608 S    /usr/sbin/nativepower_daemon

  292 root      3044 S    /bin/healthd -D

  303 root      1072 S    cb_test

  339 root      1428 S    /sbin/netifd

  347 root         0 SW   [jbd2/mmcblk0p1-]

  348 root         0 SW<  [ext4-dio-unwrit]

  478 nobody    1704 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k -x /va

  489 root         0 SW   [wl_event_handle]

  490 root         0 SW   [dhd_watchdog_th]

  491 root         0 SW   [dhd_dpc]

  494 root         0 SW   [dhd_rxf]

  528 root         0 SW<  [goodix_wq]

  529 root         0 SW<  [goodix_init]

  530 root         0 SW<  [goodix_resume]

  659 root         0 SW   [flush-179:0]

 2191 root         0 SW   [migration/1]

 2192 root         0 SW   [kworker/1:0]

 2193 root         0 SW   [ksoftirqd/1]

 2194 root      1032 R    ps

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ps | grep spi*

   17 root         0 SW<  [suspend]

   51 root         0 SW<  [spi.0]

 2337 root      1032 S    grep spi*

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ps | grep cb*

    1 root      1352 S    /sbin/procd

   18 root         0 SW<  [sync_system_wor]

   23 root         0 SW   [sync_supers]

   25 root         0 SW<  [kblockd]

   28 root         0 SW<  [cfg80211]

   33 root         0 SW<  [crypto]

   54 root         0 SW   [cfinteractive]

   55 root         0 SW   [auto_cpu_hotplu]

   57 root         0 SW   [mmcqd/0]

   58 root         0 SW   [mmcqd/0boot0]

   59 root         0 SW   [mmcqd/0boot1]

   61 root         0 SW<  [switch_resume]

   62 root         0 SW<  [codec_init]

   63 root         0 SW<  [krfcommd]

   94 root         0 SW   [jbd2/mmcblk0p8-]

  303 root      1072 S    cb_test

  347 root         0 SW   [jbd2/mmcblk0p1-]

  478 nobody    1704 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k -x /va

  490 root         0 SW   [dhd_watchdog_th]

  491 root         0 SW   [dhd_dpc]

 2439 root      1032 S    grep cb*

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ps | grep cb_t*

  303 root      1072 S    cb_test

 2585 root      1032 S    grep cb_t*

root@TinaLinux:/etc/rc.d#

root@TinaLinux:/etc/rc.d# ps | grep cb_test

  303 root      1072 S    cb_test

 2634 root      1032 S    grep cb_test

root@TinaLinux:/etc/rc.d#

 

 

cb_test还是在后台执行,那应该RGB格式的LCD屏幕还是没有通过SPI接口初始化完成!

就是执行spidev_test0的时候SPI接口还不稳定!最开始延迟10秒钟可以了,但是感觉太久,最后根据实践修改为两秒钟了!

 

root@TinaLinux:/etc/init.d# ll

drwxr-xr-x    1 root     root          1024 Dec  7 20:01 .

drwxr-xr-x    1 root     root          1024 Dec 13 12:05 ..

-rwxr-xr-x    1 root     root           635 Dec  7 18:49 adbd

-rwxr-xr-x    1 root     root           254 Dec  7 18:49 aw_fstab

-rwxr-xr-x    1 root     root           373 Dec  7 18:49 aw_upgrade_autorun

-rwxr-xr-x    1 root     root          1844 Dec  7 20:00 boot

-rwxr-xr-x    1 root     root           741 Dec  7 18:50 cron

-rwxr-xr-x    1 root     root           376 Dec  7 18:50 dbus

-rwxr-xr-x    1 root     root         16062 Dec  7 18:49 dnsmasq

-rwxr-xr-x    1 root     root           448 Dec  7 20:00 done

-rwxr-xr-x    1 root     root           353 Dec  7 18:50 fstab

-rwxr-xr-x    1 root     root           805 Dec  7 20:00 gpio_switch

-rwxr-xr-x    1 root     root           300 Dec  7 18:50 healthd

-rwxr-xr-x    1 root     root           376 Dec 13 12:09 init_rgb_lcd

-rwxr-xr-x    1 root     root          2356 Dec  7 20:00 led

-rwxr-xr-x    1 root     root          2347 Dec  7 18:50 log

-rwxr-xr-x    1 root     root           313 Dec  7 18:50 nativepower

-rwxr-xr-x    1 root     root          2758 Dec  7 18:50 network

-rwxr-xr-x    1 root     root           239 Dec  7 18:51 smartlinkd

-rwxr-xr-x    1 root     root           186 Dec  7 20:00 sysctl

-rwxr-xr-x    1 root     root           530 Dec  7 20:00 sysfixtime

-rwxr-xr-x    1 root     root           931 Dec  7 18:50 sysntpd

-rwxr-xr-x    1 root     root          1059 Dec  7 20:00 system

-rwxr-xr-x    1 root     root           106 Dec  7 20:00 umount

root@TinaLinux:/etc/init.d#

root@TinaLinux:/etc/init.d# vi init_rgb_lcd

root@TinaLinux:/etc/init.d#

 

 

#!/bin/sh /etc/rc.common

# Copyright (C) 2006-2011 OpenWrt.org

 

START=13

STOP=98

DEPEND=dbus

 

USE_PROCD=1

PROG=/bin/healthd

OOM_ADJ=-17

 

start_service() {

        sleep 2

        echo wyb10

        spidev_test0

        ehco wyb12

        cb_test &

        #procd_open_instance

        #procd_set_param oom_adj $OOM_ADJ

        #procd_set_param command $PROG -D

        #procd_close_instance

}

 

shutdown() {

        #echo shutdown

        echo wyb14

}

 

~

~

~

~

~

~

~

~

~

~

~

~

~

~

I init_rgb_lcd [Modified] 13/28 46%

 

 

对于SDK,重新编译打包刷机即可!

 

 

阅读全文
0 0
原创粉丝点击