2020-07-03
findstr
2020-03-25
2020-01-20
enable adb over tcpip
# enable adb over tcpip
$ adb tcpip 5555
or
$ adb -d tcpip 5555
# adb connect over tcpip
$ adb connect 192.168.35.9
$ adb -l
2019-11-12
[Google Assistant] Install the SDK and Sample Code
reference
- https://developers.google.com/assistant/sdk/guides/service/python/embed/install-sample
$ sudo apt-get update
$ sudo apt-get install python3-dev python3-venv
$ python3 -m venv env
$ env/bin/python -m pip install --upgrade pip setuptools wheel
$ source env/bin/activate
(env) $ python -m pip install --upgrade google-assistant-sdk[samples]
(env) $ python -m pip install --upgrade google-auth-oauthlib[tool]
(env) $ google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless --client-secrets /path/to/client_secret_client-id.json
// voice input
(env) $ googlesamples-assistant-pushtotalk --project-id xxx --device-model-id yyy
// text input
(env) $ python -m googlesamples.assistant.grpc.textinput --device-id xxx --device-model-id yyy
2019-10-28
Abbreviation
DRC
- Dynamic Range Control
DLKM
- Dynamically loadable kernel module
KMI
- Kernel Module Interface
GKI
- Generic Kernel Image
LTS
- Linux Long Term Supported (LTS) kernel
ACK
- Android Common Kernel
OAuth
- Open Authorization
- pronounced "oh-auth"
gRPC
- gRPC Remote Procedure Calls
SUPL
- Secure User Plane Location
OMA
- Open Mobile Alliance
pypi
- python package installer
WRP
- Watchpoint Register Pair
BRP
- Breakpoint Register Pair
BVRs
- Breakpoint Value Registers
IFTTT
- If this, then that
PAI
- play auto install
smali
- The names "Smali" and "Baksmali" are the Icelandic equivalents of "assembler" and "disassembler" respectively.
- Smali/Baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation.
DFP
- downstream facing port (USB)
UFP
- upstream facing port (USB)
DRD
- dual-role-data (USB)
DRP
- dual-role-power (USB)
SPS
- Sequence Parameter Set
PPS
- Picture Parameter Set
ETA
- Estimated Time of Arrival
SEP
- Stream End Point
- Bluetooth
AMP
- Armada Media Pipeline
- synaptics
IV
- initial vector
- crypto, DRM, clear key/IV
CPM
- Clock/Power Management
install home-assistant on ubuntu
Ubuntu 18.04 및 Package 설치
- reference
- ubuntu 18.04 설치
- 설치 파일 다운로드
- http://releases.ubuntu.com/18.04/
- http://releases.ubuntu.com/18.04/ubuntu-18.04.3-desktop-amd64.iso
- ubuntu 설치.
- storage : 40 GB ( > 32 GB)
- memory : 2 GB ( > 1 GB)
- 필요 package
- apparmor-utils
- apt-transport-https
- avahi-daemon
- ca-certificates
- curl
- dbus
- jq
- socat
- software-properties-common
- network-manager
- bash
- docker-ce
- package 설치
- sudo apt-get install apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq socat software-properties-common network-manager
- bash
- docker-ce
- https://docs.docker.com/install/linux/docker-ce/ubuntu/
- docker-ce에 필요한 package 설치
- docker apt-key 설치 및 확인
- docker 설치를 위한 apt-repository 추가
- docker-ce package 설치 및 확인
- docker group에 user 추가
- images, containers, volumes, or customized configuration files on
- $ sudo apt-get update
- $ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- $ sudo apt-key fingerprint 0EBFCD88
- $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- $ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo docker run hello-world
- $ sudo usermod -aG docker account_name
- /var/lib/docker
- Hass.io installation
- prepare (install docker-ce with script) * docker-ce를 설치했으면 다시 실행할 필요 없음.
- install $ sudo -i
- $ sudo -i
- $ apt-get install software-properties-common
- $ add-apt-repository universe
- $ apt-get update
- $ apt-get install apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat
- $ curl -fsSL get.docker.com | sh
- $ curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s
Labels:
HA,
hassio,
HassOS,
Home Assistant,
home-assistant,
ubuntu,
ubuntu 18.04
2019-09-25
[android] security patch error
# android security patch 중 다음과 같은 에러 발생
---
FAILED: out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff
(prebuilts/clang-tools/linux-x86/bin/header-abi-diff -allow-unreferenced-changes -allow-unreferenced-elf-symbol-changes -lib liblog -arch arm -o out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff -new out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.lsdump -old out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so_ref.lsdump)|| (echo ' ---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----' && exit 1)
******************************************************
error: VNDK library: liblog's ABI has INCOMPATIBLE CHANGES Please check compatiblity report at : out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff
******************************************************
---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----
---
FAILED: out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff
(prebuilts/clang-tools/linux-x86/bin/header-abi-diff -allow-unreferenced-changes -allow-unreferenced-elf-symbol-changes -lib liblog -arch arm -o out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff -new out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.lsdump -old out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so_ref.lsdump)|| (echo ' ---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----' && exit 1)
******************************************************
error: VNDK library: liblog's ABI has INCOMPATIBLE CHANGES Please check compatiblity report at : out/soong/.intermediates/system/core/liblog/liblog/android_arm_armv7-a-neon_cortex-a7_core_shared/liblog.so.abidiff
******************************************************
---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----
---
# 출력된 로그처럼 실행하면 또 에러 발생;;
$ development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog
# 모델명을 파라미터로 넣어주면 정상적으로 업데이트 됨.
$ development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog -products my_product
- 참고로 모델명은 lunch 파라미터와 동일.
TARGET_PRODUCT=my_product
Labels:
abi,
android,
create_reference_dumps.py,
patch,
security,
security patch,
update abi
2019-07-12
set time on android console
### display date
# date
Tue Jul 13 19:25:15 GMT 1999
# date +'%D %T'
07/13/99 19:25:00
### set date
# date 07131924
Sat Jul 13 19:24:00 GMT 2019
# date 07131924.45
Sat Jul 13 19:24:45 GMT 2019
# date 071319241999.23
Tue Jul 13 19:24:23 GMT 1999
### help
# date --help
usage: date [-u] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]
Set/get the current date/time. With no SET shows the current date.
Default SET format is "MMDDhhmm[[CC]YY][.ss]", that's (2 digits each)
month, day, hour (0-23), and minute. Optionally century, year, and second.
Also accepts "@UNIXTIME[.FRACTION]" as seconds since midnight Jan 1 1970.
-d Show DATE instead of current time (convert date format)
-D +FORMAT for SET or -d (instead of MMDDhhmm[[CC]YY][.ss])
-r Use modification time of FILE instead of current date
-u Use UTC instead of current timezone
+FORMAT specifies display format string using strftime(3) syntax:
%% literal % %n newline %t tab
%S seconds (00-60) %M minute (00-59) %m month (01-12)
%H hour (0-23) %I hour (01-12) %p AM/PM
%y short year (00-99) %Y year %C century
%a short weekday name %A weekday name %u day of week (1-7, 1=mon)
%b short month name %B month name %Z timezone name
%j day of year (001-366) %d day of month (01-31) %e day of month ( 1-31)
%N nanosec (output only)
%U Week of year (0-53 start sunday) %W Week of year (0-53 start monday)
%V Week of year (1-53 start monday, week < 4 days not part of this year)
%D = "%m/%d/%y" %r = "%I : %M : %S %p" %T = "%H:%M:%S" %h = "%b"
%x locale date %X locale time %c locale date/time
usage: date [-u] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]
Set/get the current date/time. With no SET shows the current date.
Default SET format is "MMDDhhmm[[CC]YY][.ss]", that's (2 digits each)
month, day, hour (0-23), and minute. Optionally century, year, and second.
Also accepts "@UNIXTIME[.FRACTION]" as seconds since midnight Jan 1 1970.
-d Show DATE instead of current time (convert date format)
-D +FORMAT for SET or -d (instead of MMDDhhmm[[CC]YY][.ss])
-r Use modification time of FILE instead of current date
-u Use UTC instead of current timezone
+FORMAT specifies display format string using strftime(3) syntax:
%% literal % %n newline %t tab
%S seconds (00-60) %M minute (00-59) %m month (01-12)
%H hour (0-23) %I hour (01-12) %p AM/PM
%y short year (00-99) %Y year %C century
%a short weekday name %A weekday name %u day of week (1-7, 1=mon)
%b short month name %B month name %Z timezone name
%j day of year (001-366) %d day of month (01-31) %e day of month ( 1-31)
%N nanosec (output only)
%U Week of year (0-53 start sunday) %W Week of year (0-53 start monday)
%V Week of year (1-53 start monday, week < 4 days not part of this year)
%D = "%m/%d/%y" %r = "%I : %M : %S %p" %T = "%H:%M:%S" %h = "%b"
%x locale date %X locale time %c locale date/time
2019-07-04
eMMC PARTITION_CONFIG (Boot partition selection)
http://trac.gateworks.com/wiki/MMC
eMMC PARTITION_CONFIG (Boot partition selection)
Because eMMC provides multiple hardware partitions but only one can be selected at a time. A non-volatile register in the eMMC device provides a PARTITION_CONFIG that is used to determine what partition is selected at power-up for boot devices. To access this data you need to read/write a 'Card Specific Data' or CSD register (EXT_CSD[179] - EXT_CSC_PART_CONFIG). This can be done both in Linux (see below) or U-Boot (see below).
U-Boot Support ¶
U-Boot provides access to eMMC devices through the
mmc command and interface but adds an additional argument to the mmc interface to describe the hardware partition. The interface is therefore described as 'mmc <dev> <part>' where 'dev' is the mmc device (some boards have more than one) and 'part' is the hardware partition: 0=user, 1=boot0, 2=boot1.
Use the
mmc dev command to specify the device and partition:mmc dev 0 0 # select user hw partition mmc dev 0 1 # select boot0 hw partition mmc dev 0 2 # select boot1 hw partition
If U-Boot has been built with
CONFIG_SUPPORT_EMMC_BOOT some additional mmc commands are available:- mmc bootbus <dev> <boot_bus_width> <reset_boot_bus_width> <boot_mode>
- mmc bootpart-resize <dev> <boot-part-size-mb> <rpmb-part-size-mb>
- mmc partconf <dev> <boot_ack> <boot-partition> <partition-access> # set PARTITION_CONFIG field
- mmc rst-function <dev> <value> # change RST_n_FUNCTION field between 0|1|2 (write-once)
The
mmc partconf command can be used to configure the PARTITION_CONFIG specifying what hardware partition to boot from:mmc partconf 0 0 0 0 # disable boot partition (default unset condition; boots from user partition) mmc partconf 0 1 1 0 # set boot0 partition (with ack) mmc partconf 0 1 2 0 # set boot1 partition (with ack) mmc partconf 0 1 7 0 # set user partition (with ack)
If U-Boot has been built with
CONFIG_SUPPORT_EMMC_RPMB the mmc rpmb command is available for reading, writing and programming the key for the Replay Protection Memory Block (RPMB) partition in eMMC.
When using U-Boot to write to eMMC (or microSD) it is often useful to use the
gzwrite command. For example if you have a compressed 'disk image' you can write it to your eMMC (assuming it is mmc dev 0) with:tftpboot ${loadaddr} disk-image.gz && gzwrite mmc 0 ${loadaddr} ${filesize}
- The
disk-image.gzcontains a partition table at offset 0x0 as well as partitions at their respective offsets (according to the partition table) and has been compressed with gzip - If you know the flash offset of a specific partition (which you can determine using the
part list mmc 0command) you can also use gzwrite to flash a compressed partition image
Linux Support
Linux presents the various hardware partitions as separate devices:
- /dev/mmcblk0boot0 - BOOT0 partition
- /dev/mmcblk0boot1 - BOOT1 partition
- /dev/mmcblk0rpmb - RPMB partition
- /dev/mmcblk0 - USER partition
Note that the BOOT partitions by default are read-only as they are typically used for sensitive boot firmware. To write to them you can disable
force_ro in sysfs via:echo 0 > /sys/class/block/mmcblk0boot0/force_ro
The Linux
mmc application provides access to eMMC configuration through CSD registers. This open-source application is available at http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git/.- To build it:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git cd mmc-utils make - Alternatively you can install this from a pre-built deb:
- Newport (arm64):
wget http://dev.gateworks.com/images/mmc-utils_0~gita3d3331-3~armbian5.35+1_arm64.deb dpkg -i mmc-utils_0~gita3d3331-3~armbian5.35+1_arm64.deb
- Newport (arm64):
- Ventana (armhf):
wget http://dev.gateworks.com/images/mmc-utils_0~gita3d3331-3~armbian5.35+1_armhf.deb dpkg -i mmc-utils_0~gita3d3331-3~armbian5.35+1_armhf.deb
You can use the
mmc utility to configure the eMMC PARTITION_CONFIG to specify the boot device on power-up via mmc bootpart enable <boot_partition> <send_ack> <device> where boot_partition specifies the hardware partition (1=boot0, 2=boot1, 7=user), send_ack specifies the device must send an awknoledgement (for fast boot), and device is the root mmc block device of the eMMC:# set boot partition to boot0 mmc bootpart enable 1 0 /dev/mmcblk0 # set boot partition to boot1 mmc bootpart enable 2 0 /dev/mmcblk0 # set boot partition to user mmc bootpart enable 7 0 /dev/mmcblk0
Some additional use cases:
# show PARTITION_CONFIG: mmc extcsd read /dev/mmcblk0 | grep PARTITION_CONFIG # show BUS CONFIG: mmc extcsd read /dev/mmcblk0 | grep BOOT_BUS_CONDITIONS # disable boot partition mmc bootpart enable 0 0 /dev/mmcblk0
References:
Labels:
boot,
boot partition selection,
emmc,
u-boot
2019-06-21
how to extract boot.img & recovery.img
출처 : https://unix.stackexchange.com/questions/64628/how-to-extract-boot-img
/*
download tools
*/
$ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android-serialport-api/android_bootimg_tools.tar.gz
/*
unpack recovery.img
*/
$ mkdir recovery
$ ./unpackbootimg -i recovery.img -o recovery
$ cd recovery
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../recovery.img-ramdisk.gz | cpio -i
2019-03-21
DEVICE_PACKAGE_OVERLAYS, PRODUCT_PACKAGE_OVERLAYS
### DEVICE_PACKAGE_OVERLAYS, PRODUCT_PACKAGE_OVERLAYS
1. mk 파일에 overlay 폴더 지정.
DEVICE_PACKAGE_OVERLAYS += device_overlay_folder
PRODUCT_PACKAGE_OVERLAYS += product_overlay_folder
2. DEVICE_PACKAGE_OVERLAYS와 PRODUCT_PACKAGE_OVERLAYS에 동일한 item이 존재할 경우, PRODUCT_PACKAGE_OVERLAYS 의 내용이 적용됨.
3. PRODUCT_PACKAGE_OVERLAYS에 동일한 item이 존재할 경우, 앞의 item 값이 적용됨.
예) 다음과 같이 folder1,2가 순서대로 overlay되고, 두 폴더내에 동일한 item이 있을 경우, folder1의 값이 적용됨.
PRODUCT_PACKAGE_OVERLAYS += product_overlay_folder1
PRODUCT_PACKAGE_OVERLAYS += product_overlay_folder2
4. DEVICE_PACKAGE_OVERLAYS에 동일한 item이 존재할 경우, 앞의 item값이 적용됨.
### overlays 적용 후 확인 방법
1. frameworks/... 하위 폴더 내용
- target의 system/framework/framework-res.apk 파일에 적용됨.
- apktool로 framework-res.apk unpack 후 내용 확인.
download : https://ibotpeaches.github.io/Apktool/
unpack :
$ apktool d framework-res.apk
$ java -jar ~/bin/apktool.jar d framework-res.apk
2019-03-11
git command
### git tree로 보기
$ git log --graph
$ git log --pretty=format:"%h %s" --graph
### git diff
# 두 브랜치의 특정 폴더 비교
$ git diff branch1..branch2 folder/
# 두 브랜치 - 특정 폴더 제외하고 비교
$ git diff branch1..branch2 -- . ':!folder_exclude'
### git rename branch
$ git branch -m old_branch_name new_branch_name
$ git branch -m new_branch_name
### git - disable color ui
git color ui 질문 "Enable color display in this user account (y/N)?" 안뜨게 하기
$ git config --global color.ui false
### git difftool : meld
# git difftool config
$ git config --global diff.tool meld
# git difftool 실행(meld) 시 dbus 에러 발생 시 해결 방법
--- 에러 내용 ---
(meld:16516): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-la2QE9V9o8: Connection refused
------------------
--- 해결 방법 ---
$ eval $(dbus-launch --sh-syntax)
$ export DBUS_SESSION_BUS_ADDRESS
$ export DBUS_SESSION_BUS_PID
-------------------
// 브랜치 비교
$ git difftool branch_a..branch_b
// folder 형식으로 비교
$ git difftool --dir-diff branch_a..branch_b
2019-03-08
mount ex4 image file
# ext4 이미지 파일을 mount 하는 방법
$ mount -t ext4 -o loop image_ext4.raw /mnt/ext4_target
@ read-only 마운드
$ mount -t ext4 -o loop,ro image_ext4.raw /mnt/ext4_target
$ ./simg2img system.img image_ext4.raw
2019-03-07
grep
### 특정 파일에서 검색 #1
$ grep -rn --include=\*.{c,cpp,h} szFindSting folder/
### 특정 파일에서 검색 #2
$ grep -rn --include="*.[ch]" szFindSting folder/
### 특정 파일 제외하고 검색
$ grep -rn --exclude={file1,file2,file3} szFindString folder/
$ grep -rn --exclude="*.ninja" szFindString folder/
### 특정 폴더 제외하고 검색
$ grep -rn --include=\*.{c,cpp,h} szFindSting folder/
### 특정 파일에서 검색 #2
$ grep -rn --include="*.[ch]" szFindSting folder/
### 특정 파일 제외하고 검색
$ grep -rn --exclude={file1,file2,file3} szFindString folder/
$ grep -rn --exclude="*.ninja" szFindString folder/
$ grep -rn --exclude-dir={dir1,dir2,dir3} szFindString folder/
### 대소문자 구분 안 함
$ grep -rn --ignore-case szFindString folder/
### 파일을 ascii로 인식
$ grep -rn -a szFindString folder/
### 여러 패턴 검색
$ grep -rn -e szFindString1 -e szFindString2 -e szFindString3 folder/
$ grep -rn --ignore-case szFindString folder/
### 파일을 ascii로 인식
$ grep -rn -a szFindString folder/
### 여러 패턴 검색
$ grep -rn -e szFindString1 -e szFindString2 -e szFindString3 folder/
Labels:
ascii,
file pattern,
folder,
grep,
ignore case
2019-01-15
[android] kernel boot parameter to propery
참고 : system/core/init/init.cpp
/proc/cmdline 의 androidboot.xxx=yyy 는 ro.boot.xxx=yyy 로 propery 세팅 됨.
Labels:
android,
androidboot,
boot parameter,
cmdline,
kernel,
property,
ro.boot
2018-11-06
add-radio-file for android recovery
# update package file(update.zip)에 기타 파티션(예, bootloader)를 추가 방법.
makefile에 다음과 같이 추가.
$(call add-radio-file,bootloader.img)
- INSTALLED_RADIOIMAGE_TARGET += bootloader.img
- $(LOCAL_PATH)/bootloader.img를 $(PRODUCT_OUT)/bootloader.img 로 복사
$(call add-radio-file,folder/bootloader.img)
- INSTALLED_RADIOIMAGE_TARGET += bootloader.img
- $(LOCAL_PATH)/folder/bootloader.img를 $(PRODUCT_OUT)/bootloader.img 로 복사
# 다른 방법
makefile에 아래 동작 추가
- INSTALLED_RADIOIMAGE_TARGET += bootloader.img
- bootloader.img를 $(PRODUCT_OUT)/bootloader.img에 복사
Labels:
android,
bootloader,
recovery,
update.zip
2018-11-01
re-mount system & vendor partition rw mode on android
### w/ console, adb shell or terminal
@ re-mount system partition rw option
// Android Pie (9.0)
# mount -o rw,remount /
// Android Oreo
# mount -o rw,remount /system
@ re-mount vendor partition rw option
# mount -o rw,remount /vendor
### w/ adb
$ adb connect
$ adb root
$ adb connect
@ re-mount system & vendor partition rw option
$ adb remount
2018-10-23
uboot ext4
# part list mmc 0
# ext4ls mmc 0:4 /
# ext4load mmc 0:4 0x24000000 test.bin
preferred activities
@ xml path
/system/etc/preferred-apps/preferred-activities-home.xml
/data/system/users/0/package-restrictions.xml
@ source code
frameworks/base/services/core/java/com/android/server/pm/Settings.java
@ reference site
https://stackoverflow.com/questions/34073290/set-default-application-on-aosp
https://github.com/opengapps/all/blob/master/etc/preferred-apps/google.xml
Labels:
activity,
android,
default,
preferred activities
2018-10-16
ssh mount
출처 : https://blog.leocat.kr/notes/2018/04/23/sshfs-mount-remote-server-using-ssh
$ sshfs -o reconnect mirror@mirror:/mirror /mnt/mirror
$ sudo umount /mnt/mirror
Subscribe to:
Posts (Atom)
