Chinaunix首页 | 论坛 | 博客
  • 博客访问: 553225
  • 博文数量: 185
  • 博客积分: 4031
  • 博客等级: 上校
  • 技术积分: 1591
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-27 19:45
文章分类

全部博文(185)

文章存档

2011年(14)

2010年(63)

2009年(108)

我的朋友

分类:

2009-06-25 15:37:10

使用adb shell作为登录手机的shell,这样就可以不再单独接串口线


《让blob成功执行tftp下载zImage》
不使用串口作为console登录手机,使用adb shell作为登录手机的console,
我们连接手机的usb线,上电默认为usb net功能,其ip地址为192.168.100.2,
1.添加自动枚举usbnet在pc端对应的ip地址
add IP addr auto-config in /etc/network/interfaces:
●luther@gliethttp:~$ sudo vim /etc/network/interfaces 添加如下内容
 auto usb0
 iface usb0 inet static
        address 192.168.100.1
        netmask 255.255.255.0
        network 192.168.0.0
        up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
        up echo 1 > /proc/sys/net/ipv4/ip_forward &
        up iptables -P FORWARD ACCEPT &
        down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
●luther@gliethttp:~$ sudo vim /etc/hosts 添加如下内容
192.168.100.2 phone
●luther@gliethttp:~$ sudo vim /etc/udev/rules.d/85-ifupdown.rules 将最后几行改成这样修正ubuntu8.04的bug
 # Bring devices up and down only if they're marked auto.
 # Use start-stop-daemon so we don't wait on dhcp
 ACTION=="add",          RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup -- --allow auto $env{INTERFACE}"
 LABEL="net_end"
 ACTION=="remove",       RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown -- --allow auto $env{INTERFACE}"
如果tftp数据传输不能正常进行了,那么可以执行
luther@gliethttp:~$ sudo /etc/init.d/xinetd restart
luther@gliethttp:~$ lsusb 这样显示一下usb设备,usb设备就重新被识别了
之后tftp就又可以正常使用了.
如果还不行,那么重新拔插一次usb cable就一定ok了.
另外
lsmod看是否加载了g_ether.ko,如果没有,那么先把rmmod g_file_storage,然后
insmod g_ether.ko就可以了[luther.gliethttp].

2.使用adb作为登录手机的shell,这样就可以不用再单独接串口线了
in Ubuntu Host PC:
$ export ADBHOST=
And then run adb in ADB folder:
$ adb kill-server
$ adb start-server
$ adb shell
可以写一个脚本,把上面的东西都放进去,
比如:
luther@gliethttp:~$ sudo vim 
lsusb >/dev/null
export ADBHOST=192.168.100.2
adb kill-server
adb start-server
adb shell

3.好了,可以通过一跟usb线登录到手机shell,进行各种操作了,很方便[luther.gliethttp]
阅读(1683) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~