20220315在MT6739的android10下打开gpio节点

2023-05-16

20220315在MT6739的android10下打开gpio节点
2022/3/15 11:38


1、完整编译MT6739的android10:
time(./oneCmdMake 9186TOF_S5080BS_SKY_MV88_QGO eng)


2、在kernel中打开gpio选项:
rootroot@rootroot-System-Product1:~/n82$ 
rootroot@rootroot-System-Product1:~/n82$ find . -name .config
./external/toybox/.config
./out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ/.config
rootroot@rootroot-System-Product1:~/n82$ 
rootroot@rootroot-System-Product1:~/n82$ cd ./out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ/
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ ll
total 1176400
drwxrwxr-x 22 rootroot rootroot      4096 3月  21 17:51 ./
drwxrwxr-x 20 rootroot rootroot      4096 3月  21 16:16 ../
drwxrwxr-x  3 rootroot rootroot      4096 3月  21 15:14 arch/
-rw-rw-r--  1 rootroot rootroot    139089 3月  21 17:42 bak11.config
-rw-rw-r--  1 rootroot rootroot    139067 3月  21 17:44 bak21.config
drwxrwxr-x  3 rootroot rootroot      4096 3月  21 15:15 block/
-rw-rw-r--  1 rootroot rootroot   1467016 3月  21 17:50 built-in.o
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 15:14 certs/
-rw-rw-r--  1 rootroot rootroot    139067 3月  21 17:48 .config
-rw-rw-r--  1 rootroot rootroot    139089 3月  21 15:14 .config.old
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 15:18 crypto/
drwxrwxr-x 62 rootroot rootroot      4096 3月  21 17:50 drivers/
-rw-rw-r--  1 rootroot rootroot       100 3月  21 15:14 dtbimg.cfg
-rw-rw-r--  1 rootroot rootroot       119 3月  21 15:14 dtboimg.cfg
-rw-rw-r--  1 rootroot rootroot        16 3月  21 17:51 end.txt
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 15:15 firmware/
drwxrwxr-x 25 rootroot rootroot      4096 3月  21 15:21 fs/
drwxrwxr-x  4 rootroot rootroot      4096 3月  21 15:14 include/
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 17:50 init/
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 15:14 ipc/
drwxrwxr-x 15 rootroot rootroot      4096 3月  21 17:50 kernel/
drwxrwxr-x  8 rootroot rootroot     12288 3月  21 15:17 lib/
-rw-rw-r--  1 rootroot rootroot       621 3月  21 17:50 Makefile
-rw-rw-r--  1 rootroot rootroot       903 3月  21 17:50 .missing-syscalls.d
drwxrwxr-x  2 rootroot rootroot     12288 3月  21 15:15 mm/
-rw-rw-r--  1 rootroot rootroot     25642 3月  21 17:50 modules.builtin
-rw-rw-r--  1 rootroot rootroot       105 3月  21 17:51 modules.order
-rw-rw-r--  1 rootroot rootroot    553475 3月  21 17:51 Module.symvers
drwxrwxr-x 20 rootroot rootroot      4096 3月  21 15:21 net/
-rw-rw-r--  1 rootroot rootroot   7544298 3月  21 17:51 nm_output.txt
drwxrwxr-x  8 rootroot rootroot      4096 3月  21 15:14 scripts/
drwxrwxr-x  5 rootroot rootroot      4096 3月  21 15:15 security/
drwxrwxr-x 22 rootroot rootroot      4096 3月  21 17:50 sound/
lrwxrwxrwx  1 rootroot rootroot        30 3月  21 17:50 source -> /home/rootroot/n82/kernel-4.14/
-rw-rw-r--  1 rootroot rootroot        18 3月  21 17:51 stext.txt
-rw-rw-r--  1 rootroot rootroot   5305880 3月  21 17:51 System.map
-rw-rw-r--  1 rootroot rootroot   2515688 3月  21 17:51 .tmp_kallsyms1.o
-rw-rw-r--  1 rootroot rootroot  14858012 3月  21 17:51 .tmp_kallsyms1.S
-rw-rw-r--  1 rootroot rootroot   2515688 3月  21 17:51 .tmp_kallsyms2.o
-rw-rw-r--  1 rootroot rootroot  14858012 3月  21 17:51 .tmp_kallsyms2.S
-rw-rw-r--  1 rootroot rootroot   5305880 3月  21 17:51 .tmp_System.map
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 17:50 .tmp_versions/
-rwxrwxr-x  1 rootroot rootroot 235238588 3月  21 17:51 .tmp_vmlinux1*
-rwxrwxr-x  1 rootroot rootroot 237794788 3月  21 17:51 .tmp_vmlinux2*
drwxrwxr-x  2 rootroot rootroot      4096 3月  21 15:14 usr/
-rw-rw-r--  1 rootroot rootroot         2 3月  21 17:50 .version
drwxrwxr-x  3 rootroot rootroot      4096 3月  21 15:17 virt/
-rwxrwxr-x  1 rootroot rootroot 237794788 3月  21 17:51 vmlinux*
-rw-rw-r--  1 rootroot rootroot       240 3月  21 17:51 .vmlinux.cmd
-rw-rw-r--  1 rootroot rootroot 438875964 3月  21 17:50 vmlinux.o
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ cp .config bak21.config^C
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ make ARCH=arm menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf  Kconfig
'rivers/misc/mediatek/sensors-1.0/accelerometer/KXTJ2_1009/Kconfig:1:warning: ignoring unsupported character '
'rivers/misc/mediatek/sensors-1.0/accelerometer/KXTJ2_1009/Kconfig:2:warning: ignoring unsupported character '
'rivers/misc/mediatek/sensors-1.0/accelerometer/KXTJ2_1009/Kconfig:3:warning: ignoring unsupported character '
'rivers/misc/mediatek/sensors-1.0/accelerometer/KXTJ2_1009/Kconfig:4:warning: ignoring unsupported character '
'rivers/input/fingerprint/chipsailing_ree/Kconfig:1:warning: ignoring unsupported character '
'rivers/input/fingerprint/chipsailing_ree/Kconfig:2:warning: ignoring unsupported character '
'rivers/input/fingerprint/chipsailing_ree/Kconfig:3:warning: ignoring unsupported character '
'rivers/input/fingerprint/chipsailing_ree/Kconfig:4:warning: ignoring unsupported character '
drivers/virtio/Kconfig:1:warning: ignoring type redefinition of 'VIRTIO' from 'boolean' to 'tristate'
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 

Device Drivers  --->
    -*- GPIO Support  --->
        --- GPIO Support
        [ ]   Debug GPIO calls
        [ ]   /sys/class/gpio/... (sysfs interface)
        修改为:
        --- GPIO Support
        [*]   Debug GPIO calls
        [*]   /sys/class/gpio/... (sysfs interface)

rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ diff .config bak11.config 
2516,2517c2516,2517
< CONFIG_DEBUG_GPIO=y
< CONFIG_GPIO_SYSFS=y
---
> # CONFIG_DEBUG_GPIO is not set
> # CONFIG_GPIO_SYSFS is not set
rootroot@rootroot-System-Product1:~/n82/out/target/product/bird_k39tv1_bsp_1g/obj/KERNEL_OBJ$ 


3、重新编译内核:
./moduleMake eng bootimage
./moduleMake eng lk

4、确认gpio这个节点:
console:/ # 
console:/ # ls -l
total 140
dr-xr-xr-x  24 root   root       0 2022-03-03 00:30 acct
drwxr-xr-x  14 root   root     280 2022-03-03 00:31 apex
lrw-r--r--   1 root   root      11 2022-03-21 08:16 bin -> /system/bin
lrw-r--r--   1 root   root      50 2022-03-21 08:16 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
drwxrwx---   6 system cache   4096 2022-03-03 00:31 cache
lrw-r--r--   1 root   root      19 2022-03-21 08:16 charger -> /system/bin/charger
drwxr-xr-x   4 root   root       0 1970-01-01 00:00 config
lrw-r--r--   1 root   root      17 2022-03-21 08:16 d -> /sys/kernel/debug
drwxrwx--x  53 system system  4096 2022-03-03 00:31 data
drwxr-xr-x   2 root   root    4096 2022-03-21 07:14 debug_ramdisk
lrw-------   1 root   root      23 2022-03-21 08:16 default.prop -> system/etc/prop.default
drwxr-xr-x  21 root   root    4300 2022-03-03 00:31 dev
lrw-r--r--   1 root   root      11 2022-03-21 08:16 etc -> /system/etc
lrwxr-x---   1 root   shell     16 2022-03-21 08:16 init -> /system/bin/init
-rwxr-x---   1 root   shell   2255 2022-03-21 07:14 init.environ.rc
-rwxr-x---   1 root   shell     62 2022-03-21 08:09 init.preload.rc
-rwxr-x---   1 root   shell  33397 2022-03-21 08:11 init.rc
-rwxr-x---   1 root   shell   7690 2022-03-21 07:52 init.usb.configfs.rc
-rwxr-x---   1 root   shell   5649 2022-03-21 07:52 init.usb.rc
-rwxr-x---   1 root   shell    563 2022-03-21 07:52 init.zygote32.rc
drwx------   2 root   root   16384 2022-03-21 08:16 lost+found
drwxr-xr-x   7 root   root    4096 2022-03-03 00:31 metadata
drwxr-xr-x  13 root   system   280 2022-03-03 00:30 mnt
drwxr-xr-x   2 root   root    4096 2022-03-21 07:14 odm
drwxr-xr-x   2 root   root    4096 2022-03-21 07:14 oem
dr-xr-xr-x 389 root   root       0 1970-01-01 00:00 proc
drwxr-xr-x   8 root   root    4096 2022-03-21 08:15 product
lrw-r--r--   1 root   root      24 2022-03-21 08:16 product_services -> /system/product_services
drwxr-x---   2 root   shell   4096 2022-03-21 07:14 sbin
lrw-r--r--   1 root   root      21 2022-03-21 08:16 sdcard -> /storage/self/primary
drwxr-xr-x   3 root   root      80 2022-03-03 00:31 storage
dr-xr-xr-x  16 root   root       0 2022-03-03 00:30 sys
drwxr-xr-x  13 root   root    4096 2022-03-21 08:16 system
-rw-r--r--   1 root   root    2880 2022-03-21 07:14 ueventd.rc
drwxr-xr-x  12 root   root    4096 2022-03-21 08:14 vendor
-rw-r--r--   1 root   root     524 2022-03-21 08:11 verity_key
console:/ # 
console:/ # 
console:/ # cd /sys/
console:/sys # 
console:/sys # ls -l
total 0
drwxr-xr-x   2 root root 0 2022-03-21 08:17 block
drwxr-xr-x   2 root root 0 2022-03-21 08:17 board_properties
drwxr-xr-x   2 root root 0 2022-03-21 08:17 bootinfo
drwxr-xr-x  24 root root 0 2022-03-21 08:17 bus
drwxr-xr-x  73 root root 0 2022-03-21 08:16 class
drwxr-xr-x   4 root root 0 2022-03-21 08:17 dev
drwxr-xr-x   9 root root 0 2022-03-03 00:30 devices
drwxr-xr-x   3 root root 0 2022-03-21 08:17 firmware
drwxr-xr-x   9 root root 0 2022-03-03 00:30 fs
drwxr-xr-x  11 root root 0 2022-03-03 00:30 kernel
drwxr-xr-x 134 root root 0 2022-03-21 08:17 module
drwxr-xr-x   2 root root 0 2022-03-21 08:17 mtk_rgu
drwxr-xr-x   2 root root 0 2022-03-21 08:17 mtuart
drwxr-xr-x   5 root root 0 2022-03-03 00:30 power
console:/sys # 
console:/sys # 
console:/sys # cd class/                                                       
console:/sys/class # 
console:/sys/class # ls -l
total 0
drwxr-xr-x 2 root root 0 2022-03-21 08:17 BOOT
drwxr-xr-x 2 root root 0 2022-03-21 08:17 CAM_CALdrv1
drwxr-xr-x 2 root root 0 2022-03-21 08:17 Charging\ Adapter
drwxr-xr-x 2 root root 0 2022-03-21 08:17 MTK_SMI
drwxr-xr-x 2 root root 0 2022-03-21 08:17 MT_pmic_adc_cali
drwxr-xr-x 2 root root 0 2022-03-21 08:17 Vcodec
drwxr-xr-x 2 root root 0 2022-03-21 08:17 accdet
drwxr-xr-x 2 root root 0 2022-03-21 08:17 actuatordrv_main_af
drwxr-xr-x 2 root root 0 2022-03-21 08:17 android_usb
drwxr-xr-x 2 root root 0 2022-03-21 08:17 bdi
drwxr-xr-x 2 root root 0 2022-03-21 08:17 block
drwxr-xr-x 2 root root 0 2022-03-21 08:17 btif
drwxr-xr-x 2 root root 0 2022-03-21 08:17 ccci_md_sta
drwxr-xr-x 2 root root 0 2022-03-21 08:17 ccci_node
drwxr-xr-x 2 root root 0 2022-03-21 08:17 charger_ftm
drwxr-xr-x 2 root root 0 2022-03-21 08:17 devmap
drwxr-xr-x 2 root root 0 2022-03-21 08:17 drm
drwxr-xr-x 2 root root 0 2022-03-21 08:17 dual_role_usb
drwxr-xr-x 2 root root 0 2022-03-21 08:17 extcon
drwxr-xr-x 2 root root 0 2022-03-21 08:17 firmware
drwxr-xr-x 2 root root 0 2022-03-21 08:17 flashlight_core
drwxr-xr-x 2 root root 0 2022-03-21 08:17 fm
drwxr-xr-x 2 root root 0 2022-03-21 08:17 gauge
drwxr-xr-x 2 root root 0 2022-03-21 08:17 gpio
drwxr-xr-x 2 root root 0 2022-03-21 08:17 graphics
drwxr-xr-x 2 root root 0 2022-03-21 08:17 hidg
drwxr-xr-x 2 root root 0 2022-03-21 08:17 hidraw
drwxr-xr-x 2 root root 0 2022-03-21 08:17 i2c-adapter
drwxr-xr-x 2 root root 0 2022-03-21 08:17 ieee80211
drwxr-xr-x 2 root root 0 2022-03-21 08:17 input
drwxr-xr-x 2 root root 0 2022-03-21 08:17 ispdrv
drwxr-xr-x 2 root root 0 2022-03-21 08:17 leds
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mem
drwxr-xr-x 2 root root 0 2022-03-21 08:17 misc
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mix_event
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mmc_host
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mtk-adc-cali
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mtk_cmdq
drwxr-xr-x 2 root root 0 2022-03-21 08:17 mtk_disp_mgr
drwxr-xr-x 2 root root 0 2022-03-21 08:17 net
drwxr-xr-x 2 root root 0 2022-03-21 08:17 pmic_ftm
drwxr-xr-x 2 root root 0 2022-03-21 08:17 pmsg
drwxr-xr-x 2 root root 0 2022-03-21 08:17 power_supply
drwxr-xr-x 2 root root 0 2022-03-21 08:17 ppp
drwxr-xr-x 2 root root 0 2022-03-21 08:17 rc
drwxr-xr-x 2 root root 0 2022-03-21 08:17 regulator
drwxr-xr-x 2 root root 0 2022-03-21 08:17 rpmb
drwxr-xr-x 2 root root 0 2022-03-21 08:17 rpmb_dummy
drwxr-xr-x 2 root root 0 2022-03-21 08:17 rtc
drwxr-xr-x 2 root root 0 2022-03-21 08:17 scsi_device
drwxr-xr-x 2 root root 0 2022-03-21 08:17 scsi_disk
drwxr-xr-x 2 root root 0 2022-03-21 08:17 scsi_host
drwxr-xr-x 2 root root 0 2022-03-21 08:17 sec
drwxr-xr-x 2 root root 0 2022-03-21 08:17 sensor
drwxr-xr-x 2 root root 0 2022-03-21 08:17 sensordrv
drwxr-xr-x 2 root root 0 2022-03-21 08:17 sound
drwxr-xr-x 2 root root 0 2022-03-21 08:17 spi_master
drwxr-xr-x 2 root root 0 2022-03-21 08:17 stpbt
drwxr-xr-x 2 root root 0 2022-03-21 08:17 stpgps
drwxr-xr-x 2 root root 0 2022-03-21 08:17 stpwmt
drwxr-xr-x 2 root root 0 2022-03-21 08:17 switching_charger
drwxr-xr-x 2 root root 0 2022-03-21 08:17 thermal
drwxr-xr-x 2 root root 0 2022-03-21 08:17 tty
drwxr-xr-x 2 root root 0 2022-03-21 08:17 udc
drwxr-xr-x 2 root root 0 2022-03-21 08:17 usb_boost
drwxr-xr-x 2 root root 0 2022-03-21 08:17 usb_rawbulk
drwxr-xr-x 2 root root 0 2022-03-21 08:17 video4linux
drwxr-xr-x 2 root root 0 2022-03-21 08:17 wmtWifi
drwxr-xr-x 2 root root 0 2022-03-21 08:17 wmtdetect
drwxr-xr-x 2 root root 0 2022-03-21 08:17 xt_idletimer
drwxr-xr-x 2 root root 0 2022-03-21 08:17 zram-control
console:/sys/class # 
console:/sys/class # 
console:/sys/class # cd gpio/                                                  
console:/sys/class/gpio # 
console:/sys/class/gpio # ls -l
total 0
--w------- 1 root root 4096 2022-03-21 08:17 export
lrwxrwxrwx 1 root root    0 2022-03-21 08:17 gpiochip343 -> ../../devices/platform/1000b000.pinctrl/gpio/gpiochip343
--w------- 1 root root 4096 2022-03-21 08:17 unexport
console:/sys/class/gpio # 
console:/sys/class/gpio # 
console:/sys/class/gpio # 
console:/sys/class/gpio # 
console:/sys/class/gpio # 
console:/sys/class/gpio # echo 16 > export                                     
1|console:/sys/class/gpio # 
1|console:/sys/class/gpio # ls -l
total 0
--w------- 1 root root 4096 2022-03-21 08:18 export
lrwxrwxrwx 1 root root    0 2022-03-21 08:18 gpiochip343 -> ../../devices/platform/1000b000.pinctrl/gpio/gpiochip343
--w------- 1 root root 4096 2022-03-21 08:18 unexport
console:/sys/class/gpio # 
console:/sys/class/gpio # cat /p
proc/               product/            product_services
console:/sys/class/gpio # cat /proc/version                                    
Linux version 4.14.141 (nobody@android-build) (gcc version 4.9.x 20150123 (prerelease) (GCC)) #2 SMP PREEMPT Mon Mar 21 17:50:56 CST 2022
console:/sys/class/gpio # 
console:/sys/class/gpio # 

 

 

 

 


https://linus.blog.csdn.net/article/details/105760139
LinuxGPIO操作和MTK平台GPIO

缘起:
需要配置OTG,但是GPIO端口号不知道,于是尝试通过配置/sys/class/gpio/失败。
初步判断需要配置:/sys/devices/platform/1000b000.pinctrl/mt_gpio

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

20220315在MT6739的android10下打开gpio节点 的相关文章

随机推荐