레이블이 dual booting인 게시물을 표시합니다. 모든 게시물 표시
레이블이 dual booting인 게시물을 표시합니다. 모든 게시물 표시

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

2016년 3월 3일 목요일

dual booting android and Ubuntu on ODROID-C2



I made dual booting image for ODROID-U3.
http://codewalkerster.blogspot.kr/2014/03/dual-booting-android-and-ubuntu-on.html?m=1

We will make dual booting image for ODROID-C2.

Make bootable android media(eMMC or SD).

http://odroid.com/dokuwiki/doku.php?id=en:c2_release_android

Download ODROID-C2 Ubuntu Image.

http://odroid.com/dokuwiki/doku.php?id=en:c2_release_linux_ubuntu



Copy rootfs and boot partition of ODROID-C2 Ubuntu to your desktop Ubuntu.

- mount disk wrote ODROID-C2 ubuntu image on your desktop PC.

c2/ubuntu/ubuntu64-16.04lts-mate-od* on /media/codewalker/boot type vfat (ro,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
c2/ubuntu/ubuntu64-16.04lts-mate-od* on /media/codewalker/rootfs type ext4 (ro,nosuid,nodev,uhelper=udisks2)


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

- unmount ubuntu disk.


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/sdX4.
$ sudo umount /dev/sdX4
$ 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/sdX4 -U e139ce78-9841-40fe-8823-96a304a09859

Copy ODROID-C2 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

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