2013년 4월 15일 월요일

Recovery for ODROID

I success to port recovery function of CM to ODROID-X2 base Android beta 1.5(android-4.1.2_r1). 
well working.




now enable recovery UI on LCD.



2013년 4월 2일 화요일

CM-10.1-M2 for ODROID-U2

1. Support Ethernet. (static IP not yet)
2. Mouse right button click act like back Button.
3. add PowerOff widget.



working to enable Volume Up/Down, Screenshot, Power Button.


https://www.dropbox.com/s/sy3lkbo8fr48xla/cm-10.1-20130404-UNOFFICIAL-odroidu2.zip

build and install CyanogenMod for ODOID-U2

http://wiki.cyanogenmod.org/w/Build_for_odroidu2

소스를 git로부터 가져 옵니다.
get source from git.

$repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1

$repo sync

tag를 확인해 보면 M2가 있습니다. M2로 checkout합니다.


[~/projects/cm-10.1/frameworks/base]$ git tag
cm-10.1-M1
cm-10.1-M2

$repo forall -c git chechout cm-10.1-M2

$cd vendor/cm
$./get-prebuilts
$cd ../..

$source build/envsetup.sh
$breakfast odroidu2

including vendor/cm/vendorsetup.sh
ls: cannot access device/*/odroidu2/cm.mk: No such file or directory
build/core/product_config.mk:234: *** Cannot locate config makefile for product "cm_odroidu2".  Stop.
Device odroidu2 not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_hardkernel_odroidu2
Default revision: cm-10.1
Checking branch info
Adding dependency: CyanogenMod/android_device_hardkernel_odroidu2 -> device/hardkernel/odroidu2
Using default branch for android_device_hardkernel_odroidu2
Syncing repository to retrieve project.
remote: Counting objects: 338, done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 338 (delta 147), reused 320 (delta 129)
Receiving objects: 100% (338/338), 2.87 MiB | 153 KiB/s, done.
Resolving deltas: 100% (147/147), done.
From git://github.com/CyanogenMod/android_device_hardkernel_odroidu2
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
From git://github.com/CyanogenMod/android_device_hardkernel_odroidu2
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
Fetching projects: 100% (1/1), done.

Repository synced!
Looking for dependencies
Adding dependencies to manifest
Adding dependency: CyanogenMod/android_device_hardkernel_samsung -> device/hardkernel/samsung
Using default branch for android_device_hardkernel_samsung
Adding dependency: CyanogenMod/android_hardware_realtek -> hardware/realtek
Using default branch for android_hardware_realtek
Adding dependency: CyanogenMod/hardkernel-kernel-4412 -> kernel/hardkernel/4412-common
Using default branch for hardkernel-kernel-4412
Syncing dependencies
remote: Counting objects: 673, done.
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (15/15), done.
remote: Compressing objects: 100% (315/315), done.
remote: Total 19 (delta 0), reused 19 (delta 0)
Unpacking objects: 100% (19/19), done.
From git://github.com/CyanogenMod/android_hardware_realtek
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
remote: Total 673 (delta 326), reused 673 (delta 326)
Receiving objects: 100% (673/673), 3.95 MiB | 94 KiB/s, done.
Resolving deltas: 100% (326/326), done.
From git://github.com/CyanogenMod/android_device_hardkernel_samsung
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1-MR1 -> cm-10.1-MR1
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
remote: Counting objects: 2114829, done.
remote: Compressing objects: 100% (330292/330292), done.
Receiving objects:   2% (43873/2114829), 16.79 MiB | 131 KiB/s  





odroid-u2를 켜고 device/hardkernel/odroidu2/extract-files.sh을 실행

Turn on odroid-u2 and run shell script.

$sh ./extrac-files.sh

And build.

$source build/envsetup.sh
$breakfast odroidu2
$croot
$brunch odroidu2


http://wiki.cyanogenmod.org/w/Install_CM_for_odroidu2

여기서 CM 복구 이미지를 받습니다.
Download CM Recovery(bootstrap) Image.

http://cmw.cmfs.me/emmc/bootstrap-cm-10.1-20130105-odroidu2.zip

압축을 풀고 eMMC를 PC에 연결 합니다.
Unzip and connect eMMC Module to PC.

sh ./install-emmc.sh /dev/sd[x] 와 같이 mount된 eMMC의 sd[x]를 넣어 줍니다.


[~/Downloads/cyanogenMod]$ sh ./install-emmc.sh /dev/sdd
/dev/sdd reader is identified.
Fusing kernel
2887260+0 records in
2887260+0 records out
2887260 bytes (2.9 MB) copied, 2.15934 s, 1.3 MB/s
Fusing root filesystem
185013+0 records in
185013+0 records out
185013 bytes (185 kB) copied, 0.203257 s, 910 kB/s
Fusing main system partition
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 37.0214 s, 14.2 MB/s



eMMC를 다시 PC에 연결 후 fat 영역에 "cmupdater" 란 폴더를 만들고 cm-10.1-xxxxxxxx-UNOFFICIAL-odroidu2.zip 앞에서 build된 zip 파일을 넣으면 아래와 같이 보이고 설치가 가능합니다.

finished fusing, reconnect eMMC module.

make directory "cmupdater" into fat partition.

copy cm-10.1-xxxxxxxx-UNOFFICIAL-odroidu2.zip.



2013년 3월 25일 월요일

GMS apps install without PC for ODROID

Connect USB Keyboard.

1. Download GAPPS from Broswer









http://goo.im/gapps/


ICS

gapps-ics-20120429-signed.zip

JB

gapps-jb-20121011-signed.zip

2. Run File Explorer




3. Unzip by File Explorer app.

  






4. Run Terminal 





5. get Root

#su




6. remount /system patition to rw

#mount -o rw,remount /system


root@android:/sdcard/Download # mount                                           
rootfs / rootfs ro,relatime 0 0                                                 
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0                                
devpts /dev/pts devpts rw,relatime,mode=600 0 0                                 
proc /proc proc rw,relatime 0 0                                                 
sysfs /sys sysfs rw,relatime 0 0                                                
none /acct cgroup rw,relatime,cpuacct 0 0                                       
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0                         
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0                          
none /dev/cpuctl cgroup rw,relatime,cpu 0 0                                     
/dev/block/mmcblk0p2 /system ext4 rw,relatime,barrier=1,data=ordered 0 0        
/dev/block/mmcblk0p3 /data ext4 rw,nosuid,nodev,noatime,barrier=1,nodelalloc,da0
/dev/block/mmcblk0p4 /cache ext4 rw,nosuid,nodev,noatime,barrier=1,nomblk_io_su0
none /proc/bus/usb usbfs rw,relatime,devmode=666 0 0                            
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,rela0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0        
root@android:/sdcard/Download # 

7. cp gapps files


/system/bin/busybox cp -rv /sdcard/Download/gapp-jb-20121011-signed/system/* /system/


8. change permissions


#cd /system/app
#chmod 644 *
#sync
#reboot

9. finish











2013년 1월 28일 월요일

Makefile에서 "-=" 문제

android 4.1.1에서 busybox가 컴파일이 안된다.
문제는 -fno-strict-volatile-bitfields다.
4.2.1에서는 컴파일이 되는데 4.1.1에서는 안된다.

build/core/combo/TARGET_linux-arm.mk


120 # by turning off the builtin sin function.                          
121 ifneq ($(filter 4.6.%, $(shell $(TARGET_CC) --version)),)          
122 TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
123             -fno-strict-volatile-bitfields                                                          
124 endif                                                                  
125        


그래서 저 옵션만 끄면 되것 같아서 아래와 같이 해 보았다.

TARGET_GLOBAL_CFLAGS -= -fno-strict-volatile-bitfields

물론 -=가 될줄 알았는데 안된다.

그래서 할 수 없이 TARGET_GLOBAL_CFLAGS에서 -fno-strict-volatile-bitfields를 없애고 다른 변수를 선언하기로 했다.

TARGET_GLOBAL_CFLAGS2 := $(shell echo $(TARGET_GLOBAL_CFLAGS) | sed 's/-fno-strict-volatile-bitfields/ /g')

2012년 10월 18일 목요일

Navigation Bar에 volume up/down, Shutdown, Screenshot 버튼 넣어보기





Tablet UI에서 back, home. recent app 옆에  volume up/down, Shutdown, Screenshot button을 넣어보자.

먼저 frameworks/base/packages/SystemUI/res/drawable-[h,m,x]dpi/에
ic_sysbar_home.png와 동일한 크기의 
ic_sysbar_plus,png, ic_sysbar_minus.png, ic_sysbar_shutdown.png, ic_sysbar_screenshot.png 이란 이미지를 준비합니다.

frameworks/base/packages/SystemUI/res/layout/navigation_bar.xml 에 recent_apps 다음에 4개의 항목을 추가합니다.

 <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_recent"
                android:layout_weight="0"
                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                android:contentDescription="@string/accessibility_recent"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/vol_plus"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_plus"
                android:layout_weight="0"
                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                android:contentDescription="@string/accessibility_recent"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/vol_minus"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_minus"
                android:layout_weight="0"
                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                android:contentDescription="@string/accessibility_recent"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/shutdown"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_shutdown"
                android:layout_weight="0"
                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                android:contentDescription="@string/accessibility_recent"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/screenshot"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_screenshot"
                android:layout_weight="0"
                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                android:contentDescription="@string/accessibility_recent"
                />

frameworks/base/packages/SystemUI/res/layout-sw600dp/status_bar.xml도 동일하게 수정 합니다.

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java 에서 volume up/down과 shutdown을 구현합니다.


//volume control
import android.media.AudioManager;
//shutdown
import com.android.internal.app.ShutdownThread;
//screenshot
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Messenger;


    ImageView mBackButton;
    View mHomeButton;
    View mMenuButton;
    View mRecentButton;
//버튼 3개 추가
    View mVolPlusButton;
    View mVolMinusButton;
    View mShutdownButton;
    View mScreenshotButton;

    ViewGroup mFeedbackIconArea; // notification icons, IME icon, compat icon
    InputMethodButton mInputMethodSwitchButton;
    CompatModeButton mCompatModeButton;





    // used to notify status bar for suppressing notification LED
    private boolean mPanelSlightlyVisible;

AudioManager mAudioManager;

    public Context getContext() { return mContext; }






        mMenuButton = mNavigationArea.findViewById(R.id.menu);
        mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
        mRecentButton.setOnClickListener(mOnClickListener);
mVolPlusButton = mNavigationArea.findViewById(R.id.vol_plus);
        mVolPlusButton.setOnClickListener(mOnClickListener);
mVolMinusButton = mNavigationArea.findViewById(R.id.vol_minus);
        mVolMinusButton.setOnClickListener(mOnClickListener);
mShutdownButton = mNavigationArea.findViewById(R.id.shutdown);
        mShutdownButton.setOnClickListener(mOnClickListener);

mScreenshotButton = mNavigationArea.findViewById(R.id.screenshot);
        mScreenshotButton.setOnClickListener(mOnClickListener);

        LayoutTransition lt = new LayoutTransition();











        mHomeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
        mRecentButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
        mVolPlusButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
        mVolMinusButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
        mShutdownButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
        mScreenshotButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);

        mInputMethodSwitchButton.setScreenLocked(
                (visibility & StatusBarManager.DISABLE_SYSTEM_INFO) != 0);













    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
        public void onClick(View v) {
if (mAudioManager == null)
mAudioManager = (AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE);
            if (v == mRecentButton) {
                onClickRecentButton();
            } else if (v == mInputMethodSwitchButton) {
                onClickInputMethodSwitchButton();
            } else if (v == mCompatModeButton) {
                onClickCompatModeButton();
            } else if (v == mVolPlusButton) {
mAudioManager.handleKeyDown(KeyEvent.KEYCODE_VOLUME_DOWN, AudioManager.STREAM_MUSIC);
} else if (v == mVolMinusButton) {
mAudioManager.handleKeyDown(KeyEvent.KEYCODE_VOLUME_UP, AudioManager.STREAM_MUSIC);
} else if (v == mShutdownButton) {
ShutdownThread.shutdown(mContext,true);
}

} else if (v == mScreenshotButton) {
takeScreenshot(); 
}
        }
    };

final Object mScreenshotLock = new Object();
    ServiceConnection mScreenshotConnection = null;

    final Runnable mScreenshotTimeout = new Runnable() {
        @Override public void run() {
            synchronized (mScreenshotLock) {
                if (mScreenshotConnection != null) {
                    mContext.unbindService(mScreenshotConnection);
                    mScreenshotConnection = null;
                }
            }
        }
    };

    // Assume this is called from the Handler thread.
    private void takeScreenshot() {
        synchronized (mScreenshotLock) {
            if (mScreenshotConnection != null) {
                return;
            }
            ComponentName cn = new ComponentName("com.android.systemui",
                    "com.android.systemui.screenshot.TakeScreenshotService");
            Intent intent = new Intent();
            intent.setComponent(cn);
            ServiceConnection conn = new ServiceConnection() {
                @Override
                public void onServiceConnected(ComponentName name, IBinder service) {
                    synchronized (mScreenshotLock) {
                        if (mScreenshotConnection != this) {
                            return;
                        }
                        Messenger messenger = new Messenger(service);
                        Message msg = Message.obtain(null, 1);
                        final ServiceConnection myConn = this;
                        Handler h = new Handler(mHandler.getLooper()) {
                            @Override
                            public void handleMessage(Message msg) {
                                synchronized (mScreenshotLock) {
                                    if (mScreenshotConnection == myConn) {
                                        mContext.unbindService(mScreenshotConnection);
                                        mScreenshotConnection = null;
                                        mHandler.removeCallbacks(mScreenshotTimeout);
                                    }
                                }
                            }
                        };
                        msg.replyTo = new Messenger(h);
                        msg.arg1 = msg.arg2 = 0;
                        //if (mStatusBar != null && mStatusBar.isVisibleLw())
                            msg.arg1 = 1;
                        //if (mNavigationBar != null && mNavigationBar.isVisibleLw())
                            msg.arg2 = 1;
                        try {
                            messenger.send(msg);
                        } catch (RemoteException e) {
                        }
                    }
                }
                @Override
                public void onServiceDisconnected(ComponentName name) {}
            };
            if (mContext.bindService(intent, conn, Context.BIND_AUTO_CREATE)) {
                mScreenshotConnection = conn;
                mHandler.postDelayed(mScreenshotTimeout, 10000);
            }
        }

    }