1.make linux-menuconfig使能pty字符型设备,使能RNDIS设备
Location:
-> Device Drivers
-> Character devices
[ ] Unix98 PTY support 取消掉这个
[*] Legacy (BSD) PTY support 使用这个
(5) Maximum number of legacy PTY in use
->Device Drivers
-> USB support
-> USB Gadget Support
<M> USB Gadget functions configurable through configfs
[*] Network Control Model (CDC NCM)
[*] Ethernet Control Model (CDC ECM)
[*] Ethernet Control Model (CDC ECM) subset
[*] RNDIS
[*] Ethernet Emulation Model (EEM)
<M> USB Gadget precomposed configurations
<M> Ethernet Gadget (with CDC Ethernet support)
[*] RNDIS support
<M> CDC Composite Device (Ethernet and ACM)
<M> CDC Composite Device (ACM and mass storage
2.修改pacakge\dropbear\dropbear.mk,屏蔽掉如下内容,否则无法创建dropbear文件夹
#ln -snf /var/run/dropbear $(TARGET_DIR)/etc/dropbear
3.替换S50dropbear
#!/bin/sh
#
# Starts dropbear sshd.
#
# Allow a few customizations from a config file
test -r /etc/default/dropbear && . /etc/default/dropbear
start() {
DROPBEAR_ARGS="$DROPBEAR_ARGS -r /etc/dropbear/dropbear_rsa_host_key"
# If /etc/dropbear is a symlink to /var/run/dropbear, and
# - the filesystem is RO (i.e. we can not rm the symlink),
# create the directory pointed to by the symlink.
# - the filesystem is RW (i.e. we can rm the symlink),
# replace the symlink with an actual directory
if [ -L /etc/dropbear \
-a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
then
if rm -f /etc/dropbear >/dev/null 2>&1; then
mkdir -p /etc/dropbear
else
echo "No persistent location to store SSH host keys. New keys will be"
echo "generated at each boot. Are you sure this is what you want to do?"
mkdir -p "$(readlink /etc/dropbear)"
fi
else
if [ ! -d /etc/dropbear ]; then
mkdir -p /etc/dropbear
fi
if [ ! -e /etc/dropbear/dropbear_rsa_host_key ]; then
/usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
fi
fi
printf "Starting dropbear sshd: "
umask 077
start-stop-daemon -S -q -p /var/run/dropbear.pid \
--exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
printf "Stopping dropbear sshd: "
start-stop-daemon -K -q -p /var/run/dropbear.pid
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
4.make menuconfig 使能dropbear
location
->Target packages
-> networking applications
[*] dropbear
6.usb网卡启动脚本S40network 拷贝到./widora/mangopi/r3/rootfs/etc/init.d/S40network
#!/bin/sh
#
# Start the network....
#
# Debian ifupdown needs the /run/network lock directory
mkdir -p /run/network
installRNDIS()
{
modprobe g_ether
if [ $? -eq 0 ]
then
/sbin/ifconfig usb0 up
/sbin/ifconfig usb0 '192.168.5.100'
[ $? = 0 ] && echo 'Starting network: OK' || echo "Starting network:FAIL"
else
echo 'failed to install RNDIS(ethernet over usb)'
fi
}
case "$1" in
start)
installRNDIS
# printf "Starting network: "
# /sbin/ifup -a
# [ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)
printf "Stopping network: "
/sbin/ifdown -a
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
7.编译
编译完成后output/target下会多出很多ko文件,find -name *.ko来查看
./lib/modules/5.4.66/kernel/drivers/input/touchscreen/goodix.ko
./lib/modules/5.4.66/kernel/drivers/input/touchscreen/tsc2007.ko
./lib/modules/5.4.66/kernel/drivers/media/i2c/ov5640.ko
./lib/modules/5.4.66/kernel/drivers/media/i2c/ov2640.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_eem.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/u_serial.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_obex.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_ecm_subset.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_rndis.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/u_ether.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_acm.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_ss_lb.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_serial.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_ecm.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_fs.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_ncm.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/function/usb_f_mass_storage.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/g_cdc.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/g_acm_ms.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/g_serial.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/gadgetfs.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/g_mass_storage.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/legacy/g_ether.ko
./lib/modules/5.4.66/kernel/drivers/usb/gadget/libcomposite.ko
8.驱动安装,压缩包里面有readme文件 https://download.csdn.net/download/Seeker_ZeroOne/13087112
9.驱动安装完成后,需要在控制面板\网络和 Internet\网络连接 中修改RNDIS网卡的IP为 :192.168.5.xxx
最近编辑记录 muxi01 (2020-12-09 18:08:00)
离线