Luckfox Pico Pro Max如何使用sd卡镜像使用umtprd?
Posted: 2025-12-30 3:20
请问一些Luckfox Pico Pro Max使用sd卡启动,如何移植umptrd,
#!/bin/sh
set -e
LOG=/tmp/usb_mtp_adb.log
exec > >(tee -a $LOG) 2>&1
echo "=== USB MTP + ADB FunctionFS Gadget ==="
# Configfs base
CFGFS=/sys/kernel/config
GADGET=g1
USB_VID=0x2207
USB_PID=0x0011
# Paths
G=${CFGFS}/usb_gadget/${GADGET}
ADB_FFS=/dev/usb-ffs/adb
MTP_FFS=/dev/usb-ffs/mtp
UMTPD=/mnt/umtprd
# Clean existing
echo "Cleaning previous gadget (if exists)"
if [ -d $G ]; then
echo none > $G/UDC || true
sleep 1
rm -rf $G
fi
# Mount configfs
mount | grep -q configfs || {
echo "Mounting configfs..."
mount -t configfs none $CFGFS
}
# Create gadget
echo "Creating gadget"
mkdir -p $G
echo $USB_VID > $G/idVendor
echo $USB_PID > $G/idProduct
echo 0x0200 > $G/bcdUSB
echo 0x0100 > $G/bcdDevice
# Strings
mkdir -p $G/strings/0x409
echo "1234567890ABCDEF" > $G/strings/0x409/serialnumber
echo "rockchip" > $G/strings/0x409/manufacturer
echo "MTP+ADB Gadget" > $G/strings/0x409/product
# Create config
mkdir -p $G/configs/c.1
mkdir -p $G/configs/c.1/strings/0x409
echo "MTP+ADB config" > $G/configs/c.1/strings/0x409/configuration
echo 250 > $G/configs/c.1/MaxPower
# Create FunctionFS functions
echo "Setting up FunctionFS functions"
mkdir -p $G/functions/ffs.adb
mkdir -p $G/functions/ffs.mtp
# Link
ln -s $G/functions/ffs.adb $G/configs/c.1/
ln -s $G/functions/ffs.mtp $G/configs/c.1/
# Ensure ffs dirs exist
mkdir -p /dev/usb-ffs
mkdir -p $ADB_FFS
mkdir -p $MTP_FFS
# Mount FunctionFS
echo "Mounting FunctionFS for adb and mtp"
mount -t functionfs adb $ADB_FFS || true
mount -t functionfs mtp $MTP_FFS || true
# Start daemons
echo "Starting adbd..."
if ! command -v adbd >/dev/null; then
echo "WARNING: adbd not found!"
else
adbd &
fi
echo "Starting uMTP-Responder..."
if [ ! -x "$UMTPD" ]; then
echo "ERROR: uMTP-Responder binary not found at $UMTPD"
exit 1
fi
$UMTPD &
sleep 1
# Bind UDC
UDC=$(ls /sys/class/udc | head -n1)
echo "Binding UDC: $UDC"
echo $UDC > $G/UDC
echo "=== USB MTP+ADB ready ==="
以上是我的脚本配置,开启了adb,但是电脑不显示mtp设备。
#!/bin/sh
set -e
LOG=/tmp/usb_mtp_adb.log
exec > >(tee -a $LOG) 2>&1
echo "=== USB MTP + ADB FunctionFS Gadget ==="
# Configfs base
CFGFS=/sys/kernel/config
GADGET=g1
USB_VID=0x2207
USB_PID=0x0011
# Paths
G=${CFGFS}/usb_gadget/${GADGET}
ADB_FFS=/dev/usb-ffs/adb
MTP_FFS=/dev/usb-ffs/mtp
UMTPD=/mnt/umtprd
# Clean existing
echo "Cleaning previous gadget (if exists)"
if [ -d $G ]; then
echo none > $G/UDC || true
sleep 1
rm -rf $G
fi
# Mount configfs
mount | grep -q configfs || {
echo "Mounting configfs..."
mount -t configfs none $CFGFS
}
# Create gadget
echo "Creating gadget"
mkdir -p $G
echo $USB_VID > $G/idVendor
echo $USB_PID > $G/idProduct
echo 0x0200 > $G/bcdUSB
echo 0x0100 > $G/bcdDevice
# Strings
mkdir -p $G/strings/0x409
echo "1234567890ABCDEF" > $G/strings/0x409/serialnumber
echo "rockchip" > $G/strings/0x409/manufacturer
echo "MTP+ADB Gadget" > $G/strings/0x409/product
# Create config
mkdir -p $G/configs/c.1
mkdir -p $G/configs/c.1/strings/0x409
echo "MTP+ADB config" > $G/configs/c.1/strings/0x409/configuration
echo 250 > $G/configs/c.1/MaxPower
# Create FunctionFS functions
echo "Setting up FunctionFS functions"
mkdir -p $G/functions/ffs.adb
mkdir -p $G/functions/ffs.mtp
# Link
ln -s $G/functions/ffs.adb $G/configs/c.1/
ln -s $G/functions/ffs.mtp $G/configs/c.1/
# Ensure ffs dirs exist
mkdir -p /dev/usb-ffs
mkdir -p $ADB_FFS
mkdir -p $MTP_FFS
# Mount FunctionFS
echo "Mounting FunctionFS for adb and mtp"
mount -t functionfs adb $ADB_FFS || true
mount -t functionfs mtp $MTP_FFS || true
# Start daemons
echo "Starting adbd..."
if ! command -v adbd >/dev/null; then
echo "WARNING: adbd not found!"
else
adbd &
fi
echo "Starting uMTP-Responder..."
if [ ! -x "$UMTPD" ]; then
echo "ERROR: uMTP-Responder binary not found at $UMTPD"
exit 1
fi
$UMTPD &
sleep 1
# Bind UDC
UDC=$(ls /sys/class/udc | head -n1)
echo "Binding UDC: $UDC"
echo $UDC > $G/UDC
echo "=== USB MTP+ADB ready ==="
以上是我的脚本配置,开启了adb,但是电脑不显示mtp设备。