2014년 3월 14일 금요일

How to write zImage via dd command.

write zImage via fastboot flash kernel ./zImage

ODROID-U2/U3/X/X2/Q/Q2

downloading of 3481036 bytes finished                                        
flashing 'kernel'                                                            
writing kernel..device 0 Start 2455, Count 16384                              
MMC write: dev # 0, block # 2455, count 16384 ... 16384 blocks written: OK    
completed                                                                    
partition 'kernel' flashed                                                    
resetting ...                                                                
reset...

kernel start sector 2455

ODROID-XU
Exynos5410 #   fastboot                                                      
there are pending interrupts 0x00000001                                      
[Partition table on MoviNAND]                                                
ptn 0 name='fwbl1' start=0x8 len=N/A (use hard-coded info. (cmd: movi))      
ptn 1 name='bl2' start=N/A len=N/A (use hard-coded info. (cmd: movi))        
ptn 2 name='bootloader' start=N/A len=N/A (use hard-coded info. (cmd: movi))  
ptn 3 name='tzsw' start=N/A len=N/A (use hard-coded info. (cmd: movi))        
ptn 4 name='kernel' start=N/A len=N/A (use hard-coded info. (cmd: movi))      
ptn 5 name='ramdisk' start=N/A len=0x4000(~16777216KB) (use hard-coded info. (c)
ptn 6 name='system' start=0x4000000 len=0x100000(~1073741824KB)              
ptn 7 name='userdata' start=0x44000000 len=0x200000(~-2147483648KB)          
ptn 8 name='cache' start=0xC4000000 len=0x40000(~268435456KB)                
ptn 9 name='fat' start=0xD4000000 len=0xB4D000(~-750780416KB)                
USB cable Connected![0x4]                                                    
..                                                                            
downloading of 5440448 bytes finished                                        
flashing 'kernel'                                                            
writing kernel..device 0 Start 1263, Count 16384                              
MMC write: dev # 0, block # 1263, count 16384 ... 16384 blocks write: OK      
completed                                                                    
partition 'kernel' flashed        

kernel start sector 1263                                          


If you want to update kernel. run terminal emulator app.

1|root@android:/sdcard/update # dd if=./zImage of=/dev/block/mmcblk0 seek=2455
6797+1 records in                                                            
6797+1 records out                                                            
3480080 bytes transferred in 1.017 secs (3421907 bytes/sec)                  
root@android:/sdcard/update #


check your kernel wrote via dd.
root@android:/ # uname -a                                                    
Linux localhost 3.0.51 #1 SMP Tue Feb 18 10:52:27 KST 2014 armv7l GNU/Linux  
root@android:/ #



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