2014년 3월 11일 화요일

dual booting android and Ubuntu on ODROID-U3

Modify the Android source code to work with MTP.

Android 4.1.2

Android Base source
http://dn.odroid.com/4412/Android/4.1.2_Jan-27-2014/BSP/

Last patch
http://dn.odroid.com/4412/Android/4.1.2_Mar-26-2014/BSP/

Download odroidu.zip
https://www.dropbox.com/s/lc981iwno5kth7a/odroidu.zip

unzip and overwrite device/hardkernel/odroidu/ folder

and edit package/app/Utility because MTP android is changed vfat path.

$  svn diff packages/apps/Utility/
Index: packages/apps/Utility/src/com/hardkernel/odroid/MainActivity.java
===================================================================
--- packages/apps/Utility/src/com/hardkernel/odroid/MainActivity.java (리비전 2163)
+++ packages/apps/Utility/src/com/hardkernel/odroid/MainActivity.java (작업 사본)
@@ -20,6 +20,7 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.SharedPreferences;
+import android.os.Environment;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.Menu;
@@ -44,7 +45,7 @@
  public final static String MIN_FREQ_NODE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq";
 
  //private final static String BOOT_INI = "/storage/sdcard1/boot.ini"; //"/mnt/sdcard/boot.ini";
- private final static String BOOT_INI = "/mnt/sdcard/boot.ini";
+ private String BOOT_INI = "/mnt/sdcard/boot.ini";
  public int mCurrentMaxFreq;
  public int mCurrentMinFreq;
 
@@ -371,6 +372,14 @@
  tv.setVisibility(View.GONE);
  }
 
+        File sdcard1 = new File("/storage/sdcard1");
+        if (sdcard1.exists()) {
+            Log.e(TAG, "MTP");
+            BOOT_INI = "/storage/sdcard1/boot.ini";
+        } else {
+            Log.e(TAG, "Mass Storage");
+        }
+
  File boot_ini = new File(BOOT_INI);
  if (boot_ini.exists()) {
  try {



build android for MTP instead of Mass storage.


prepare android rootfs(system.img) for MTP and Ubuntu.

or download system.img

https://drive.google.com/file/d/0B5aZmgmqP9rONjkzbGV2WlpiczQ/edit?usp=sharing
https://www.dropbox.com/s/z875qglex71qh3c/system.img

backup rootfs of Ubuntu.

$ mkdir boot
$ sudo cp -a /media/codewalker/BOOT/* boot/
$ mkdir rootfs
$ sudo cp -a /media/codewalker/rootfs/* rootfs/

edit rootfs/usr/local/sbin/odroid-config

mmcblk0p2 -> mmcblk0p3

 40 do_expand_rootfs() {
 41 
 42   p2_start=`fdisk -l /dev/mmcblk0 | grep mmcblk0p3 | awk '{print $2}'`
 43   fdisk /dev/mmcblk0 <<EOF
 44 p
 45 d
 46 3
 47 n
 48 p
 49 3
 50 $p2_start
 51 
 52 p
 53 w
 54 EOF
 55   ASK_TO_REBOOT=1
 56 
 57   # now set up an init.d script
 58 cat <<\EOF > /etc/init.d/resize2fs_once &&
...
 71 
 72 case "$1" in
 73   start)
 74     log_daemon_msg "Starting resize2fs_once" &&
 75     resize2fs /dev/mmcblk0p3 &&
 76     rm /etc/init.d/resize2fs_once &&
 77     update-rc.d resize2fs_once remove &&
 78     log_end_msg $?
 79     ;;
 80   *)
 81     echo "Usage: $0 start" >&2
 82     exit 3



check u-boot date.

You must use u-boot at least Jan 12 2014 than later.

http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/


OK

U-Boot 2010.12-svn (Jan 27 2014 - 15:07:10) for Exynox4412


CPU: S5PC220 [Samsung SOC on SMP Platform Base on ARM CortexA9]
APLL = 1000MHz, MPLL = 880MHz
DRAM:  2 GiB

PMIC VERSION : 0x00, CHIP REV : 3
TrustZone Enabled BSP
BL1 version: 20121128


Checking Boot Mode ... EMMC4.41                                                 
REVISION: 2.0                                                                   
Manufacturer TOSHIBA [ 7456MB ]                                                 
NAME: S5P_MSHC4                                                                 
MMC Device 0: 7456 MB                                                           
MMC Device 1: 0 MB                                                              
MMC Device 2 not found                                                          
*** Warning - using default environment                                         
                                                                                
USB3503 NINT = OUTPUT LOW!                                                      
ModeKey Check... run normal_boot                                                
No ethernet found.                                                              
Hit any key to stop autoboot:  0                                                
Exynos4412 # 

make new partition table for dual booting.

entry u-boot prompt.

fdisk -c [boot device:0] [system] [userdata] [cache] [vfat]

Exynos4412 #  fdisk -c 0 512 -1 128 300
Count: 10000
NAME: S5P_MSHC4
fdisk is completed

partion #    size(MB)     block start #    block count    partition_Id
   1           306          1462846          626934          0x0C
   2           517           134343         1059817          0x83
   3          6362          2089780        13031271          0x83
   4           131          1194160          268686          0x83
Exynos4412 #

mount eMMC or SD on PC and format.

$ sudo fdisk -l
Disk /dev/sdX: 7818 MB, 7818182656 bytes
253 heads, 59 sectors/track, 1022 cylinders, total 15269888 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdX1         1462846     2089779      313467    c  W95 FAT32 (LBA)
/dev/sdX2          134343     1194159      529908+  83  Linux
/dev/sdX3         2089780    15121050     6515635+  83  Linux
/dev/sdX4         1194160     1462845      134343   83  Linux

Partition table entries are not in disk order

[~]$ sudo mkfs.vfat /dev/sdX1
mkfs.vfat 3.0.16 (01 Mar 2013)
[~]$ sudo mkfs.ext4 /dev/sdX2
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
...
[~]$ sudo mkfs.ext4 /dev/sdX3
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
...
[~]$ sudo mkfs.ext4 /dev/sdX4
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
...

check your partition on gparted.



copy Ubuntu files.

boot -> /dev/sdX1 (fat)
rootfs -> /dev/sdX3 (ext4 userdata partition)

replace current UUID to default UUID.

cat /media/codewalker/5145-2E60/boot.scr

  1 '^E^YVOÚ<9f>7R}->^@^@^A<^@^@^@^@^@^@^@^@^E^?ß9^E^B^F^@boot.scr for X with HDMI auto-pr^@^@^A4^@^@^@^@setenv initrd_high "0xffffffff"
  2 setenv fdt_high "0xffffffff"
  3 setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000 0x42000000"
  4 setenv bootargs "console=tty1 console=ttySAC1,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro  mem=2047M"
  5 boot

$ sudo tune2fs /dev/sdX3 -U e139ce78-9841-40fe-8823-96a304a09859
tune2fs 1.42.8 (20-Jun-2013)

entry u-boot and stop u-boot prompt.

#fastboot

write system.img via fastboot.


$ fastboot flash system system.img
$ fastboot reboot

ODROID-U3 is booted Ubuntu.

run configure


Expand Filesystem and configure HDMI.


open terminal.

Ubuntu -> Android
root@odroid:~# su
root@odroid:~# cd /media/boot/                                                
root@odroid:/media/boot# mv boot.scr  boot.scr.ubuntu




android booting

and run Utility app and make boot.ini.


Android -> Ubuntu
root@android:/ # cd /storage/sdcard1/                                        
root@android:/storage/sdcard1 # mv boot.ini boot.ini.android                      
root@android:/storage/sdcard1 # mv boot.scr.ubuntu boot.scr




open terminal.

Ubuntu -> Android
root@odroid:~# cd /media/boot/                                                
root@odroid:/media/boot# mv boot.scr  boot.scr.ubuntu
root@odroid:/media/boot# mv boot.ini.android  boot.ini


2014년 2월 26일 수요일

How to recovery eMMC u-boot on ODROID

eMMC에 u-boot을 잘 못 fusing하거나 망가져 부팅 할 수 없을 때 복구 방법 또는 다른 제품의 eMMC를 구매 후 사용하는 방법


eMMC의 u-boot 영역은 sd 카드와 달리 PC 상에서 접근 할 수 없습니다.
그래서 eMMC의 u-boot을 복구 하기 위해서는 SD로 부팅 하여 eMMC의 u-boot 영역을 써야 합니다.

eMMC 5.0


3. Exynos5422(ODROD-XU3/4)

http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_3.0_Oct-05-2015/android-4.4.4-alpha-3.0-sd_installer-odroidxu3-20151005.img.zip.md5sum


Windows 사용자는 아래 링크에서 프로그램을 받아 씁니다.

Linux 사용자들은 dd 명령으로 write합니다.
$ sudo dd if=./exynos4412_emmc_recovery_from_sd.img of=/dev/sdX

아래의 사진과 같이 sd 부팅으로 스위치를 바꾸고 전원을 넣으면 자동 복구 합니다.

ODROID-XU4

ODROID-XU3/LITE




수동으로 u-boot만 복구하려면 부팅 후 USB-UART Module Kit을 연결하고 u-boot prompt에서 pri를 입력해 봅니다.

Exynos5410 # pri
baudrate=115200
bootargs=fb_x_res=1280 fb_y_res=720 vout=hdmi led_blink=1
bootcmd=    cfgload;    mmc rescan 0:1; mmc rescan 0:2;    if run loadbootscript_1;         then run bootscript;     else        if run loadbootscript_2;           then run bootscript;        else          ;
bootdelay=1
bootscript=source 40008000
copy_uboot_emmc2sd=emmc open 0;movi r z f 0 40000000;emmc close 0;movi w f 1 40000000;emmc open 0;movi r z b 0 40000000;emmc close 0;movi w b 1 40000000;emmc open 0;movi r z u 0 40000000;emmc close 0;movi w;
copy_uboot_sd2emmc=movi r f 0 40000000;emmc open 1;movi w z f 1 40000000;emmc close 1;movi r b 0 40000000;emmc open 1;movi w z b 1 40000000;emmc close 1;movi r u 0 40000000;emmc open 1;movi w z u 1 40000000;
default_bootcmd=echo >>> Run Default Bootcmd <<<;movi read kernel 0 40008000;bootz 40008000
loadbootscript_1=echo >>> Load Boot Script from mmc 0:1 <<<;fatload mmc 0:1 40008000 boot.scr
loadbootscript_2=echo >>> Load Boot Script from mmc 0:2 <<<;fatload mmc 0:2 40008000 boot.scr
loadbootscript_3=echo >>> Load Boot Script from mmc 1:1 <<<;fatload mmc 1:1 40008000 boot.scr
loadbootscript_4=echo >>> Load Boot Script from mmc 1:2 <<<;fatload mmc 1:2 40008000 boot.scr
rootfslen=100000
stderr=serial
stdin=serial
stdout=serial

Environment size: 1565/16380 bytes
Exynos5410 # 

eMMC를 연결하고 run copy_uboot_sd2emmc 를 입력하면 복구 됩니다.


Exynos5410 # run copy_uboot_sd2emmc
reading FWBL1 ..device 0 Start 1, Count 30 
MMC read: dev # 0, block # 1, count 30 ... 30 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing FWBL1 ..device 1 Start 0, Count 30 
MMC write: dev # 1, block # 0, count 30 ... 30 blocks write: OK
completed
eMMC CLOSE Success.!!
reading BL2 ..device 0 Start 31, Count 32 
MMC read: dev # 0, block # 31, count 32 ... 32 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing BL2 ..device 1 Start 30, Count 32 
MMC write: dev # 1, block # 30, count 32 ... 32 blocks write: OK
completed
eMMC CLOSE Success.!!
reading bootloader..device 0 Start 63, Count 656 
MMC read: dev # 0, block # 63, count 656 ... 656 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing bootloader..device 1 Start 62, Count 656 
MMC write: dev # 1, block # 62, count 656 ... 656 blocks write: OK
completed
eMMC CLOSE Success.!!
reading 0 TrustZone S/W.. Start 719, Count 512 
MMC read: dev # 0, block # 719, count 512 ... 512 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing 1 TrustZone S/W.. Start 718, Count 512 
MMC write: dev # 1, block # 718, count 512 ... 512 blocks write: OK
completed
eMMC CLOSE Success.!!

MMC write: dev # 1, block # 1231, count 32 ... 32 blocks write: OK

Exynos5410 # 


2. Exynos4412(ODROD-X/X2/Q/Q2/U2/U3)

2.1 수동 복구 방법

sd로 부팅 후 u-boot prompt에서 아래와 같이 입력한다.
# movi init 1
# fastboot emmc

PC 터미날에서 android 소스를 풀면 최신 u-boot binaries들이 있습니다.
device/hardkernel/proprietary/uboot/

-rw-r--r-- 1 codewalker codewalker  15360  3월 29  2013 bl1.bin
-rw-r--r-- 1 codewalker codewalker  14592  2월 14 12:43 bl2.bin
-rwxr-xr-x 1 codewalker codewalker    567  2월  3 14:10 emmc_fastboot_fusing.sh
-rw-r--r-- 1 codewalker codewalker   7906  2월  9 14:44 README.TXT
-rwxr-xr-x 1 codewalker codewalker   1240  2월  3 14:10 sd_fusing_4412.sh
-rw-r--r-- 1 codewalker codewalker 159744  3월 29  2013 tzsw.bin
-rw-r--r-- 1 codewalker codewalker 349136  2월 14 12:43 u-boot.bin

또는 github에서 받으시면 됩니다.

아래의 스크립트를 실행하면 자동으로 4개의 bin을 fusing합니다.
$ ./emmc_fastboot_fusing.sh
$ fastboot reboot

ODROID-Q/Q2는 아래 이미지를 받아 sd에 write합니다.
http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/ODROID-Q/d2emmc_installer.img.zip
http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/ODROID-Q2/d2emmc_installer.img.zip

sd를 연결하고 스위치를 사진과 같이 하시면 sd로 부팅이 됩니다. 동일하게 eMMC를 복구 하시면 됩니다.


2.2 자동으로 복구 하기

포럼에 설명이 잘되어 있습니다.
http://forum.odroid.com/viewtopic.php?f=53&t=969

복구용 sd 이미지를 다운 받습니다.
http://forum.odroid.com/download/file.php?id=1089

Windows 사용자는 아래 링크에서 프로그램을 받아 씁니다.
http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=&bid=199
Linux 사용자들은 dd 명령으로 write합니다.
$ sudo dd if=./exynos4412_emmc_recovery_from_sd.img of=/dev/sdX

sd를 꼽고 eMMC를 제거한고 전원을 넣습니다.


U-Boot 2010.12-svn (Jan 12 2014 - 12:55:58) for Exynox4412                      
                                                                                
                                                                                
CPU: S5PC220 [Samsung SOC on SMP Platform Base on ARM CortexA9]                 
APLL = 1000MHz, MPLL = 880MHz                                                   
DRAM:  2 GiB                                                                    
                                                                                
PMIC VERSION : 0x00, CHIP REV : 2                                               
TrustZone Enabled BSP                                                           
BL1 version: 20121128                                                           
                                                                                
                                                                                
Checking Boot Mode ... SDMMC                                                    
MMC Device 0: 7647 MB                                                           
MMC Device 1 not found                                                          
*** Warning - using default environment                                         
                                                                                
USB3503 NINT = OUTPUT LOW!                                                      
ModeKey Check... run normal_boot                                                
No ethernet found.                                                              
Hit any key to stop autoboot:  0                                                
do_fat_cfgload : cmd = fatload mmc 0:1 0x41000000 boot.ini                      
reading boot.ini                                                                
2701 bytes read in 25 ms (105.5 KiB/s)                                          
Find boot.ini file from FAT Area!!                                              
boot.ini command = setenv flag_true                1                            
boot.ini command = setenv flag_false               0                            
boot.ini command = setenv system_memory_end        80000000                     
boot.ini command = setenv emmc_update_from_sdmmc   1                            
boot.ini command = setenv emmc_wait    'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run emmc_wait                                                
Insert eMMC Module before usb connect....

debug 터미날을 보시면 위와 같이 대기 상태로 됩니다.



전원을 넣으면 아래와 같이 전원 Red LED가 켜지고 옆에 ALIVE Blue LED가 깜빡 거립니다.


그럼 eMMC를 연결하고 USB를 연결 하시면 됩니다.
아래와 같이 eMMC를 복구하고 전원이 꺼집니다.



Trigger Detected... read boot.scr form SDMMC & boot 
boot.ini command = setenv movi_init    'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run movi_init
emmc reset...
REVISION: 2.0
Manufacturer TOSHIBA [ 15028MB ]
NAME: S5P_MSHC4
Device: S5P_MSHC4
Manufacturer ID: 11
OEM: 100
Name: 016G9 
Tran Speed: 0
Rd Block Len: 512
MMC version 4.0
High Capacity: Yes
Size: 0MB (block: 15028)
Bus Width: 8-bit DDR
Boot Partition Size: 4096 KB
boot.ini command = setenv update_device_num    1
boot.ini command = setenv load_device_num      0
boot.ini command = setenv load_partition_num   1
boot.ini command = setenv emmc_open    'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run emmc_open;
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
boot.ini command = fatload mmc 0:1 40008000 update/bl1.bin;
reading update/bl1.bin
15360 bytes read in 29 ms (516.6 KiB/s)
boot.ini command = setenv bl1_write    'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run bl1_write
writing FWBL1 ..device 1 Start 0, Count 30 
MMC write: dev # 1, block # 0, count 30 ... 30 blocks written: OK
completed
boot.ini command = fatload mmc 0:1 40008000 update/bl2.bin;
reading update/bl2.bin
14592 bytes read in 32 ms (445.3 KiB/s)
boot.ini command = setenv bl2_write    'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run bl2_write
writing BL2 ..device 1 Start 30, Count 32 
MMC write: dev # 1, block # 30, count 32 ... 32 blocks written: OK
completed
boot.ini command = fatload mmc 0:1 40008000 update/u-boot.bin;
reading update/u-boot.bin
348936 bytes read in 37 ms (9 MiB/s)
boot.ini command = setenv uboot_write  'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run uboot_write
writing bootloader..device 1 Start 62, Count 2048 
MMC write: dev # 1, block # 62, count 2048 ... 2048 blocks written: OK
completed
boot.ini command = fatload mmc 0:1 40008000 update/tzsw.bin;
reading update/tzsw.bin
159744 bytes read in 28 ms (5.4 MiB/s)
boot.ini command = setenv tzsw_write   'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run tzsw_write
writing 1 TrustZone S/W.. Start 2110, Count 312 
MMC write: dev # 1, block # 2110, count 312 ... 312 blocks written: OK
completed
boot.ini command = setenv emmc_close   'if itest.s ${emmc_update_from_sdmmc} -e'
boot.ini command = run emmc_close;
eMMC CLOSE Success.!!
boot.ini command = mmc write 1 0x40008000 0x977 0x20;

MMC write: dev # 1, block # 2423, count 32 ... 32 blocks written: OK

boot.ini command = fastboot poweroff

이후 최신 버전 emmc_self_installer.img를 받아 쓰시면 됩니다.
http://dn.odroid.com/4412/Android/

ODROID-Q/Q2는 최신 버전의 sd2emmc_installer.img로 sd 부팅 하시면 자동으로 eMMC를 복구 합니다.


3. Exynos4412(ODROD-XU)

4.1 복구 방법

아래 링크의 최신 sd 이미지를 받습니다.


위에 설명한 동일한 방법으로 sd에 씁니다.

아래의 사진과 같이 sd 부팅으로 스위치를 바꾸고 전원을 넣으면 자동 복구 합니다.





sd로 부팅 후 u-boot prompt에서 pri를 입력해 봅니다.

Exynos5410 # pri
baudrate=115200
bootargs=fb_x_res=1280 fb_y_res=720 vout=hdmi led_blink=1
bootcmd=    cfgload;    mmc rescan 0:1; mmc rescan 0:2;    if run loadbootscript_1;         then run bootscript;     else        if run loadbootscript_2;           then run bootscript;        else          ;
bootdelay=1
bootscript=source 40008000
copy_uboot_emmc2sd=emmc open 0;movi r z f 0 40000000;emmc close 0;movi w f 1 40000000;emmc open 0;movi r z b 0 40000000;emmc close 0;movi w b 1 40000000;emmc open 0;movi r z u 0 40000000;emmc close 0;movi w;
copy_uboot_sd2emmc=movi r f 0 40000000;emmc open 1;movi w z f 1 40000000;emmc close 1;movi r b 0 40000000;emmc open 1;movi w z b 1 40000000;emmc close 1;movi r u 0 40000000;emmc open 1;movi w z u 1 40000000;
default_bootcmd=echo >>> Run Default Bootcmd <<<;movi read kernel 0 40008000;bootz 40008000
loadbootscript_1=echo >>> Load Boot Script from mmc 0:1 <<<;fatload mmc 0:1 40008000 boot.scr
loadbootscript_2=echo >>> Load Boot Script from mmc 0:2 <<<;fatload mmc 0:2 40008000 boot.scr
loadbootscript_3=echo >>> Load Boot Script from mmc 1:1 <<<;fatload mmc 1:1 40008000 boot.scr
loadbootscript_4=echo >>> Load Boot Script from mmc 1:2 <<<;fatload mmc 1:2 40008000 boot.scr
rootfslen=100000
stderr=serial
stdin=serial
stdout=serial

Environment size: 1565/16380 bytes

Exynos5410 # 

eMMC를 연결하고 run copy_uboot_sd2emmc 를 입력하면 복구 됩니다.



Exynos5410 # run copy_uboot_sd2emmc
reading FWBL1 ..device 0 Start 1, Count 30 
MMC read: dev # 0, block # 1, count 30 ... 30 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing FWBL1 ..device 1 Start 0, Count 30 
MMC write: dev # 1, block # 0, count 30 ... 30 blocks write: OK
completed
eMMC CLOSE Success.!!
reading BL2 ..device 0 Start 31, Count 32 
MMC read: dev # 0, block # 31, count 32 ... 32 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing BL2 ..device 1 Start 30, Count 32 
MMC write: dev # 1, block # 30, count 32 ... 32 blocks write: OK
completed
eMMC CLOSE Success.!!
reading bootloader..device 0 Start 63, Count 656 
MMC read: dev # 0, block # 63, count 656 ... 656 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing bootloader..device 1 Start 62, Count 656 
MMC write: dev # 1, block # 62, count 656 ... 656 blocks write: OK
completed
eMMC CLOSE Success.!!
reading 0 TrustZone S/W.. Start 719, Count 512 
MMC read: dev # 0, block # 719, count 512 ... 512 blocks read: OK
completed
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing 1 TrustZone S/W.. Start 718, Count 512 
MMC write: dev # 1, block # 718, count 512 ... 512 blocks write: OK
completed
eMMC CLOSE Success.!!

MMC write: dev # 1, block # 1231, count 32 ... 32 blocks write: OK


Exynos5410 # 


스위치를 eMMC 부팅으로 바꾸고 부팅 하시면 됩니다.

3.2 자동 복구 방법

http://dn.odroid.com/ODROID-XU/Recovery_0.5/emmc_installer.zip

위에 이미지를 받아 sd에 write하고 sd와 eMMC를 연결 후 sd 부팅하면 자동으로  eMMC의 u-boot이 복구 됩니다.

2014년 2월 18일 화요일

ODROID-U2/U3/X/X2(Exynos4412) update

first recovery.
ODROID-U2/U3
http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/ODROID-U/
ODROID-X2
http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/ODROID-X2/
ODROID-X
http://dn.odroid.com/4412/Android/4.1.2_Feb-12-2014/ODROID-X/


[   ]emmc_self_installer.img.zip12-Feb-2014 13:15146M
[   ]emmc_self_installer.img.zip.md5sum12-Feb-2014 13:1562
[   ]sd_self_installer.img.zip12-Feb-2014 13:15146M
[   ]sd_self_installer.img.zip.md5sum12-Feb-2014 13:1560

Windows users


Linux users

$ unzip sd[emmc]_self_installer.img.zip
$ sudo fdisk -l
$ sudo dd if=./sd[emmc]_self_installer.img of=/dev/sdX

Update complete.
Run ODROID Updater.

ODROID-U2/U3
Input URL http://dn.odroid.com/4412/Android/4.1.2_Feb-19-2014/ODROID-U/update.zip

ODROID-X
Input URL http://dn.odroid.com/4412/Android/4.1.2_Feb-19-2014/ODROID-X/update.zip

ODROID-X2
Input URL http://dn.odroid.com/4412/Android/4.1.2_Feb-19-2014/ODROID-X2/update.zip



If you run flappy bird in Landscape mode then app run like this picture.
Mouse worked well, but multitouch screen do not work.


HDMI Portrait screen and HID multitouch.
Run ODROID Utility app.
Select HDMI Portrait and apply. Reboot.


Boot complete, automatically rotate screen to portrait.



Install Google Mobile Service apps.


2014년 2월 13일 목요일

ODROID에 EXT4 외장 저장장치 사용하기(Use external storage fomatted Ext filesystem on ODROID)

ODROID에 microSD(SD)와 USB 이동식 저장 장치를 지원합니다.

지원되는 파일시스템이 fat32와 NTFS를 지원합니다.
fat에는 4Gbyte 이상의 파일을 넣을 수 없는 문제가 있습니다.
NTFS는 4Gbyte이상의 파일을 넣을 수 있지만 readonly로만 mount 되고 불안전 합니다.
그래서 Ext4 파일 시스템을 지원해 보겠습니다.

system/vold/Volume.h/cpp를 아래와 같이 Ext4를 추가 합니다.

 50 protected:
 51     char *mLabel;
 52     char *mMountpoint;
 53     VolumeManager *mVm;                                                                              
 54     bool mDebug;
 55     int mPartIdx;
 56     int mOrigPartIdx;                                                                                
 57     bool mRetryMount;                                                                                
 58     int filesystem;                                                                                  
 59    

 46 #include "Fat.h"
 47 #include "Ntfs.h"
 48 #include "Ext4.h"
 49 #include "Process.h"
 50 #include "cryptfs.h"

260     if (filesystem == VFAT) {
261         if (Fat::format(devicePath, 0)) {
262             SLOGE("Failed to format (%s)", strerror(errno));
263             goto err;
264         }
265     } else if (filesystem == EXT4) {
266         if (Ext4::format(devicePath)) {
267             SLOGE("Failed to format (%s)", strerror(errno));
268             goto err;
269         }
270     }

403     filesystem = VFAT;
404 
405     for (i = 0; i < n; i++) {
406         char devicePath[255];
407 
408         sprintf(devicePath, "/dev/block/vold/%d:%d", MAJOR(deviceNodes[i]),
409                 MINOR(deviceNodes[i]));
410 
411         SLOGI("%s being considered for volume %s\n", devicePath, getLabel());
412 
413         errno = 0;
414         setState(Volume::State_Checking);
415 
416         if (Fat::check(devicePath)) {
417             if (errno == ENODATA) {
418                 SLOGW("%s does not contain a FAT filesystem\n", devicePath);
419                 if (Ntfs::doMount(devicePath, getMountpoint(), false, false, false,
420                     1000, 1015, 0702, false)) {
421                     SLOGE("%s failed to mount via NTFS (%s)\n", devicePath, strerror(errno));
422                     if (Ext4::doMount(devicePath, getMountpoint(), false, false, false)) {
423                         SLOGE("%s failed to mount via Ext4 (%s)\n", devicePath, strerror(errno));
424                     } else {
425                         filesystem = EXT4;
426                         SLOGE("Ext4 mounted");
427                         continue;
428                     }
429                 } else {
430                     filesystem = NTFS;
431                     SLOGE("NTFS mounted");
432                     continue;
433                 }
434             }

ubuntu PC에서 SD Card나 USB Storage를 Ext4로 format하시고 아래와 같이 권한을 변경해 주세요.

sudo nautilus로 실행하시면 됩니다.




2014년 1월 28일 화요일

How to connect ODROID to Ubuntu using MTP

How to connect ODROID to Ubuntu using MTP


http://ppa.webupd8.org/post/43022082410/libmtp-updated-for-ubuntu-quantal-and-precise-with

1. install go-mtpfs and go-mtpfs-unity


http://www.webupd8.org/2012/12/how-to-mount-android-40-ubuntu-go-mtpfs.html

https://launchpad.net/~webupd8team/+archive/unstable/+build/4074768

https://launchpad.net/~webupd8team/+archive/unstable/+build/4074769

https://drive.google.com/file/d/0B5aZmgmqP9rOVGV6aXc5RW8xWkk/edit?usp=sharing
https://drive.google.com/file/d/0B5aZmgmqP9rOblZZWmJENjZQUjg/edit?usp=sharing
https://drive.google.com/file/d/0B5aZmgmqP9rOVjVtSjBTNnNBeDA/edit?usp=sharing

http://almost-a-technocrat.blogspot.kr/2013/01/how-to-connect-samsung-galaxy-nexus-to.html

2. mkdir /media/MyAndroid

3. create /etc/udev/rules.d/99-android.rules

  1 # Hardkernel Odroid MTP mode (multimedia device)
  2 SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="0002", MODE="0666" # MTP media
  3
  4 # Hardkernel Odroid MTP mode : automatic mount when plugged (all android versions)
  5 ENV{ID_MODEL}=="Odroid", ENV{ID_MODEL_ID}=="0002", ACTION=="add", RUN+="/usr/bin/sudo -b -u codewalker /usr/bin/go-mtpfs -allow-other=true /media/MyAndroid"
  6
  7 # Hardkernel Odroid MTP mode : automatic unmount when unplugged (all android versions)
  8 ENV{ID_MODEL}=="Odroid", ENV{ID_MODEL_ID}=="0002", ACTION=="remove", RUN+="/bin/fusermount -u /media/MyAndroid"

4. sudo service udev restart

5. remove other mtp device

We will release android supported MTP soon.

2014년 1월 24일 금요일

cm(android-4.2.1) on ODROID-U2/U3

eMMC recovery tool for ODROID-U2/U3

http://forum.odroid.com/viewtopic.php?f=53&t=969

How to use.
1. Prepare a microSD card and flash the attached image.
2. Boot with the microSD without eMMC
3. Turn on U2/U3 and wait a few seconds and blue LED will blink.
4. Plug your eMMC module into U2/U3
5. Plug micro-USB cable into U2/U3 and connect other side to your PC USB host or ODROID's USB host port. (This is a trigger to start the recovery)
6. After recovery process (only a few seconds), the blue LED will turn off automatically.
7. Finish. Install OS on your eMMC with as usual.


Install CM for odroid-u2/u3

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

$ sh ./install-emmc.sh /dev/sdX


2013년 12월 22일 일요일

USB vid/pid를 이용해서 장치 연결 상태 알아내기

USB 장치 중에 vid가 0bda이고 pid가 8176인 장치가 연결되어 있는지 알아 보는 방법입니다.

USB node는 /sys/bus/usb/devices/ 에 생성되고 idVendoridProuct를 읽어보면 됩니다.

{
    DIR *dir = opendir("/sys/bus/usb/devices/");
    struct dirent *dent;
    if (dir != NULL) {
        while ((dent = readdir(dir)) != NULL) {
            char node[50] = {'\0',};
            sprintf(node, "/sys/bus/usb/devices/%s/idVendor", dent->d_name);
            int vid_fd = open(node, O_RDONLY);
            char buf[5];
            if (vid_fd > 0) {
                read(vid_fd, buf, 4);
                ALOGE("node = %s, vid = %s", node, buf);
                if (strcmp(buf, "0bda") == 0) {
                    sprintf(node, "/sys/bus/usb/devices/%s/idProduct", dent->d_name);
                    int pid_fd = open(node, O_RDONLY);
                    read(pid_fd, buf, 4);
                    ALOGE("node = %s, pid = %s", node, buf);
                    if (pid_fd > 0) {
                        if (strcmp(buf, "8176") == 0) {
                            //pid가 8176인 장치가 연결되어 있음
                            break;
                        }
                        close(pid_fd);
                    }  
                }  
                close(vid_fd);
            }  
        }  
    }  
    close(dir);
}