20240619在飞凌OK3588-C的LINUX系统启动的时候拉高3个GPIO口141-111-120【方法一】

20240619在飞凌OK3588-C的LINUX系统启动的时候拉高3个GPIO口141-111-120【方法一】

2024/6/19 16:12

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

修改rcS,在系统启动的时候,即可拉高。

通过adb pull拉去rcS到WIN11上,修改之后adb push到OK3588-C即可。

还需要修改rcS的权限!

C:\Users\QQ>cd D:\20240423wyb\20240619在启动-拉高\新建文件夹

C:\Users\QQ>d:

D:\20240423wyb\20240619在启动-拉高\新建文件夹>dir

驱动器 D 中的卷是 新加卷

卷的序列号是 F618-8199

D:\20240423wyb\20240619在启动-拉高\新建文件夹 的目录

2024/06/19 15:47 <DIR> .

2024/06/19 15:47 <DIR> ..

0 个文件 0 字节

2 个目录 81,063,968,768 可用字节

D:\20240423wyb\20240619在启动-拉高\新建文件夹>adb pull /etc/init.d

/etc/init.d/: 29 files pulled, 0 skipped. 0.7 MB/s (44692 bytes in 0.059s)

D:\20240423wyb\20240619在启动-拉高\新建文件夹>dir

驱动器 D 中的卷是 新加卷

卷的序列号是 F618-8199

D:\20240423wyb\20240619在启动-拉高\新建文件夹 的目录

2024/06/19 15:48 <DIR> .

2024/06/19 15:47 <DIR> ..

2024/06/19 15:48 <DIR> init.d

0 个文件 0 字节

3 个目录 81,063,882,752 可用字节

D:\20240423wyb\20240619在启动-拉高\新建文件夹>cd init.d

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>dir

驱动器 D 中的卷是 新加卷

卷的序列号是 F618-8199

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d 的目录

2024/06/19 15:48 <DIR> .

2024/06/19 15:48 <DIR> ..

2024/06/19 15:48 11 .usb_config

2024/06/19 15:48 471 ninfod.sh
2024/06/19 15:48 423 rcK
2024/06/19 16:00 766 rcS

2024/06/19 15:48 1,012 S01syslogd

2024/06/19 15:48 1,004 S02klogd

2024/06/19 15:48 2,804 S02sysctl

2024/06/19 15:48 428 S10async_commit.sh

2024/06/19 15:48 1,594 S10udev

2024/06/19 15:48 1,684 S20urandom

2024/06/19 15:48 12,121 S21mountall.sh

2024/06/19 15:48 1,619 S30dbus

2024/06/19 15:48 820 S35iptables

2024/06/19 15:48 1,001 S40bluetooth

2024/06/19 15:48 438 S40network

2024/06/19 15:48 457 S40rkaiq_3A

2024/06/19 15:48 901 S49weston

2024/06/19 15:48 1,354 S50dropbear

2024/06/19 15:48 576 S50lighttpd

2024/06/19 15:48 724 S50matrix-browser

2024/06/19 15:48 871 S50pulseaudio

2024/06/19 15:48 532 S50sshd

2024/06/19 15:48 10,619 S50usbdevice

2024/06/19 15:48 431 S70vsftpd

2024/06/19 15:48 427 S80dnsmasq

2024/06/19 15:48 905 S98Bluez_init

2024/06/19 15:48 293 S99chromium-wayland.sh

2024/06/19 15:48 468 S99input-event-daemon

2024/06/19 15:48 296 S99qtwebengine.sh

29 个文件 45,050 字节

2 个目录 81,063,882,752 可用字节

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>adb push rcS /etc/init.d/

rcS: 1 file pushed, 0 skipped. 0.0 MB/s (766 bytes in 0.067s)

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>adb push rcS /etc/init.d/

adb server version (40) doesn't match this client (41); killing...

* daemon started successfully

rcS: 1 file pushed, 0 skipped. 0.0 MB/s (766 bytes in 0.061s)

D:\20240423wyb\20240619在启动-拉高\新建文件夹\init.d>

root@ok3588:/etc/init.d#

root@ok3588:/etc/init.d# ls -l

total 128

-rwxr-xr-x 1 root root 1012 Mar 9 2023 S01syslogd

-rwxr-xr-x 1 root root 1004 Mar 9 2023 S02klogd

-rwxr-xr-x 1 root root 2804 Mar 9 2023 S02sysctl

-rwxr-xr-x 1 root root 428 Mar 9 2023 S10async_commit.sh

-rwxr-xr-x 1 root root 1594 Mar 9 2023 S10udev

-rwxr-xr-x 1 root root 1684 Mar 9 2023 S20urandom

-rwxr-xr-x 1 root root 12121 Mar 9 2023 S21mountall.sh

-rwxr-xr-x 1 root root 1619 Mar 9 2023 S30dbus

-rwxr-xr-x 1 root root 820 Mar 9 2023 S35iptables

-rwxr-xr-x 1 root root 1001 Mar 9 2023 S40bluetooth

-rwxr-xr-x 1 root root 438 Mar 9 2023 S40network

-rwxr-xr-x 1 root root 457 Mar 9 2023 S40rkaiq_3A

-rwxr-xr-x 1 root root 901 Mar 9 2023 S49weston

-rwxr-xr-x 1 root root 1354 Mar 9 2023 S50dropbear

-rwxr-xr-x 1 root root 576 Mar 9 2023 S50lighttpd

-rwxr-xr-x 1 root root 724 Mar 9 2023 S50matrix-browser

-rwxr-xr-x 1 root root 871 Mar 9 2023 S50pulseaudio

-rwxr-xr-x 1 root root 532 Mar 9 2023 S50sshd

-rwxr-xr-x 1 root root 10619 Mar 9 2023 S50usbdevice

-rwxr-xr-x 1 root root 431 Mar 9 2023 S70vsftpd

-rwxr-xr-x 1 root root 427 Mar 9 2023 S80dnsmasq

-rwxr-xr-x 1 root root 905 Mar 9 2023 S98Bluez_init

-rwxr-xr-x 1 root root 293 Mar 9 2023 S99chromium-wayland.sh

-rwxr-xr-x 1 root root 468 Mar 9 2023 S99input-event-daemon

-rwxr-xr-x 1 root root 296 Mar 9 2023 S99qtwebengine.sh

-rw-r--r-- 1 root root 471 Mar 9 2023 ninfod.sh
-rwxr-xr-x 1 root root 423 Mar 9 2023 rcK
-rw-rw-rw- 1 root root 766 Jun 19 2024 rcS

root@ok3588:/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

root@ok3588:/etc/init.d# sudo chmod 777 rcS

sh: sudo: command not found
root@ok3588:/etc/init.d# chmod 777 rcS
root@ok3588:/etc/init.d# ls -l

total 128

-rwxr-xr-x 1 root root 1012 Mar 9 2023 S01syslogd

-rwxr-xr-x 1 root root 1004 Mar 9 2023 S02klogd

-rwxr-xr-x 1 root root 2804 Mar 9 2023 S02sysctl

-rwxr-xr-x 1 root root 428 Mar 9 2023 S10async_commit.sh

-rwxr-xr-x 1 root root 1594 Mar 9 2023 S10udev

-rwxr-xr-x 1 root root 1684 Mar 9 2023 S20urandom

-rwxr-xr-x 1 root root 12121 Mar 9 2023 S21mountall.sh

-rwxr-xr-x 1 root root 1619 Mar 9 2023 S30dbus

-rwxr-xr-x 1 root root 820 Mar 9 2023 S35iptables

-rwxr-xr-x 1 root root 1001 Mar 9 2023 S40bluetooth

-rwxr-xr-x 1 root root 438 Mar 9 2023 S40network

-rwxr-xr-x 1 root root 457 Mar 9 2023 S40rkaiq_3A

-rwxr-xr-x 1 root root 901 Mar 9 2023 S49weston

-rwxr-xr-x 1 root root 1354 Mar 9 2023 S50dropbear

-rwxr-xr-x 1 root root 576 Mar 9 2023 S50lighttpd

-rwxr-xr-x 1 root root 724 Mar 9 2023 S50matrix-browser

-rwxr-xr-x 1 root root 871 Mar 9 2023 S50pulseaudio

-rwxr-xr-x 1 root root 532 Mar 9 2023 S50sshd

-rwxr-xr-x 1 root root 10619 Mar 9 2023 S50usbdevice

-rwxr-xr-x 1 root root 431 Mar 9 2023 S70vsftpd

-rwxr-xr-x 1 root root 427 Mar 9 2023 S80dnsmasq

-rwxr-xr-x 1 root root 905 Mar 9 2023 S98Bluez_init

-rwxr-xr-x 1 root root 293 Mar 9 2023 S99chromium-wayland.sh

-rwxr-xr-x 1 root root 468 Mar 9 2023 S99input-event-daemon

-rwxr-xr-x 1 root root 296 Mar 9 2023 S99qtwebengine.sh

-rw-r--r-- 1 root root 471 Mar 9 2023 ninfod.sh
-rwxr-xr-x 1 root root 423 Mar 9 2023 rcK
-rwxrwxrwx 1 root root 766 Jun 19 2024 rcS

root@ok3588:/etc/init.d# cat rcS

【失败】

尝试修改SDK/系统中的rcS,尝试让系统编译的时候直接拉高GPIO4_B5、GPIO3_B7和GPIO3_D0。

编译完成之后的IMG刷机之后,发现

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$ cat ./buildroot/package/initscripts/init.d/rcS^C

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$ find . -name rcS

./buildroot/board/rockchip/common/tinyrootfs/overlay/etc/init.d/rcS

./buildroot/board/forlinx/common/tinyrootfs/overlay/etc/init.d/rcS

./buildroot/package/initscripts/init.d/rcS

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$ ll ./buildroot/board/rockchip/common/tinyrootfs/overlay/etc/init.d/rcS

-rwxr-xr-x 1 viewpro viewpro 408 12月 21 09:40 ./buildroot/board/rockchip/common/tinyrootfs/overlay/etc/init.d/rcS*

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$ ll ./buildroot/board/forlinx/common/tinyrootfs/overlay/etc/init.d/rcS

-rwxr-xr-x 1 viewpro viewpro 408 12月 21 09:40 ./buildroot/board/forlinx/common/tinyrootfs/overlay/etc/init.d/rcS*

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$ ll ./buildroot/package/initscripts/init.d/rcS

-rwxr-xr-x 1 viewpro viewpro 408 12月 21 09:40 ./buildroot/package/initscripts/init.d/rcS*

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

viewpro@viewpro-ThinkBook-16-G5-IRH:~/versions/fpga_OK3588_Linux_fs$

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 "2024/6/19 16:14 wenyuanbo1"

Z:\OK3588_Linux_fs\buildroot\board\rockchip\common\tinyrootfs\overlay\etc\init.d\rcS

Z:\OK3588_Linux_fs\buildroot\board\forlinx\common\tinyrootfs\overlay\etc\init.d\rcS

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

root@ok3588:/etc/init.d# ls -l

total 128

-rwxr-xr-x 1 root root 1012 Mar 9 2023 S01syslogd

-rwxr-xr-x 1 root root 1004 Mar 9 2023 S02klogd

-rwxr-xr-x 1 root root 2804 Mar 9 2023 S02sysctl

-rwxr-xr-x 1 root root 428 Mar 9 2023 S10async_commit.sh

-rwxr-xr-x 1 root root 1594 Mar 9 2023 S10udev

-rwxr-xr-x 1 root root 1684 Mar 9 2023 S20urandom

-rwxr-xr-x 1 root root 12121 Mar 9 2023 S21mountall.sh

-rwxr-xr-x 1 root root 1619 Mar 9 2023 S30dbus

-rwxr-xr-x 1 root root 820 Mar 9 2023 S35iptables

-rwxr-xr-x 1 root root 1001 Mar 9 2023 S40bluetooth

-rwxr-xr-x 1 root root 438 Mar 9 2023 S40network

-rwxr-xr-x 1 root root 457 Mar 9 2023 S40rkaiq_3A

-rwxr-xr-x 1 root root 901 Mar 9 2023 S49weston

-rwxr-xr-x 1 root root 1354 Mar 9 2023 S50dropbear

-rwxr-xr-x 1 root root 576 Mar 9 2023 S50lighttpd

-rwxr-xr-x 1 root root 724 Mar 9 2023 S50matrix-browser

-rwxr-xr-x 1 root root 871 Mar 9 2023 S50pulseaudio

-rwxr-xr-x 1 root root 532 Mar 9 2023 S50sshd

-rwxr-xr-x 1 root root 10619 Mar 9 2023 S50usbdevice

-rwxr-xr-x 1 root root 431 Mar 9 2023 S70vsftpd

-rwxr-xr-x 1 root root 427 Mar 9 2023 S80dnsmasq

-rwxr-xr-x 1 root root 905 Mar 9 2023 S98Bluez_init

-rwxr-xr-x 1 root root 293 Mar 9 2023 S99chromium-wayland.sh

-rwxr-xr-x 1 root root 468 Mar 9 2023 S99input-event-daemon

-rwxr-xr-x 1 root root 296 Mar 9 2023 S99qtwebengine.sh

-rw-r--r-- 1 root root 471 Mar 9 2023 ninfod.sh

-rwxr-xr-x 1 root root 423 Mar 9 2023 rcK

-rwxrwxrwx 1 root root 766 Jun 19 2024 rcS

root@ok3588:/etc/init.d#

root@ok3588:/etc/init.d#

root@ok3588:/etc/init.d# ls -l *.sh

-rwxr-xr-x 1 root root 428 Mar 9 2023 S10async_commit.sh

-rwxr-xr-x 1 root root 12121 Mar 9 2023 S21mountall.sh

-rwxr-xr-x 1 root root 293 Mar 9 2023 S99chromium-wayland.sh

-rwxr-xr-x 1 root root 296 Mar 9 2023 S99qtwebengine.sh

-rw-r--r-- 1 root root 471 Mar 9 2023 ninfod.sh

root@ok3588:/etc/init.d#

参考资料:
LVDS12V_EN GPIO4_B5 32*4+8*1+5=141 可高可低
FG_3V3_EN GPIO3_B7 32*3+8*1+7=111 不能作为GPIO口
FBGA_1V2_EN GPIO3_D0 32*3+8*3+0=120 不能被拉低

<4 13 8 &pcfg_pull_up_drv_level_6>,

enable-gpios = <&gpio4 RK_PB1 GPIO_ACTIVE_HIGH>;

LVDS12V_EN GPIO4_B5 <4 13 32*4+8*1+5=141 可高可低

FG_3V3_EN GPIO3_B7 <3 15 32*3+8*1+7=111 不能作为GPIO口

FBGA_1V2_EN GPIO3_D0 <3 24 32*3+8*3+0=120 不能被拉低

<&gpio4 RK_PB5

<&gpio3 RK_PB7

<&gpio3 RK_PD0

cat /sys/kernel/debug/pinctrl/pinctrl-rockchip-pinctrl/pinmux-pins

https://www.cnblogs.com/ma-zhiqiang/p/17663273.html

regulator-fixed and regulator-gpio

https://blog.csdn.net/nb124667390/article/details/132533506

RK3588平台驱动调试篇 [ GPIO篇 ] - RK3588-对GPIO的操作控制

https://blog.csdn.net/weixin_43245753/article/details/125380619?spm=1001.2014.3001.5502

Rockchip RK3588 kernel dts解析之regulator-fixed

https://doc.embedfire.com/linux/rk356x/driver/zh/latest/linux_driver/subsystem_gpio.html

  1. Pinctrl子系统和GPIO子系统------LED实验
相关推荐
gavin_gxh3 分钟前
ORACLE 删除archivelog日志
数据库·oracle
一叶飘零_sweeeet6 分钟前
MongoDB 基础与应用
数据库·mongodb
猿小喵22 分钟前
DBA之路,始于足下
数据库·dba
tyler_download31 分钟前
golang 实现比特币内核:实现基于椭圆曲线的数字签名和验证
开发语言·数据库·golang
weixin_449310841 小时前
高效集成:聚水潭采购数据同步到MySQL
android·数据库·mysql
Cachel wood2 小时前
Github配置ssh key原理及操作步骤
运维·开发语言·数据库·windows·postgresql·ssh·github
standxy2 小时前
如何将钉钉新收款单数据高效集成到MySQL
数据库·mysql·钉钉
Narutolxy3 小时前
MySQL 权限困境:从权限丢失到权限重生的完整解决方案20241108
数据库·mysql
Venchill3 小时前
安装和卸载Mysql(压缩版)
数据库·mysql
Humbunklung3 小时前
一种EF(EntityFramework) MySQL修改表名去掉dbo前缀的方法
数据库·mysql·c#