首先需要修改设备树,当前TypeC默认作为device使用,需要改成Host
/mnt/e/epan-ubuntu/rv1106/luckfox-pico/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pro-max.dts
/**********USB**********/
&usbdrd_dwc3 {
status = "okay";
dr_mode = "peripheral";
};
peripheral改成host
/**********USB**********/
&usbdrd_dwc3 {
status = "okay";
dr_mode = "host";
};
修改config文件
cd /mnt/e/epan-ubuntu/rv1106/luckfox-pico/sysdrv/source/kernel
cp ./arch/arm/configs/luckfox_rv1106_linux_defconfig .config
make ARCH=arm menuconfig
也可以在config文件中直接增加如下配置,都=y即可
CONFIG_SCSI=y
CONFIG_SCSI_UFSHCD=y
CONFIG_BLK_DEV_SD=y
CONFIG_USB_STORAGE=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_EHCI_HCD=y
CONFIG_MEDIA_USB_SUPPORT=y
CONFIG_USB_VIDEO_CLASS=y
保存配置,否则使用build.sh又会变成默认的配置
make ARCH=arm savedefconfig
cp defconfig arch/arm/configs/luckfox_rv1106_linux_defconfig
cd /mnt/e/epan-ubuntu/rv1106/luckfox-pico
./build.sh kernel
开始编译,编译过程比较慢
替换掉buildroot的镜像包中的boot.img,如下图,进行烧录
cat /sys/devices/platform/ff3e0000.usb2-phy/otg_mode
host
插入U盘,使用dmesg,可以看到如下输出,表示识别到USB存储设备
视频讲解