全志 H6 Orange Pi Lite 2 Android 7.0 USB配置

问题原因

我们之前编译出来的默认SDK镜像版上的USB2.0是无法使用的,现在我们需要解决这个问题。
这里写图片描述

查看原理图,确认管脚

首先查看原理图,USB2.0接口,在原理图上是P4连接器,对应的DP和DM是USB3模块的。
这里写图片描述

sys_config.fex配置

全志的平台开发分无sys_config.fex和有sys_config.fex文件的情况:无sys_config.fex就像传统的dts文件那样进行配置。有sys_config.fex配置文件,方便用户进行快速配置,优先级最高。所以一般配置sys_config.fex即可。我们可以再lichee目录用find命令进行查找,找到H6板子所对应的文件进行修改tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee$ find . -name "sys_config.fex"
./tools/pack/chips/sun8iw12p1/configs/fpga/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/dv100_nor/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5s_perf1_v1_0/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/dvb/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5s_perf2_v1_0/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5_qaqc_v1.0/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/ver1/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5s_pro_lpddr3/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/dv100/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5_perf1_v1_0/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/v5_bc_pwr07_nor/sys_config.fex
./tools/pack/chips/sun8iw12p1/configs/ver1_nor/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-cmcc-wasu/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-cmcc-wasu-p1/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-p2/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-p1/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-p1-secure/sys_config.fex
./tools/pack/chips/sun9iw1p1/configs/jaws-optimus/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/eagle-p1-secure/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/aston-p1/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/eagle-p2/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/aston-perf/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/eagle-tvd-perf3/sys_config.fex
./tools/pack/chips/sun8iw6p1/configs/eagle-p1/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/v3-perf/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/CDR/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/tiger-standard/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/ipc/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/crane-standard/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/v3s-perf/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/sdv/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/crane-ipc/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/tiger-ipc/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/tiger-cdr/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/crane-sdv/sys_config.fex
./tools/pack/chips/sun8iw8p1/configs/crane-cdr/sys_config.fex
./tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex
./tools/pack/chips/sun50iw6p1/configs/perf1_v1_0/sys_config.fex
./tools/pack/chips/sun50iw6p1/configs/petrel-iptv-p1/sys_config.fex
./tools/pack/chips/sun50iw6p1/configs/petrel-cmcc-p1/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-perf4/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-p1/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-perf/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-ipc-p1-nor/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-a20e/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-ipc-p1/sys_config.fex
./tools/pack/chips/sun8iw11p1/configs/magton-ipc-p1-linux44-norflash/sys_config.fex
./tools/pack/chips/sun50iw1p1/configs/perf1_v1_0/sys_config.fex
./tools/pack/chips/sun50iw1p1/configs/rabbit-p1/sys_config.fex
./tools/pack/chips/sun50iw1p1/configs/rabbit-cmccwasu-p1/sys_config.fex
./tools/pack/chips/sun50iw2p1/configs/cheetah-p1/sys_config.fex
./tools/pack/chips/sun50iw2p1/configs/cheetah-perf/sys_config.fex
./tools/pack/chips/sun50iw2p1/configs/cheetah-iptv-p1/sys_config.fex
./tools/pack/chips/sun50iw2p1/configs/cheetah-cmcc-p1/sys_config.fex
./tools/pack/chips/sun8iw7p1/configs/dolphin-p1/sys_config.fex
./tools/pack/chips/sun8iw7p1/configs/dolphin-cmcc-wasu-p1/sys_config.fex
./tools/pack/chips/sun8iw7p1/configs/dolphin-karaok/sys_config.fex
./tools/pack/chips/sun8iw7p1/configs/dolphin-p1-secure/sys_config.fex
./tools/pack/chips/sun8iw7p1/configs/dolphin-perf/sys_config.fex
./tools/pack/out/sys_config.fex

找到USB3 CONFIG配置项。

;--------------------------------
;--- USB3 CONFIG
;--------------------------------
[usbc3]
usbc3_used = 0
usb_drv_vbus_gpio =
usb_host_init_state = 1
usb_regulator_io = "nocare"
usb_wakeup_suspend = 0

下面解析每项含义
usbc3_used = 0 ——– usb控制器使能标志,1表示可用,0表示禁用
usb_drv_vbus_gpio = ——– USB DRV VBUS引脚配置
usb_host_init_state = 1 ——– 处于Host端口初始化状态,0-不工作,1-工作
usb_regulator_io = “nocare” ——– usb供电的regulator GPIO
usb_wakeup_suspend = 0 ——– 支持USB唤醒功能:0-关闭usb唤醒功能,1-当进入normal standby时候,支持usb唤醒,比如鼠标

从代码中看到,USB3默认被关闭了,所以无法使用,只要把它打开即可。相关修改如下。

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee$ git diff tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex
diff --git a/lichee/tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex b/lichee/tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex
index 3ed065c..0e43e22 100755
--- a/lichee/tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex
+++ b/lichee/tools/pack/chips/sun50iw6p1/configs/petrel-p1/sys_config.fex
@@ -1139,7 +1139,7 @@ usb_wakeup_suspend = 0
 ;--- USB3 CONFIG
 ;--------------------------------
 [usbc3]
-usbc3_used = 0
+usbc3_used = 1
 usb_drv_vbus_gpio =
 usb_host_init_state = 1
 usb_regulator_io = "nocare"

修改完代码,需重新编译Kernel

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee$ ./build.sh config

Welcome to mkscript setup progress
All available chips:
   0. sun50iw1p1
   1. sun50iw2p1
   2. sun50iw6p1
   3. sun8iw11p1
   4. sun8iw12p1
   5. sun8iw6p1
   6. sun8iw7p1
   7. sun8iw8p1
   8. sun9iw1p1
Choice: 2
All available platforms:
   0. android
   1. dragonboard
   2. linux
   3. eyeseelinux
Choice: 0
All available business:
   0. 5.1
   1. 4.4
   2. 7.x
Choice: 2
LICHEE_BUSINESS=7.x
using kernel 'linux-3.10':
select arch by kernel version and chip
==================================
INFO: ----------------------------------------
INFO: build lichee ...
INFO: chip: sun50iw6p1
INFO: platform: android
INFO: business: 7.x
INFO: kernel: linux-3.10
INFO: arch: arm64
INFO: board: 
INFO: output: out/sun50iw6p1/android/
INFO: ----------------------------------------
INFO: build buildroot ...
external toolchain has been installed
external toolchain_32 has been installed
INFO: build buildroot OK.

regenerate rootfs cpio
15757 blocks
17099 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...

sun50iw6p1 compile Kernel successful


INFO: build kernel OK.
INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: build rootfs OK.
----------------------------------------
build sun50iw6p1 android 7.x lichee OK
----------------------------------------

编译完Kernel,还需对镜像进行打包,这样才可以烧写到SD卡中。

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee$ cd ..
lemon@ubuntu:~/Develop/OrangePi_Lite2$ cd android/
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ export LC_ALL=C
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ source ./build/envsetup.sh 
including device/asus/fugu/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-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/softwinner/cheetah-cmcc-p1/vendorsetup.sh
including device/softwinner/cheetah-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/softwinner/petrel-cmcc-p1/vendorsetup.sh
including device/softwinner/petrel-p1/vendorsetup.sh
including sdk/bash_completion/adb.bash
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ lunch petrel_fvd_p1-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.0
TARGET_PRODUCT=petrel_fvd_p1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-33-generic-x86_64-with-Ubuntu-18.04-bionic
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NRD91N
OUT_DIR=out
============================================
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ extract-bsp
/home/lemon/Develop/OrangePi_Lite2/android/device/*/petrel-p1/bImage copied!
/home/lemon/Develop/OrangePi_Lite2/android/device/*/petrel-p1/modules copied!
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ pack
copying tools file
copying configs file
./out/aultls32.fex
./out/aultools.fex
./out/boot_package.cfg
./out/boot_package.fex
./out/cardscript.fex
./out/cardscript_secure.fex
./out/cardtool.fex
./out/diskfs.fex
./out/env.cfg
./out/env_burn.cfg
./out/env_dragon.cfg
./out/esm.fex
./out/image.cfg
./out/parameter.fex
./out/split_xxxx.fex
./out/sunxi.fex
./out/sys_config.fex
./out/sys_partition.fex
./out/sys_partition_dragonboard.fex
./out/sys_partition_dump.fex
./out/sys_partition_linux.fex
./out/sys_partition_private.fex
./out/sysrecovery.fex
./out/test_config.fex
./out/toc0.fex
./out/toc1.fex
./out/usbtool.fex
./out/usbtool_test.fex
./out/verity_block.fex
copying boot resource
cp: cannot stat 'out/boot-resource/bootlogo.jpg': No such file or directory
lzma: out/bootlogo.jpg: No such file or directory
lzma: out/bempty.bmp: No such file or directory
lzma: out/battery_charge.bmp: No such file or directory
copying boot file
Conver script to dts ok.
update scp
pack boot package
GetPrivateProfileSection read to end
content_count=10
no used multi config
packing for android
normal
mbr count = 4

partitation file Path=/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/out/sys_partition.bin
mbr_name file Path=/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/out/sunxi_mbr.fex
download_name file Path=/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/out/dlinfo.fex

mbr size = 16384
mbr magic softw411
disk name=bootloader
filename = bootloader.fex 
dl_file_size = 16058 sector
part_size = 32768 sector
disk name=env
filename = env.fex 
dl_file_size = 256 sector
part_size = 32768 sector
disk name=boot
filename = boot.fex 
dl_file_size = 33644 sector
part_size = 65536 sector
disk name=system
filename = system.fex 
dl_file_size = 1232405 sector
part_size = 3145728 sector
disk name=verity_block
filename = verity_block.fex 
dl_file_size = 2082 sector
part_size = 32768 sector
disk name=misc
disk name=recovery
filename = recovery.fex 
dl_file_size = 38504 sector
part_size = 65536 sector
disk name=sysrecovery
filename = sysrecovery.fex 
dl_file_size = 0 sector
part_size = 3145728 sector
disk name=private
disk name=alog
disk name=Reserve0
disk name=Reserve1
disk name=Reserve2
disk name=cache
disk name=UDISK
this is not a partition key
update_for_part_info 0
crc 0 = c8b8d2aa
crc 1 = 5d0583f7
crc 2 = 38b37651
crc 3 = ad0e270c
update mbr file ok
/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/pctools/linux/eDragonEx/
/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/out
Begin Parse sys_partion.fex
Add partion bootloader.fex BOOTLOADER_FEX00
Add partion very bootloader.fex BOOTLOADER_FEX00
FilePath: bootloader.fex
FileLength=7d7400Add partion env.fex ENV_FEX000000000
Add partion very env.fex ENV_FEX000000000
FilePath: env.fex
FileLength=20000Add partion boot.fex BOOT_FEX00000000
Add partion very boot.fex BOOT_FEX00000000
FilePath: boot.fex
FileLength=106d800Add partion system.fex SYSTEM_FEX000000
Add partion very system.fex SYSTEM_FEX000000
FilePath: system.fex
FileLength=259c2a74Add partion verity_block.fex VERITY_BLOCK_FEX
Add partion very verity_block.fex VERITY_BLOCK_FEX
FilePath: verity_block.fex
FileLength=1045b4Add partion recovery.fex RECOVERY_FEX0000
Add partion very recovery.fex RECOVERY_FEX0000
FilePath: recovery.fex
FileLength=12cd000Add partion sysrecovery.fex SYSRECOVERY_FEX0
Add partion diskfs.fex DISKFS_FEX000000
sys_config.fex Len: 0x10232
board.fex Len: 0x400
config.fex Len: 0xcc00
split_xxxx.fex Len: 0x200
sys_partition.fex Len: 0x124b
sunxi.fex Len: 0x18800
boot0_nand.fex Len: 0xc000
boot0_sdcard.fex Len: 0x8000
u-boot.fex Len: 0x138000
toc1.fex Len: 0x8
toc0.fex Len: 0x8
fes1.fex Len: 0x4340
boot_package.fex Len: 0x1ac000
usbtool.fex Len: 0x23600
aultools.fex Len: 0x2847b
aultls32.fex Len: 0x24d23
cardtool.fex Len: 0x11e00
cardscript.fex Len: 0x779
sunxi_mbr.fex Len: 0x10000
dlinfo.fex Len: 0x4000
arisc.fex Len: 0x6
bootloader.fex Len: 0x7d7400
Vbootloader.fex Len: 0x4
env.fex Len: 0x20000
Venv.fex Len: 0x4
boot.fex Len: 0x106d800
Vboot.fex Len: 0x4
system.fex Len: 0x259c2a74
Vsystem.fex Len: 0x4
verity_block.fex Len: 0x1045b4
Vverity_block.fex Len: 0x4
recovery.fex Len: 0x12cd000
Vrecovery.fex Len: 0x4
sysrecovery.fex Len: 0xb
diskfs.fex Len: 0x200
BuildImg 0
Dragon execute image.cfg SUCCESS !
----------image is at----------

/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/sun50iw6p1_android_petrel-p1_uart0.img

pack finish

烧写测试USB 2.0能正常使用。

猜你喜欢

转载自blog.csdn.net/sweetmilkcake/article/details/82719723