adb安装:
如下方法可以实现adb.
(如果识别不到设备,可以先重做一遍4、5步骤。如还是不行,再重做一遍2、3、4、5步骤)
1.
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb
2. 创建adb_usb.ini
电脑连接android设备后会显示连接的设备的信息 2717:ff40
zlb@zlb-System-Product-Name:~$ lsusb
Bus 002 Device 007: ID 15d9:0a4f Trust International B.V. Optical Mouse
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 2717:ff40 //android 设备的id
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
zlb@zlb-System-Product-Name:~$ lsusb
把android设备的id写入adb_usb.ini文件
zlb@zlb-System-Product-Name:~/.android$ touch adb_usb.ini
zlb@zlb-System-Product-Name:~/.android$ ls
adbkey adbkey.pub adb_usb.ini
zlb@zlb-System-Product-Name:~/.android$ echo 0x2717 > ./adb_usb.ini
3. 添加权限
sudo vim /etc/udev/rules.d/70-persistent-net.rules
70-persistent-net.rules:根据具体的来,不同系统名字不一定一样,且为只读文件,需要用sudo打开才能修改
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="38:2c:4a:be:cf:16", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="30:85:a9:af:f5:aa", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
#usb adb 2018.01.19 2717:ff40
SUBSYSTEM=="usb", ATTR{idVendor}=="2717",ATTR{idProduct}=="ff40",MODE=="0666"
4. 修改文件的权限并重启usb服务
zlb@zlb-System-Product-Name:/etc/udev/rules.d$ ls
70-persistent-net.rules README
zlb@zlb-System-Product-Name:/etc/udev/rules.d$ sudo chmod a+rx /etc/udev/rules.d/70-persistent-net.rules
zlb@zlb-System-Product-Name:/etc/udev/rules.d$ sudo service udev restart
udev stop/waiting
udev start/running, process 11810
zlb@zlb-System-Product-Name:/etc/udev/rules.d$
5. 重启adb服务
zlb@zlb-System-Product-Name:~$ adb kill-server
zlb@zlb-System-Product-Name:~$ sudo adb start-server
[sudo] password for zlb:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
zlb@zlb-System-Product-Name:~$ adb devices
List of devices
zlb@zlb-System-Product-Name:~$
参考:http://blog.csdn.net/koozxcv/article/details/49430119
- dmesg充当串口log -- 但是无preloader与lk的log
- 增大内核缓冲区 - 修改kernel-3.18\kernel\printk\printk.c
- -332 #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
- +332 #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT << 5)
- adb shell dmesg > log.log //查看内核缓冲区log(包括开机log,同串口log)
6.Launcher(开完机)后UART不再吐log问题:
1). 在Launcher之后,如何令kernel log自动吐出?
方法一:设置属性adb shell setprop persist.uartconsole.enable 1, 然后重新开机抓uart log
(需要有root权限,适合eng版本和userdegbug 版本)
方法二:修改code
在/kernel-3.10/kernel/printk.c 中mt_disable_uart()中,将printk_disable_uart=1修改为0
2). 在user mode和userdebug mode,如何令kernel log在lk结束后自动吐出?
方法一:fastboot comand
1) 按volumn up + power key进入 bootmenu 选择fastboot mode
2) usb连接PC端,执行命令fastboot oem p2u on
3) 执行fastboot continue命令
方法二:修改code
在/bootable/bootloader/lk/app/mt_boot/mt_boot.c里修改:
if (!has_set_p2u) {
#ifdef USER_BUILD
sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=1"); // printk.disable_uart=1 改为0
#else
sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=0 ddebug_query=\"file *mediatek* +p ; file *gpu* =_\"");
#endif