20240621将需要自启动的部分放到RK3588平台的Buildroot系统的rcS文件中

20240621将需要自启动的部分放到RK3588平台的Buildroot系统的rcS文件中
2024/6/21 17:15


开发板:飞凌OK3588-C
SDK:Rockchip原厂的Buildroot

缘起:在凌OK3588-C的LINUX R4系统启动的时候,需要拉高GPIO4_B5、GPIO3_B7和GPIO3_D0。

LVDS12V_EN    GPIO4_B5    32*4+8*1+5=141
FG_3V3_EN     GPIO3_B7    32*3+8*1+7=111
FBGA_1V2_EN   GPIO3_D0    32*3+8*3+0=120

echo 141 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio141/direction
echo 1 > /sys/class/gpio/gpio141/value

echo 111 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio111/direction
echo 1 > /sys/class/gpio/gpio111/value

echo 120 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio120/direction
echo 1 > /sys/class/gpio/gpio120/value


通过grep找到rcS:
viewpro@viewpro-ThinkBook-16-G5-IRH:~$ 
viewpro@viewpro-ThinkBook-16-G5-IRH:~$ cd repo_RK3588_Buildroot20240508/
viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ 
viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ ll
total 68
drwxrwxr-x 15 viewpro viewpro  4096 5月  20 16:29 ./
drwxr-xr-x 37 viewpro viewpro 12288 6月  21 11:30 ../
drwxrwxr-x  4 viewpro viewpro  4096 5月  20 16:26 app/
drwxrwxr-x 17 viewpro viewpro  4096 5月  20 16:48 buildroot/
lrwxrwxrwx  1 viewpro viewpro    39 5月  20 16:26 build.sh -> device/rockchip/common/scripts/build.sh*
drwxrwxr-x  9 viewpro viewpro  4096 5月  20 16:26 debian/
drwxrwxr-x  3 viewpro viewpro  4096 5月  20 16:26 device/
drwxrwxr-x  6 viewpro viewpro  4096 5月  20 16:26 docs/
lrwxrwxrwx  1 viewpro viewpro    27 5月  20 16:26 envsetup.sh -> buildroot/build/envsetup.sh*
drwxrwxr-x 27 viewpro viewpro  4096 5月  20 16:27 external/
drwxrwxr-x 26 viewpro viewpro  4096 5月  20 16:26 kernel/
lrwxrwxrwx  1 viewpro viewpro    31 5月  20 16:26 Makefile -> device/rockchip/common/Makefile
drwxrwxr-x  3 viewpro viewpro  4096 5月  20 16:26 prebuilts/
drwxrwxr-x  9 viewpro viewpro  4096 5月  20 16:27 rkbin/
lrwxrwxrwx  1 viewpro viewpro    41 5月  20 16:26 rkflash.sh -> device/rockchip/common/scripts/rkflash.sh*
drwxrwxr-x  5 viewpro viewpro  4096 5月  20 16:27 tools/
drwxrwxr-x 24 viewpro viewpro  4096 5月  20 16:27 u-boot/
drwxrwxr-x  5 viewpro viewpro  4096 5月  20 16:27 uefi/
drwxrwxr-x  9 viewpro viewpro  4096 5月  20 16:27 yocto/
viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ 
viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ 
viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ find . -name rcS
./buildroot/package/initscripts/init.d/rcS

./yocto/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcS
./yocto/poky/meta/recipes-core/sysvinit/sysvinit/rcS
./yocto/poky/meta/recipes-core/busybox/files/rcS

viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508$ top


虽然最有可能的是:./buildroot/package/initscripts/init.d/rcS
但是为了保险起见,给yocto的三个文件也加入了相同的程序块/代码块。
【当然最后一行不同,以便区分!】


刷机之后确认的LOG:
root@rk3588-buildroot:/# 
root@rk3588-buildroot:/# cd /etc/init.d/
root@rk3588-buildroot:/etc/init.d# ls -l

total 108
-rwxr-xr-x 1 root root  427 Jun 21  2024 S00mountall.sh
-rwxr-xr-x 1 root root 1012 Jun 21  2024 S01syslogd
-rwxr-xr-x 1 root root 1004 Jun 21  2024 S02klogd
-rwxr-xr-x 1 root root 2804 Jun 21  2024 S02sysctl
-rwxr-xr-x 1 root root  369 Jun 21  2024 S05async-commit.sh
-rwxr-xr-x 1 root root 1594 Jun 21  2024 S10udev
-rwxr-xr-x 1 root root  620 Jun 21  2024 S13irqbalance
-rwxr-xr-x 1 root root 1684 Jun 21  2024 S20urandom
-rwxr-xr-x 1 root root 1619 Jun 21  2024 S30dbus
-rwxr-xr-x 1 root root  358 Jun 21  2024 S36wifibt-init.sh
-rwxr-xr-x 1 root root 1001 Jun 21  2024 S40bluetoothd
-rwxr-xr-x 1 root root  438 Jun 21  2024 S40network
-rwxr-xr-x 1 root root  457 May 20  2024 S40rkaiq_3A
-rwxr-xr-x 1 root root  652 Jun 21  2024 S41dhcpcd
-rwxr-xr-x 1 root root  917 Jun 21  2024 S49ntp
-rwxr-xr-x 1 root root  914 Jun 21  2024 S49weston
-rwxr-xr-x 1 root root 1354 Jun 21  2024 S50dropbear
-rwxr-xr-x 1 root root  592 Jun 21  2024 S50pulseaudio
-rwxr-xr-x 1 root root  386 Jun 21  2024 S50usbdevice.sh
-rwxr-xr-x 1 root root  427 Jun 21  2024 S80dnsmasq
-rwxr-xr-x 1 root root  546 Jun 21  2024 S99-auto-reboot
-rwxr-xr-x 1 root root  293 Jun 21  2024 S99chromium-wayland.sh
-rwxr-xr-x 1 root root  447 Jun 21  2024 S99input-event-daemon
-rwxr-xr-x 1 root root 1950 Jun 21  2024 fuse3
-rw-r--r-- 1 root root  471 Jun 21  2024 ninfod.sh
-rwxr-xr-x 1 root root  423 Jun 21  2024 rcK
-rwxr-xr-x 1 root root  785 Jun 21  2024 rcS

root@rk3588-buildroot:/etc/init.d# 
root@rk3588-buildroot:/etc/init.d# cat rcS
#!/bin/sh


# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do

     # Ignore dangling symlinks (if any).
     [ ! -f "$i" ] && continue

     case "$i" in
    *.sh)
        # Source shell script for speed.
        (
        trap - INT QUIT TSTP
        set start
        . $i
        )
        ;;
    *)
        # No sh extension, so fork subprocess.
        $i start
        ;;
    esac
done


echo 141 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio141/direction
echo 1 > /sys/class/gpio/gpio141/value

echo 111 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio111/direction
echo 1 > /sys/class/gpio/gpio111/value

echo 120 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio120/direction
echo 1 > /sys/class/gpio/gpio120/value

echo "wenyuanbo1"

root@rk3588-buildroot:/etc/init.d# 
root@rk3588-buildroot:/etc/init.d# 


root@rk3588-buildroot:/etc/init.d# 
root@rk3588-buildroot:/etc/init.d# cd /sys/class/gpio/
root@rk3588-buildroot:/sys/class/gpio# 
root@rk3588-buildroot:/sys/class/gpio# 
root@rk3588-buildroot:/sys/class/gpio# ls -l
total 0
--w------- 1 root root 4096 Jan  1 00:00 export
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpio111 -> ../../devices/platform/pinctrl/fec40000.gpio/gpiochip3/gpio/gpio111
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpio120 -> ../../devices/platform/pinctrl/fec40000.gpio/gpiochip3/gpio/gpio120
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpio141 -> ../../devices/platform/pinctrl/fec50000.gpio/gpiochip4/gpio/gpio141

lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip0 -> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip128 -> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip32 -> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip509 -> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip64 -> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64
lrwxrwxrwx 1 root root    0 Jan  1 00:00 gpiochip96 -> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96
--w------- 1 root root 4096 Jan  1 00:00 unexport
root@rk3588-buildroot:/sys/class/gpio# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值