Android Full Disk Encryption Workflow (default encryption)

This study is based on Android Marshmallow. Android full disk encryption use dm-crypt, which works with block devices. Please refer to the following docs for more detail: Full Disk Encryption How to setup full disk encryption Android support forceencrypt and encryptable encryption flags, and only support ext4 and f2fs file systems. Setup forceencrypt fstab.bullhead: /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check,forceencrypt=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata Setup encryptable fstab.hammerhead: /dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check,encryptable=/dev/block/platform/msm_sdcc.1/by-name/metadata Related Properties and source code location Related source code: ...

April 29, 2016 · 3 min · oopsmonk

Dependency src specified more than once

This problem appered when I was checking out older tag from the Chromium project. Working with Release Branches ~/chromium_build/src$ git fetch --tags ~/chromium_build/src$ git checkout -b tag_35.0.1849.0 35.0.1849.0 ~/chromium_build/src$ gclient sync --with_branch_heads --jobs 16 Error log: Syncing projects: 100% ( 1/ 1) src src (ERROR) ---------------------------------------- [0:00:00] Started. ________ running 'git reset --hard HEAD' in '/home/sam.chen/chromium_source/src' [0:00:00] HEAD is now at 77bd011 Publish DEPS for Chromium 35.0.1849.0 [0:00:00] _____ src : Attempting rebase onto 77bd011602b1799f715591e697806c55e7ef8b7f... [0:00:00] Current branch tag_35.0.1849.0 is up to date. [0:00:00] ---------------------------------------- Error: 1> Dependency src specified more than once: 1> src(https://chromium.googlesource.com/chromium/src.git) [https://chromium.googlesource.com/chromium/src.git] 1> vs 1> src(https://chromium.googlesource.com/chromium/src.git) -> src(https://chromium.googlesource.com/chromium/src.git@ae69ae7642 35ccaac55fc44a3b5f3276ff34cb58) [https://chromium.googlesource.com/chromium/src.git@ae69ae764235ccaac55fc44a3b5f3276ff34cb58] You need to edit the .DEPS.git file, remove the entry ‘src’ and then gcient sync --with_branch_heads. ...

July 31, 2015 · 1 min · oopsmonk

Build Android WebView From The Chromium Projects

First, check out and install the depot_tools package. $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $ export PATH=$PATH:/path/to/depot_tools Checkout source code $ mkdir ~/chromium_build && cd $_ ~/chromium_build$ fetch --nohooks android //Configure GYP ~/chromium_build$ echo "{ 'GYP_DEFINES': 'OS=android', }" > chromium.gyp_env //Update projects from gyp files. //You may need to run this again when you have added new files, updated gyp files, or sync'ed your repository. ~/chromium_build$ gclient runhooks Environment setup ~/chromium_build$ sudo apt-get install openjdk-7-jdk //config default JDK ~/chromium_build$ sudo update-alternatives --config javac ~/chromium_build$ sudo update-alternatives --config java ~/chromium_build$ sudo update-alternatives --config javaws ~/chromium_build$ sudo update-alternatives --config javap ~/chromium_build$ sudo update-alternatives --config jar ~/chromium_build$ sudo update-alternatives --config jarsigner //install build dependencies ~/chromium_build$ src/build/install-build-deps-android.sh // Install Google Play Services ~/chromium_build$ src/third_party/android_tools/sdk/tools/android update sdk --no-ui --filter 57 Build ~/chromium_build$ cd ~/chromium_build/src //Full browser ~/chromium_build/src$ ninja -C out/Debug chrome_public_apk //WebView ~/chromium_build/src$ ninja -C out/Debug android_webview_apk //sync source ~/chromium_build/src$ gclient sync Android APK location: ~/chromium_source/src/out/Debug/apks/ ...

July 31, 2015 · 1 min · oopsmonk

How to split boot.img and get kernel config

boot_cm9.img file from mk802_legacy-compatibility_v1.zip Device: Rikomagic MK802 Script files : Split_bootimg.pl , extract-ikconfig ( in {kernel_source}/script ) Split boot.img Copy boot_cm9.img, Split_bootimg.pl, extract-ikconfig into ‘split_boot’ $ mkdir split_boot $ cd split_boot $ ./split_bootimg.pl boot_cm9.img Page size: 2048 (0x00000800) Kernel size: 8094708 (0x007b83f4) Ramdisk size: 178940 (0x0002bafc) Second size: 0 (0x00000000) Board name: Command line: console=ttyS0,115200 rw init=/init loglevel=8 Writing boot_cm9.img-kernel ... complete. Writing boot_cm9.img-ramdisk.gz ... complete. Get kernel image (boot_cm9.img-kernel) and ramdisk (boot_cm9.img-ramdisk.gz) Extract kernel config $ dd if=boot_cm9.img-kernel of=dd_uImage bs=1024 skip=1 7903+1 records in 7903+1 records out 8093684 bytes (8.1 MB) copied, 0.0178518 s, 453 MB/s $./extract-ikconfig dd_uImage > kernel_config Extract ramdisk $ mkdir ramdisk $ cd ramdisk $ gzip -dc ../boot_cm9.img-ramdisk.gz | cpio -i 6677 blocks $ tree . . ├── data ├── default.prop ├── dev ├── init ├── init.goldfish.rc ├── initlogo.rle ├── init.rc ├── init.sun4i.rc ├── init.sun4i.usb.rc ├── proc ├── sbin │ ├── adbd │ └── ueventd -> ../init ├── sys ├── system ├── ueventd.goldfish.rc ├── ueventd.rc └── ueventd.sun4i.rc Reference: HOWTO: Unpack, Edit, and Re-Pack Boot Images ...

September 12, 2012 · 1 min · oopsmonk

How to extract kernel config from uImage

Get extract-ikconfig in kernel-source/scripts/ $mkdir extreact-uImage $cd extreact-uImage $cp {kernel-source}/scripts/extract-ikconfig . Dump uImage skip 1024 bytes $cp {uImage/what/you/want} uImage $dd if=uImage of=dd_uImage bs=1024 skip=1 $./extract-ikconfig dd_uImage > config

August 21, 2012 · 1 min · oopsmonk

XBMC for Android on MK802

XBMC announced XBMC for Android. 不過並不打算放上Google Play, 需要自行compile及打包, 方法可參考: Build XBMC for Android on lubuntu 12.04 在此記錄一下目前在MK802跑起來的情況. MK802介紹可參考: Android 4.0 mini PC 最小的主機MK802 CPU : Allwinner A10 - ARM Cortex A8 SoC GPU : ARM Mali 400 RAM : 1GB 以公定價$79USD及讓人跌破眼鏡的入手價, 拿來玩真是夠本了. 這次是要用Android 手機來控制 XBMC, 因為MK802沒有IR只能用滑鼠操作上有些不便. Google Play上有Official XBMC Remote可直接下載來用. 中文設定: 切換到Appearance -> Setting -> International -> Language 為了能透過HTTP連到MK802的XBMC, 需要將"網站伺服"的功能打開, 設定port number 接著查看IP, 設定手機上的XBMC Remote如下: 連線成功就會出現控制選項 用手機上"Remote Control" Navigation, 測試播放USB裡的影片 影片開播後選手機上的"Now Playing", 可以做seek, FF/FB功能, 音量控制是使用手機上的音量鍵. (當初還因為無法控制音量煩腦, 沒想到直接用就可以…冏) ...

July 29, 2012 · 1 min · oopsmonk

Build XBMC for Android on lubuntu 12.04

Install required packages # sudo apt-get install build-essential default-jdk git curl autoconf \ unzip zip zlib1g-dev gawk gperf Getting the Android SDK and NDK http://developer.android.com/sdk/index.html SDK : android-sdk_r20.0.1-linux.tgz crystax-5 NDK with enabled support of C++ exceptions, RTTI and Standard C++ Library http://www.crystax.net/en/android/ndk/7#download NDK : android-ndk-r7-crystax-5.beta2-linux-x86.tar.bz2 Installing Android SDK packages <android-sdk> : $HOME/XBMC_Project/android-sdk-linux # cd <android-sdk>/tools # ./android update sdk -u -t platform,platform-tool Setup the Android toolchain <android-ndk> : $HOME/XBMC_Project/android-ndk-r8b <android-toolchain> : $HOME/XBMC_Project/android_toolchain/android-9 # cd <android-ndk> # ls platforms # cd build/tools # ./make-standalone-toolchain.sh --ndk-dir=../../ \ --install-dir=<android-toolchain>/android-9 --platform=android-9 Create a (new) debug key to sign debug APKs All packages must be signed. The following command will generate a self-signed debug key. If the result is a cryptic error, it probably just means a debug key already existed, no cause for alarm. ...

July 28, 2012 · 2 min · oopsmonk