20220314在MT6739的android8.1下打开gpio节点
2022/3/14 10:16
1、完整编译MT6739的android8.1的SDK:
rootroot@rootroot-desktop:~$
rootroot@rootroot-desktop:~$ cd mt6739_android8.1/
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ ll
total 304
drwxrwxr-x 36 rootroot rootroot 4096 3月 21 15:51 ./
drwxr-xr-x 22 rootroot rootroot 4096 3月 22 10:17 ../
lrwxrwxrwx 1 rootroot rootroot 19 3月 7 2018 Android.bp -> build/soong/root.bp*
drwxrwxr-x 22 rootroot rootroot 4096 3月 7 2018 art/
drwxrwxr-x 11 rootroot rootroot 4096 3月 7 2018 bionic/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 bootable/
lrwxrwxrwx 1 rootroot rootroot 26 3月 7 2018 bootstrap.bash -> build/soong/bootstrap.bash*
drwxr-xr-x 6 rootroot rootroot 4096 3月 9 18:15 build/
drwxrwxr-x 8 rootroot rootroot 4096 3月 7 2018 ccu_tool/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 compatibility/
drwxrwxr-x 11 rootroot rootroot 4096 3月 7 2018 cts/
drwxrwxr-x 9 rootroot rootroot 4096 3月 7 2018 dalvik/
drwxrwxr-x 5 rootroot rootroot 4096 3月 7 2018 developers/
drwxrwxr-x 20 rootroot rootroot 4096 3月 7 2018 development/
drwxr-xr-x 12 rootroot rootroot 4096 3月 9 15:45 device/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 docs/
drwxrwxr-x 267 rootroot rootroot 12288 3月 7 2018 external/
drwxr-xr-x 18 rootroot rootroot 4096 3月 9 15:45 frameworks/
drwxrwxr-x 13 rootroot rootroot 4096 3月 7 2018 hardware/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 kernel/
drwxrwxr-x 24 rootroot rootroot 4096 3月 7 2018 kernel-3.18/
drwxr-xr-x 25 rootroot rootroot 4096 3月 9 15:46 kernel-4.4/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 kernel_modules-4.4/
drwxrwxr-x 18 rootroot rootroot 4096 3月 7 2018 libcore/
drwxrwxr-x 7 rootroot rootroot 4096 3月 7 2018 libnativehelper/
-rw-rw-r-- 1 rootroot rootroot 87 3月 7 2018 Makefile
-rwxr--r-- 1 rootroot rootroot 150841 3月 10 10:10 mt6739_8p1_启动+新LCD+VT-tty1_20220310_1010.tar.gz*
drwxrwxr-x 7 rootroot rootroot 4096 3月 21 18:58 out/
drwxrwxr-x 9 rootroot rootroot 4096 3月 7 2018 packages/
drwxrwxr-x 2 rootroot rootroot 4096 3月 23 2018 PatchLog/
drwxrwxr-x 5 rootroot rootroot 4096 3月 7 2018 pdk/
drwxrwxr-x 8 rootroot rootroot 4096 3月 7 2018 platform_testing/
drwxrwxr-x 22 rootroot rootroot 4096 3月 7 2018 prebuilts/
drwxrwxr-x 24 rootroot rootroot 4096 3月 7 2018 sdk/
drwxrwxr-x 28 rootroot rootroot 4096 3月 7 2018 system/
drwxrwxr-x 4 rootroot rootroot 4096 3月 7 2018 test/
drwxrwxr-x 3 rootroot rootroot 4096 3月 7 2018 toolchain/
drwxrwxr-x 8 rootroot rootroot 4096 3月 7 2018 tools/
drwxrwxr-x 8 rootroot rootroot 4096 3月 7 2018 trusty/
drwxr-xr-x 3 rootroot rootroot 4096 3月 7 14:30 vendor/
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ source build/envsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/generic/car/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/uml/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/google/muskie/vendorsetup.sh
including device/google/taimen/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including device/mediatek/build/vendorsetup.sh
including device/mediateksample/k39tv1_64_bsp/vendorsetup.sh
including device/mediateksample/k39tv1_bsp_1g/vendorsetup.sh
including device/mediateksample/k39tv1_bsp_512/vendorsetup.sh
including device/mediateksample/k39tv1_bsp/vendorsetup.sh
including sdk/bash_completion/adb.bash
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng
7. full_fugu-userdebug
8. aosp_fugu-userdebug
9. aosp_car_emu_arm-userdebug
10. aosp_car_emu_arm64-userdebug
11. aosp_car_emu_x86-userdebug
12. aosp_car_emu_x86_64-userdebug
13. mini_emulator_arm64-userdebug
14. m_e_arm-userdebug
15. m_e_mips64-eng
16. m_e_mips-userdebug
17. mini_emulator_x86_64-userdebug
18. mini_emulator_x86-userdebug
19. uml-userdebug
20. aosp_dragon-userdebug
21. aosp_dragon-eng
22. aosp_marlin-userdebug
23. aosp_marlin_svelte-userdebug
24. aosp_sailfish-userdebug
25. aosp_walleye-userdebug
26. aosp_walleye_test-userdebug
27. aosp_taimen-userdebug
28. aosp_angler-userdebug
29. aosp_bullhead-userdebug
30. aosp_bullhead_svelte-userdebug
31. hikey-userdebug
32. hikey960-userdebug
33. full_k39tv1_64_bsp-eng
34. full_k39tv1_64_bsp-user
35. full_k39tv1_64_bsp-userdebug
36. full_k39tv1_bsp_1g-eng
37. full_k39tv1_bsp_1g-user
38. full_k39tv1_bsp_1g-userdebug
39. full_k39tv1_bsp_512-eng
40. full_k39tv1_bsp_512-user
41. full_k39tv1_bsp_512-userdebug
42. full_k39tv1_bsp-eng
43. full_k39tv1_bsp-user
44. full_k39tv1_bsp-userdebug
Which would you like? [aosp_arm-eng] 36
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.1.0
TARGET_PRODUCT=full_k39tv1_bsp_1g
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPM1
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a53
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=cortex-a53
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-142-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=O11019
OUT_DIR=out
AUX_OS_VARIANT_LIST=
============================================
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ make -j16
2、查找.config(内核配置文件)内核配置文件
rootroot@rootroot-desktop:~/mt6739_android8.1$ find . -name .config
./external/toybox/.config
./out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ/.config
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ cd ./out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ/
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$ ll
total 1069164
drwxrwxr-x 22 rootroot rootroot 4096 3月 21 18:59 ./
drwxrwxr-x 23 rootroot rootroot 4096 3月 21 17:14 ../
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 15:54 arch/
-rw-rw-r-- 1 rootroot rootroot 115467 3月 21 18:56 bak10.conifig
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 15:56 block/
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:55 certs/
-rw-rw-r-- 1 rootroot rootroot 115445 3月 21 18:57 .config
-rw-rw-r-- 1 rootroot rootroot 115467 3月 21 15:54 .config.old
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:56 crypto/
drwxrwxr-x 56 rootroot rootroot 4096 3月 21 18:59 drivers/
drwxrwxr-x 36 rootroot rootroot 4096 3月 21 16:04 firmware/
drwxrwxr-x 23 rootroot rootroot 4096 3月 21 15:58 fs/
drwxrwxr-x 4 rootroot rootroot 4096 3月 21 15:55 include/
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 18:59 init/
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:55 ipc/
drwxrwxr-x 14 rootroot rootroot 4096 3月 21 18:59 kernel/
drwxrwxr-x 10 rootroot rootroot 12288 3月 21 16:02 lib/
-rw-rw-r-- 1 rootroot rootroot 646 3月 21 18:59 Makefile
-rw-rw-r-- 1 rootroot rootroot 715 3月 21 18:59 .missing-syscalls.d
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:57 mm/
-rw-rw-r-- 1 rootroot rootroot 18439 3月 21 18:59 modules.builtin
-rw-rw-r-- 1 rootroot rootroot 0 3月 21 18:59 modules.order
-rw-rw-r-- 1 rootroot rootroot 473427 3月 21 18:59 Module.symvers
drwxrwxr-x 18 rootroot rootroot 4096 3月 21 16:02 net/
drwxrwxr-x 8 rootroot rootroot 4096 3月 21 15:55 scripts/
drwxrwxr-x 5 rootroot rootroot 4096 3月 21 15:56 security/
drwxrwxr-x 22 rootroot rootroot 4096 3月 21 18:59 sound/
lrwxrwxrwx 1 rootroot rootroot 43 3月 21 18:59 source -> /home/rootroot/mt6739_android8.1/kernel-4.4/
-rw-rw-r-- 1 rootroot rootroot 5203992 3月 21 18:59 System.map
-rw-rw-r-- 1 rootroot rootroot 3729684 3月 21 18:59 .tmp_kallsyms1.o
-rw-rw-r-- 1 rootroot rootroot 3729684 3月 21 18:59 .tmp_kallsyms2.o
-rw-rw-r-- 1 rootroot rootroot 5203992 3月 21 18:59 .tmp_System.map
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:55 .tmp_versions/
-rwxrwxr-x 1 rootroot rootroot 216834308 3月 21 18:59 .tmp_vmlinux1*
-rwxrwxr-x 1 rootroot rootroot 219259396 3月 21 18:59 .tmp_vmlinux2*
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 15:55 usr/
-rw-rw-r-- 1 rootroot rootroot 2 3月 21 18:59 .version
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 16:02 virt/
-rwxrwxr-x 1 rootroot rootroot 219259396 3月 21 18:59 vmlinux*
-rw-rw-r-- 1 rootroot rootroot 235 3月 21 18:59 .vmlinux.cmd
-rw-rw-r-- 1 rootroot rootroot 421234364 3月 21 18:59 vmlinux.o
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$ cp .config bak11.config
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$
3、配置gpio这个设备节点:
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$ make ARCH=arm menuconfig
GEN ./Makefile
scripts/kconfig/mconf Kconfig
warning: (MACH_MT6771 && PINCTRL_MT6739 && PINCTRL_MT6775) selects MTK_EINT_MULTI_TRIGGER_DESIGN which has unmet direct dependencies (PINCTRL && PINCTRL_MTK)
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
#### build completed successfully (01:38 (mm:ss)) ####
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g/obj/KERNEL_OBJ$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/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)
4、编译内核:
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ make bootimage
rootroot@rootroot-desktop:~/mt6739_android8.1$
rootroot@rootroot-desktop:~/mt6739_android8.1$ cd out/target/product/k39tv1_bsp_1g/
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$ ll
total 1004224
drwxrwxr-x 14 rootroot rootroot 4096 3月 21 18:59 ./
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 15:51 ../
-rw-rw-r-- 1 rootroot rootroot 20 3月 21 15:54 android-info.txt
-rw-rw-r-- 1 rootroot rootroot 543736 3月 21 15:53 appsboot.mbn
-rw-rw-r-- 1 rootroot rootroot 543696 3月 21 15:53 appsboot.raw
-rwxrw-r-- 1 rootroot rootroot 10078208 3月 21 17:12 boot10.img*
-rw-rw-r-- 1 rootroot rootroot 10078208 3月 21 18:55 boot15.img
-rw-rw-r-- 1 rootroot rootroot 10080256 3月 21 18:59 boot.img
-rw-rw-r-- 1 rootroot rootroot 76 3月 21 18:58 build_fingerprint.txt
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 16:53 cache/
-rw-r--r-- 1 rootroot rootroot 6086804 3月 21 16:53 cache.img
-rw-rw-r-- 1 rootroot rootroot 96698 3月 21 15:51 clean_steps.mk
drwxrwxr-x 7 rootroot rootroot 4096 3月 21 17:09 data/
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 16:09 dex_bootjars/
drwxrwxr-x 2 rootroot rootroot 4096 3月 21 17:12 fake_packages/
drwxrwxr-x 6 rootroot rootroot 4096 3月 21 16:14 gen/
-rw-rw-r-- 1 rootroot rootroot 279128 3月 21 17:14 installed-files.json
-rw-rw-r-- 1 rootroot rootroot 85182 3月 21 17:14 installed-files.txt
-rw-rw-r-- 1 rootroot rootroot 137466 3月 21 17:14 installed-files-vendor.json
-rw-rw-r-- 1 rootroot rootroot 43017 3月 21 17:14 installed-files-vendor.txt
-rw-rw-r-- 1 rootroot rootroot 9035186 3月 21 18:59 kernel
-rw-rw-r-- 1 rootroot rootroot 543696 3月 21 15:53 lk.img
-rw-rw-r-- 1 rootroot rootroot 45168 3月 21 15:53 loader_ext.img
-rw-rw-r-- 1 rootroot rootroot 1267376 3月 21 15:53 logo.bin
-rw-rw-r-- 1 rootroot rootroot 3440 3月 21 15:54 mcupmfw.img
-rw-rw-r-- 1 rootroot rootroot 528 3月 21 15:54 md1arm7.img
-rw-rw-r-- 1 rootroot rootroot 528 3月 21 15:54 md1dsp.img
-rw-rw-r-- 1 rootroot rootroot 528 3月 21 15:54 md1img.img
-rw-rw-r-- 1 rootroot rootroot 528 3月 21 15:54 md3img.img
-rw-rw-r-- 1 rootroot rootroot 2535989 3月 21 15:53 module-info.json
-rw-rw-r-- 1 rootroot rootroot 14988 3月 21 15:52 MT6739_Android_scatter.txt
drwxrwxr-x 23 rootroot rootroot 4096 3月 21 17:14 obj/
-rw-rw-r-- 1 rootroot rootroot 31776 3月 21 16:04 odmdtbo.img
-rw-rw-r-- 1 rootroot rootroot 624 3月 21 15:52 ota_scatter.txt
-rw-rw-r-- 1 rootroot rootroot 16896 3月 21 15:52 PGPT
-rw-rw-r-- 1 rootroot rootroot 117480 3月 21 15:53 preloader.bin
-rw-rw-r-- 1 rootroot rootroot 119528 3月 21 15:53 preloader.img
-rw-rw-r-- 1 rootroot rootroot 117480 3月 21 15:53 preloader_k39tv1_bsp_1g.bin
-rw-rw-r-- 1 rootroot rootroot 48 3月 21 15:52 previous_build_config.mk
-rw-rw-r-- 1 rootroot rootroot 1041509 3月 21 18:59 ramdisk.img
-rw-rw-r-- 1 rootroot rootroot 5419173 3月 21 17:12 ramdisk-recovery.img
drwxrwxr-x 3 rootroot rootroot 4096 3月 21 15:54 recovery/
-rw-rw-r-- 1 rootroot rootroot 67 3月 21 17:12 recovery.id
-rw-rw-r-- 1 rootroot rootroot 14456832 3月 21 17:12 recovery.img
drwxrwxr-x 17 rootroot rootroot 4096 3月 21 17:12 root/
-rw-rw-r-- 1 rootroot rootroot 135168 3月 21 15:52 secro.img
-rw-rw-r-- 1 rootroot rootroot 24752 3月 21 15:54 spmfw.img
drwxrwxr-x 8 rootroot rootroot 4096 3月 21 17:08 symbols/
drwxrwxr-x 15 rootroot rootroot 4096 3月 21 17:14 system/
-rw-r--r-- 1 rootroot rootroot 733369444 3月 21 17:14 system.img
-rw-rw-r-- 1 rootroot rootroot 108032 3月 21 16:00 tee.img
drwxrwxr-x 4 rootroot rootroot 4096 3月 21 16:00 trustzone/
-rw-r--r-- 1 rootroot rootroot 57624 3月 21 17:13 userdata.img
drwxrwxr-x 16 rootroot rootroot 4096 3月 21 16:54 vendor/
-rw-r--r-- 1 rootroot rootroot 221644092 3月 21 17:14 vendor.img
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$ diff boot.img boot10.img
Binary files boot.img and boot10.img differ
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
rootroot@rootroot-desktop:~/mt6739_android8.1/out/target/product/k39tv1_bsp_1g$
5、刷机之后可以看到在这里配置GPIO端口无效!:
k39tv1_bsp_1g:/ #
k39tv1_bsp_1g:/ #
k39tv1_bsp_1g:/ #
k39tv1_bsp_1g:/ #
k39tv1_bsp_1g:/ # ls -l
total 1208
dr-xr-xr-x 3 root root 0 2022-03-22 10:13 acct
lrwxrwxrwx 1 root root 50 1970-01-01 08:00 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
drwxrwx--- 6 system cache 4096 2022-03-22 10:14 cache
lrwxrwxrwx 1 root root 13 1970-01-01 08:00 charger -> /sbin/charger
drwxr-xr-x 4 root root 0 1970-01-01 08:00 config
drwxr-xr-x 2 root root 0 2022-03-22 10:14 custom
lrwxrwxrwx 1 root root 17 1970-01-01 08:00 d -> /sys/kernel/debug
drwxrwx--x 55 system system 4096 2022-03-22 10:14 data
lrwxrwxrwx 1 root root 23 1970-01-01 08:00 default.prop -> system/etc/prop.default
drwxr-xr-x 18 root root 3660 2022-03-22 10:14 dev
lrwxrwxrwx 1 root root 11 1970-01-01 08:00 etc -> /system/etc
-rw-r----- 1 root root 61 1970-01-01 08:00 fstab.enableswap
-rwxr-x--- 1 root root 1140080 1970-01-01 08:00 init
-rwxr-x--- 1 root root 1344 1970-01-01 08:00 init.environ.rc
-rwxr-x--- 1 root root 62 1970-01-01 08:00 init.preload.rc
-rwxr-x--- 1 root root 28403 1970-01-01 08:00 init.rc
-rwxr-x--- 1 root root 7874 1970-01-01 08:00 init.usb.configfs.rc
-rwxr-x--- 1 root root 5721 1970-01-01 08:00 init.usb.rc
-rwxr-x--- 1 root root 497 1970-01-01 08:00 init.zygote32.rc
drwxr-xr-x 3 root root 0 1970-01-01 08:00 lib
drwxr-xr-x 11 root system 240 2022-03-22 10:14 mnt
drwxr-xr-x 2 root root 0 1970-01-01 08:00 oem
dr-xr-xr-x 347 root root 0 1970-01-01 08:00 proc
drwx------ 2 root root 0 2022-03-10 11:07 root
drwxr-x--- 2 root root 0 1970-01-01 08:00 sbin
lrwxrwxrwx 1 root root 21 1970-01-01 08:00 sdcard -> /storage/self/primary
drwxr-xr-x 3 root root 80 2022-03-22 10:14 storage
dr-xr-xr-x 15 root root 0 2022-03-22 10:13 sys
drwxr-xr-x 16 root root 4096 1970-01-01 08:00 system
-rw-r--r-- 1 root root 5222 1970-01-01 08:00 ueventd.rc
drwxr-xr-x 17 root root 4096 1970-01-01 08:00 vendor
k39tv1_bsp_1g:/ #
k39tv1_bsp_1g:/ # cd /sys/
k39tv1_bsp_1g:/sys #
k39tv1_bsp_1g:/sys # ls -l
total 0
drwxr-xr-x 2 root root 0 2022-03-22 10:13 block
drwxr-xr-x 2 root root 0 2022-03-22 10:13 bootinfo
drwxr-xr-x 20 root root 0 2022-03-22 10:13 bus
drwxr-xr-x 73 root root 0 2022-03-22 10:13 class
drwxr-xr-x 4 root root 0 2022-03-22 10:13 dev
drwxr-xr-x 9 root root 0 2022-03-22 10:13 devices
drwxr-xr-x 3 root root 0 2022-03-22 10:13 firmware
drwxr-xr-x 8 root root 0 2022-03-22 10:13 fs
drwxr-xr-x 10 root root 0 2022-03-22 10:13 kernel
drwxr-xr-x 128 root root 0 2022-03-22 10:13 module
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtk_rgu
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtuart
drwxr-xr-x 5 root root 0 2022-03-22 10:13 power
k39tv1_bsp_1g:/sys #
k39tv1_bsp_1g:/sys # cd class/
k39tv1_bsp_1g:/sys/class #
k39tv1_bsp_1g:/sys/class # ls -l
total 0
drwxr-xr-x 2 root root 0 2022-03-22 10:13 BOOT
drwxr-xr-x 2 root root 0 2022-03-22 10:13 CAM_CALdrv1
drwxr-xr-x 2 root root 0 2022-03-22 10:13 MTK_SMI
drwxr-xr-x 2 root root 0 2022-03-22 10:13 MT_pmic_adc_cali
drwxr-xr-x 2 root root 0 2022-03-22 10:13 Vcodec
drwxr-xr-x 2 root root 0 2022-03-22 10:13 accdet
drwxr-xr-x 2 root root 0 2022-03-22 10:13 actuatordrv_main_af
drwxr-xr-x 2 root root 0 2022-03-22 10:13 android_usb
drwxr-xr-x 2 root root 0 2022-03-22 10:13 bdi
drwxr-xr-x 2 root root 0 2022-03-22 10:13 block
drwxr-xr-x 2 root root 0 2022-03-22 10:13 btif
drwxr-xr-x 2 root root 0 2022-03-22 10:13 ccci_md_sta
drwxr-xr-x 2 root root 0 2022-03-22 10:13 ccci_node
drwxr-xr-x 2 root root 0 2022-03-22 10:13 charger_ftm
drwxr-xr-x 2 root root 0 2022-03-22 10:13 devmap
drwxr-xr-x 2 root root 0 2022-03-22 10:13 drm
drwxr-xr-x 2 root root 0 2022-03-22 10:13 firmware
drwxr-xr-x 2 root root 0 2022-03-22 10:13 flashlight_core
drwxr-xr-x 2 root root 0 2022-03-22 10:14 fm
drwxr-xr-x 2 root root 0 2022-03-22 10:13 gauge
drwxr-xr-x 2 root root 0 2022-03-22 10:13 gpio
drwxr-xr-x 2 root root 0 2022-03-22 10:13 graphics
drwxr-xr-x 2 root root 0 2022-03-22 10:14 hidg
drwxr-xr-x 2 root root 0 2022-03-22 10:13 hidraw
drwxr-xr-x 2 root root 0 2022-03-22 10:13 i2c-adapter
drwxr-xr-x 2 root root 0 2022-03-22 10:13 ieee80211
drwxr-xr-x 2 root root 0 2022-03-22 10:13 input
drwxr-xr-x 2 root root 0 2022-03-22 10:13 ispdrv
drwxr-xr-x 2 root root 0 2022-03-22 10:13 leds
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mem
drwxr-xr-x 2 root root 0 2022-03-22 10:13 misc
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mmc_host
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtk-adc-cali
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtk_cmdq
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtk_dfrc
drwxr-xr-x 2 root root 0 2022-03-22 10:13 mtk_disp_mgr
drwxr-xr-x 2 root root 0 2022-03-22 10:13 net
drwxr-xr-x 2 root root 0 2022-03-22 10:13 pmic_ftm
drwxr-xr-x 2 root root 0 2022-03-22 10:13 pmsg
drwxr-xr-x 2 root root 0 2022-03-22 10:13 power_supply
drwxr-xr-x 2 root root 0 2022-03-22 10:13 ppp
drwxr-xr-x 2 root root 0 2022-03-22 10:13 regulator
drwxr-xr-x 2 root root 0 2022-03-22 10:13 rpmb
drwxr-xr-x 2 root root 0 2022-03-22 10:13 rpmb_dummy
drwxr-xr-x 2 root root 0 2022-03-22 10:13 rtc
drwxr-xr-x 2 root root 0 2022-03-22 10:13 scheddrv
drwxr-xr-x 2 root root 0 2022-03-22 10:13 scsi_device
drwxr-xr-x 2 root root 0 2022-03-22 10:13 scsi_disk
drwxr-xr-x 2 root root 0 2022-03-22 10:13 scsi_host
drwxr-xr-x 2 root root 0 2022-03-22 10:13 sec
drwxr-xr-x 2 root root 0 2022-03-22 10:13 sensor
drwxr-xr-x 2 root root 0 2022-03-22 10:13 sensordrv
drwxr-xr-x 2 root root 0 2022-03-22 10:13 sound
drwxr-xr-x 2 root root 0 2022-03-22 10:13 spi_master
drwxr-xr-x 2 root root 0 2022-03-22 10:14 stpbt
drwxr-xr-x 2 root root 0 2022-03-22 10:14 stpgps
drwxr-xr-x 2 root root 0 2022-03-22 10:14 stpwmt
drwxr-xr-x 2 root root 0 2022-03-22 10:13 switch
drwxr-xr-x 2 root root 0 2022-03-22 10:13 switching_charger
drwxr-xr-x 2 root root 0 2022-03-22 10:13 thermal
drwxr-xr-x 2 root root 0 2022-03-22 10:13 timed_output
drwxr-xr-x 2 root root 0 2022-03-22 10:13 tty
drwxr-xr-x 2 root root 0 2022-03-22 10:13 udc
drwxr-xr-x 2 root root 0 2022-03-22 10:13 usb_boost
drwxr-xr-x 2 root root 0 2022-03-22 10:13 usb_rawbulk
drwxr-xr-x 2 root root 0 2022-03-22 10:13 vc
drwxr-xr-x 2 root root 0 2022-03-22 10:13 vtconsole
drwxr-xr-x 2 root root 0 2022-03-22 10:14 wmtWifi
drwxr-xr-x 2 root root 0 2022-03-22 10:14 wmtdetect
drwxr-xr-x 2 root root 0 2022-03-22 10:13 xt_idletimer
drwxr-xr-x 2 root root 0 2022-03-22 10:13 zram-control
k39tv1_bsp_1g:/sys/class #
k39tv1_bsp_1g:/sys/class #
k39tv1_bsp_1g:/sys/class # cd gpio/
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio # ls -l
total 0
--w------- 1 root root 4096 2022-03-22 10:16 export
lrwxrwxrwx 1 root root 0 2022-03-22 10:16 gpiochip343 -> ../../devices/platform/1000b000.pinctrl/gpio/gpiochip343
--w------- 1 root root 4096 2022-03-22 10:16 unexport
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio # echo 12 > export
1|k39tv1_bsp_1g:/sys/class/gpio #
1|k39tv1_bsp_1g:/sys/class/gpio # ls -l
total 0
--w------- 1 root root 4096 2022-03-22 10:18 export
lrwxrwxrwx 1 root root 0 2022-03-22 10:16 gpiochip343 -> ../../devices/platform/1000b000.pinctrl/gpio/gpiochip343
--w------- 1 root root 4096 2022-03-22 10:16 unexport
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/sys/class/gpio #
k39tv1_bsp_1g:/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