2017년 8월 25일 금요일

Dual booting android and Ubuntu on ODROID-XU4

I made dual booting image for ODROID-C2.
https://codewalkerster.blogspot.kr/2016/03/dual-booting-android-and-ubuntu-on.html

We will make dual booting image for ODROID-XU3/4.

It is recommended to use a storage device of 16Gbyte or more.

Make bootable android media(eMMC or SD).

https://wiki.odroid.com/odroid-xu4/os_images/android/v5.4

Add "VFAT" to label of fat32 partition.



Download ODROID-XU3/4 Ubuntu Image.

https://wiki.odroid.com/odroid-xu4/os_images/linux/ubuntu_4.9/20170824



Copy rootfs and boot partition of ODROID-XU3/4 Ubuntu to your desktop Ubuntu.


mount disk wrote ODROID-XU3/4 Ubuntu image on your desktop PC.




$ mount
...
/.../ubuntu-16.04.3-4.9-mate* on /media/codewalker/boot type vfat (ro,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
/.../ubuntu-16.04.3-4.9-mate* on /media/codewalker/rootfs type ext4 (ro,nosuid,nodev,uhelper=udisks2)


$ mkdir dual
$ cd dual
$ mkdir boot
$ sudo cp -a /media/username/boot/* boot/
$ mkdir rootfs
$ sudo cp -a /media/username/rootfs/* rootfs/


Unmount ubuntu disk image.


Delete rootfs/aafirstboot

$ rm -rf rootfs/aafirstboot

Edit rootfs/etc/fstab

$ sudo vi rootfs/etc/fstab
LABEL=VFAT /media/boot vfat defaults,rw,owner,flush,umask=000 0 0

Chagne userdata partition UUID.

- Insert disk wrote android image on your desktop PC and unmount /dev/sdX3.
$ sudo umount /dev/sdX3
$ cat rootfs/etc/fstab 
LABEL=VFAT /media/boot vfat defaults,rw,owner,flush,umask=000 0 0

UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro,noatime 0 1

$ sudo tune2fs /dev/sdX3 -U e139ce78-9841-40fe-8823-96a304a09859

Copy ODROID-XU3/4 Ubuntu files to android disk.

$ mv /media/username/VFAT/boot. ini  /media/username/VFAT/boot. ini.android
$ cp boot/* /media/username/VFAT/
$ sudo cp rootfs/* /media/username/e139ce78-9841-40fe-8823-96a304a09859/ -a
$ sync

Make script to change OS.

in Ubuntu
$ vi boot_android.sh
------------------------------------------------------------------------
#!/bin/bash
sudo mv /media/boot/boot.ini /media/boot/boot.ini.ubuntu
sudo mv /media/boot/boot.ini.android /media/boot/boot.ini
sudo reboot
------------------------------------------------------------------------
#chmod +x boot_android.sh


in Adnroid
$ su
# mount -o rw,remount /
# vi /system/bin/boot_ubuntu.sh
------------------------------------------------------------------------
#!/bin/sh
mv /storage/internal/boot.ini /storage/internal/boot.ini.android
mv /storage/internal/boot.ini.ubuntu /storage/internal/boot.ini
reboot
------------------------------------------------------------------------
# chmod 777 /system/bin/boot_ubuntu.sh

2017년 6월 30일 금요일

How to change DDR Clock on ODROID-C2(android)

Official wiki page
http://odroid.com/dokuwiki/doku.php?id=en:c2_adjust_ddrclk

Guide to change DDR Clock by android update and recovery.

Open https://dn.odroid.com/S905/BootLoader/ODROID-C2/


Download files.
updatepackage-odroidc2-ddr-408.zip
updatepackage-odroidc2-ddr-792.zip
updatepackage-odroidc2-ddr-912.zip
updatepackage-odroidc2-ddr-1104.zip

Open Utility app.
Select "Package install from storage"



Select "File Manager" -> Download folder


Select updatepackage-odroidc2-ddr-xxx.zip wanted DDR clock.


Recovery!



After reboot, you can check the DDR configuration using the following logs of boot loader if you have a usb-uart module kit.

BL2 Built : 11:44:26, Nov 25 2015.
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1070 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 1104MHz(2T)-14

2017년 6월 27일 화요일

How to enable Touch Wake up.

I refer to this in the site.

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides?TB_iframe=true


anroid-6.0.1_r67

frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java


    /** {@inheritDoc} */
    @Override
    public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
        if ((policyFlags & FLAG_WAKE) != 0) {
            if (wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
                    "android.policy:MOTION")) {
                return 0;
            }
        }

        if (shouldDispatchInputWhenNonInteractive()) {
            return ACTION_PASS_TO_USER;
        }

        // If we have not passed the action up and we are in theater mode without dreaming,
        // there will be no dream to intercept the touch and wake into ambient.  The device should
        // wake up in this case.
        if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) {
            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming,
                    "android.policy:MOTION");
        }

        if (!mPowerManager.isInteractive()) {
            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
                    "android.policy:MOTION");
        }
        return 0;
    }


android-5.1.1_r38

--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4943,6 +4943,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming);
         }

+        if (!mPowerManager.isInteractive()) {
+            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion);
+        }
+
         return 0;
     }

android-4.4.4_r2.0.1

diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 10323a4..b2da523 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4176,6 +4176,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         if (isWakeMotion) {
             result |= ACTION_WAKE_UP;
         }
+        if (!mPowerManager.isScreenOn())
+            mPowerManager.wakeUp(SystemClock.uptimeMillis());
         return result;
     }



2017년 4월 28일 금요일

Nexus 5X LCD 교환

약 2주전 이렇게 케이스를 잘 씌우고 다니던 스마트 폰이 재수가 없으면 뒤로 넘어져도 코가 깨진다고 액정이 박살 났습니다.



LG 서비스 센터에서 수리비가 약 12만원 정도 이길래 검색해 보니 repair kit을 Ali Express 에서 판매하고 있더군요.


생각 보다 빨리 10일 만에 도착 하여 교환 하였는데...


Nexus 5 때는 Battery가 쉽게 떼어 졌는데 이번 5X는 너무 잘 붙어 있어서 떼다가 그만 battery에서 불이 났습니다.

그 땐 당황해서 사진을 못 찍었는데 사무실에 연기로 가득차고 난리가 아니였네요.
Battery를 바닥에 집어 던졌서 바닥까지 타버렸네요.


결국 LG 서비스센터에서 Battery를 3만원 주고 사서 조립은 완성 ...
하지만 LCD가 원래색보다 파란색이 강하게 보입니다.


결론 시간에 금액에 액정 떼는 것도 힘들고 Battery 떼는 건 더 위험하고 그냥 서비스센터에서 교환하세요.

2017년 4월 21일 금요일

ODROID-C2를 CCTV로 활용하기

ODROID-C2와 Webcam을 이용하여 CCTV를 만들어 보자.

http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438



안드로이드 최신 버전을 다운 받는다.
http://odroid.com/dokuwiki/doku.php?id=en:c2_release_android

eMMC나 sdcard에 설치 한다.

안드로이드가 부팅이 되면 Google Apps를 설치한다.
https://codewalkerster.blogspot.kr/2016/06/how-to-install-google-play-store-on.html

Goolge Market이 설치되었으면 Google 계정을 넣고 market에서 CCTV로 검색하여 Alfred를 설치한다.

https://play.google.com/store/apps/details?id=com.ivuu


Viewer로 볼 smartphone에도 alfred를 설치한다.
ODROID-C2에 Alfred는 Camera로 설정하자.


 아래와 같이 어항을 바라보게 Webcam을 설치하였다.


Smartphone에서 아래와 같이 볼 수 있다.




2017년 3월 7일 화요일

How to Enable Multi-Window in Marshmallow.

Go back to Settings > Developer Options > go to the bottom of the Drawing category and enable Multi-window from the options.



Enable multi-window on ODROID-C2.

2017년 2월 28일 화요일

How to write to external storage on odroid(marshmallow android 6.0.1).

You maybe install utorrent app, but you can't download torrent file in external storage installed android 6.0.1(marshmallow).


Edit packages.xml.

$ su
# vi /data/system/packages.xml

<package name="com.utorrent.client" codePath="/data/app/com.utorrent.client-1" nativeLibraryPath="/data/app/com.utorrent.client-1/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097092" privateFlags="0" ft="15a648b6388" it="15a648b6f1f" ut="15a648b6f1f" version="245" userId="10069" installer="com.android.vending">
        ...
        <perms>
            ...
            <item name="android.permission.ACCESS_WIFI_STATE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />
        </perms>


or hacking frameworks.


diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 647c17b..1ec1fe7 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -22,6 +22,7 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.WRITE_MEDIA_STORAGE;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
@@ -1935,6 +1936,8 @@ final class Settings {
             return;
         }

+        boolean isMediaStoragePermission = false;
+
         serializer.startTag(null, TAG_PERMISSIONS);

         for (PermissionState permissionState : permissionStates) {
@@ -1943,6 +1946,19 @@ final class Settings {
             serializer.attribute(null, ATTR_GRANTED, String.valueOf(permissionState.isGranted()));
             serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(permissionState.getFlags()));
             serializer.endTag(null, TAG_ITEM);
+
+            if (!isMediaStoragePermission
+                    && permissionState.getName().equals(WRITE_MEDIA_STORAGE)) {
+                isMediaStoragePermission = true;
+            }
+        }
+
+        if (!isMediaStoragePermission) {
+            serializer.startTag(null, TAG_ITEM);
+            serializer.attribute(null, ATTR_NAME, WRITE_MEDIA_STORAGE);
+            serializer.attribute(null, ATTR_GRANTED, "true");
+            serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(0));
+            serializer.endTag(null, TAG_ITEM);
         }

         serializer.endTag(null, TAG_PERMISSIONS);

Automatically permission string is inserted in packages.xml.


After install app from Market you must reboot system.