====== Android ======
This page introduce how you can download and compile the Android kernel for **ODROID-XU3/XU4**. \\
You need use **gcc version 4.6** to build the Exynos-5422 Android Kernel.
If you have not built Android on your desktop yet, please read Android's official build environment set up guide [[https://source.android.com/source/initializing.html]] carefully before your proceed. Otherwise, you would have unexpected errors and exhaust to read quite long and complicated build log to find the problem.\\
We've used Ubuntu 14.04 64bit with 8GB RAM since other newer versions had some issues while building the Android OS. \\
http://source.android.com/source/requirements.html#hardware-requirements
If you want to build full Android source tree, don't download & build the kernel source separately. \\
Separated Kernel build might break the Android build process. \\
===== Toolchain =====
Click one of the site to download toolchain to build Linux kernel.
* [[http://dn.odroid.com/ODROID-XU/compiler/arm-eabi-4.6.tar.gz|Download Linux Kernel Toolchain(arm-eabi-4.6)]]
Once the download is done, extract the tarball to **/opt/toolchains/**.
$ sudo mkdir -p /opt/toolchains
$ sudo tar xvfz arm-eabi-4.6.tar.gz -C /opt/toolchains/
In order to add the toolchain path to PATH, paste below lines to **$HOME/.bashrc**.
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=/opt/toolchains/arm-eabi-4.6/bin:$PATH
You can apply the change if you login again or import
to apply this change, login again or evaluate **$HOME/.bashrc** with source command.
$ source ~/.bashrc
You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find **gcc version 4.6.x-google** at the end of the line, the toolchain is well installed.
$ arm-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-eabi-gcc
COLLECT_LTO_WRAPPER=/opt/toolchain/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/lto-wrapper
Target: arm-eabi
Configured with: /tmp/android-15472/src/build/../gcc/gcc-4.6/configure --prefix=/usr/local --target=arm-eabi --host=x86_64-linux-gnu
--build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/tmp/android-15472/obj/temp-install --with-
mpfr=/tmp/android-15472/obj/temp-install --with-mpc=/tmp/android-15472/obj/temp-install --without-ppl --without-cloog --disable-libs
sp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-
shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-abi=aapcs
--with-gcc-version=4.6 --with-binutils-version=2.21 --with-gmp-version=4.2.4 --with-mpfr-version=2.4.1 --with-gdb-version=7.3.x --w
ith-arch=armv5te --with-sysroot=/tmp/android-15472/install/sysroot --with-prefix=/tmp/android-15472/install --with-gold-version=2.21
--enable-gold --disable-gold --disable-multilib --program-transform-name='s&^&arm-eabi-&'
Thread model: single
gcc version 4.6.x-google 20120106 (prerelease) (GCC)
===== Checkout =====
You can checkout **Kernel** source tree from **[[https://github.com/hardkernel/linux|Hardkernel's Github]]**, **Android platform** source tree from **[[https://github.com/hardkernel/android|Hardkernel's Github]]**.
Please note that we distribute the Linux kernel in different branches for Android and other Linux distributions.
==== Android Kernel ====
$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidxu3-3.10.y-android
$ cd linux
==== Android Platform ====
$ mkdir
$ cd
$ repo init -u https://github.com/hardkernel/android.git -b 5422_4.4.4_master
$ repo sync
$ repo start 5422_4.4.4_master --all
* Visit this link to install the repo.
[[http://source.android.com/source/downloading.html]]
* Downloaded Android full source code size is around 58GB. Prepare enough space before building the Android platform.
===== Compile =====
Before compiling, you must configure for **ODROID-XU3** with following command.
==== Android Kernel ====
$ make odroidxu3_defconfig
$ make
Then you can start to build Linux kernel image, **zImage-dtb**.
This will create **arch/arm/boot/zImage-dtb**. You can also add **-j** option for fast compile.
==== Android Platform ====
$ ./build.sh odroidxu3
Once you complete the long build process, the img files can be found in "out/target/product/odroidxu3/update" directory.
===== adb over TCPIP (Ethernet port) =====
==== device console ====
Get device's IP.
eth0 -> adb over Ethernet.
wlan0 -> adb over Wi-Fi.
shell@odroidxu3:/ $ su
root@odroidxu3:/ # netcfg
lo UP 127.0.0.1/8 0x00000049 00:00:000
eth0 UP 192.168.30.45/24 0x00001043 fa:e2:864
sit0 DOWN 0.0.0.0/0 0x00000080 00:00:000
ip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:000
root@odroidxu3:/ #
==== desktop console ====
[~]$ ping 192.168.30.45
PING 192.168.30.45 (192.168.30.45) 56(84) bytes of data.
64 bytes from 192.168.30.45: icmp_seq=1 ttl=64 time=1.56 ms
64 bytes from 192.168.30.45: icmp_seq=2 ttl=64 time=0.756 ms
64 bytes from 192.168.30.45: icmp_seq=3 ttl=64 time=0.718 ms
64 bytes from 192.168.30.45: icmp_seq=4 ttl=64 time=0.850 ms
^C
--- 192.168.30.45 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.718/0.971/1.561/0.344 ms
==== desktop console ====
[~]$ adb connect 192.168.30.45
connected to 192.168.30.45:5555
[~]$ adb -s 192.168.30.45:5555 logcat
--------- beginning of /dev/log/main
I/installd( 2785): installd firing up
I/DEBUG ( 2780): debuggerd: Jul 2 2015 14:27:22
I/Netd ( 2779): Netd 1.0 starting
W/InterfaceController( 2779): Warning (dlopen failed: library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library
--------- beginning of /dev/log/system
I/Vold ( 2774): Vold 2.1 (the revenge) firing up
E/Vold ( 2774): boot_mode = 0
E/Vold ( 2774): eMMC boot_mode
D/Vold ( 2774): Volume sdcard0 state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 2774): Volume sdcard1 state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 2774): Volume usb2host state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 2774): Volume usb3host state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 2774): Volume usb3device state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 2774): Volume sdcard0 state changing 0 (No-Media) -> 1 (Idle-Unmounted)
W/Vold ( 2774): Duplicate state (1)
W/Vold ( 2774): Duplicate state (1)
===== Installation =====
==== XU3/XU3-Lite ====
There are different instructions to install Linux kernel image for Android and Linux. Since Android loads both from a kernel partition, we have to use **fastboot** to install into the dedicated partition. Please refer the partition table from [[http://odroid.com/dokuwiki/doku.php?id=en:xu3_partition_table|here]]. In contrast, Linux boots by the instructions described in **boot.ini** the 1st FAT partition.
This is the instruction to install kernel image, **zImage-dtb**, to the boot card.
$ sudo fastboot flash kernel
This is to install android platform files, **system.img**, **userdata.img**, **cache.img**.
$ sudo fastboot flash system
$ sudo fastboot flash userdata
$ sudo fastboot flash cache
Use this command to initialize the FAT partition.
$ sudo fatboot erase fat
==== XU4 ====
How to write images without fastboot on ODROID-XU4(android)
You can not use fastboot on ODROID-XU4, because It doesn't have USB otg port.
First! setup adb connection or copy image to fat partition.
Push image to fat partition.
$ adb push xxxx.img /storage/sdcard0/
$ adb reboot
Enter u-boot prompt with USB-UART kit connection.
U-Boot 2012.07-00029-g0e9204d-dirty (Jul 17 2015 - 15:38:42) for Exynos5422
CPU: Exynos5422 Rev0.1 [Samsung SOC on SMP Platform Base on ARM CortexA7]
APLL = 800MHz, KPLL = 800MHz
MPLL = 532MHz, BPLL = 825MHz
Board: HardKernel ODROID
DRAM: 2 GiB
WARNING: Caches not enabled
TrustZone Enabled BSP
BL1 version: �/� ⁁
VDD_KFC: 0x44
LDO19: 0xf2
Checking Boot Mode ... SDMMC
MMC: S5P_MSHC2: 0, S5P_MSHC0: 1
MMC Device 0: 7.4 GiB
MMC Device 1: [ERROR] response timeout error : 00000104 cmd 1
Card did not respond to voltage select!
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Double Press 'Enter' to stop autoboot: 0
Exynos5422 #
Example for zImage-dtb
Exynos5422 # fatload mmc 0:1 40008000 zImage-dtb
there are pending interrupts 0x00000001
reading zImage-dtb
4718814 bytes read
Exynos5422 # movi write kernel 0 40008000
writing kernel..device 0 Start 1263, Count 16384
MMC write: dev # 0, block # 1263, count 16384 ... 16384 blocks write: OK
completed
Exynos5422 #
Example for system.img
Exynos5422 # fatload mmc 0:1 40000000 system.img
there are pending interrupts 0x00000001
reading system.img
355139392 bytes read
Exynos5422 # fastboot flash system 40000000 0
[Partition table on MoviNAND]
ptn 0 name='fwbl1' start=0x0 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=0x800000(~8192KB) (use hard-coded info. (cmd)
ptn 6 name='system' start=0x42B5800 len=0x40648800(~1055010KB)
ptn 7 name='userdata' start=0x448FE000 len=0x80527800(~2102430KB)
ptn 8 name='cache' start=0xC4E25800 len=0x1036C800(~265650KB)
ptn 9 name='fat' start=0xD5192000 len=0x1002E5800(~4197270KB)
flashing 'system'
Compressed ext4 image
*** erase start block 0x215ac ***
*** erase block length 0x202ff0 ***
mmc erase user 0 21800 202c00
MMC erase: dev # 0, block # 137216, count 2108416 ... START: 137216 BLOCK: 21086
high_capacity: 1
Capacity: 2
byte_addressing
before_send_cmd
start_addr
end_addr
erase_addr
Erase
........................................
........................................
........................................
........................................
........................................
..........
1.0 GB erase Done
2108416 blocks erase: OK
MMC write: dev # 0, block # 136620, count 8 ... 8 blocks write: OK
MMC write: dev # 0, block # 136628, count 8 ... 8 blocks write: OK
MMC write: dev # 0, block # 136636, count 504 ... 504 blocks write: OK
......
.....
You can find other command to write image in this boot.ini files.
boot.ini for eMMC
#------------------------------------------------------------------------------------------------------
#
# EMMC to EMMC Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
emmc open 0
movi w z f 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
emmc open 0
movi w z b 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
emmc open 0
movi w z u 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
emmc open 0
movi w z t 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 0 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 0 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 0
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 0
fastboot flash userdata 57000000 0
fastboot flash cache 61000000 0
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
fatformat mmc 0:1
reset
boot.ini for SD
#------------------------------------------------------------------------------------------------------
#
# SD to SD Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
movi w f 0 40008000
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
movi w b 0 40008000
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
movi w u 0 40008000
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
movi w t 0 40008000
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 0 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 0 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 0
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 0
fastboot flash userdata 57000000 0
fastboot flash cache 61000000 0
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
fatformat mmc 0:1
reset
boot.ini for SD to eMMC
#------------------------------------------------------------------------------------------------------
#
# EMMC to EMMC Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
emmc open 1
movi w z f 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
emmc open 1
movi w z b 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
emmc open 1
movi w z u 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
emmc open 1
movi w z t 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 1 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 1 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 1
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 1
fastboot flash userdata 57000000 1
fastboot flash cache 61000000 1
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
mmcinfo 1
fatformat mmc 1:1
fastboot poweroff
==== ODROID Updater ====
Disable 'Validate file' button.
{{http://dn.odroid.com/homebackup/Screenshot_2015-07-08-10-11-43.png?500|}}
$ adb connect 192.168.x.x
$ cd out/target/products/odroidxu3/
$ adb push update.zip /storage/sdcard0/
$ adb push update.zip.md5sum /storage/sdcard0/
Now enable 'Validate file' button.
{{http://dn.odroid.com/homebackup/Screenshot_2015-07-27-10-30-15.png?500|}}
===== Storage Information =====
| path | device | storage name |
| /storage/sdcard0 | fat partition of eMMC or microSD | INTERNAL STORAGE |
| /storage/sdcard1 | microSD slot | SD CARD |
| /storage/usb2host | USB 2.0 Host port | USB STORAGE |
| /storage/usb3host | USB 3.0 Host port | USB STORAGE |
| /storage/usb3device | USB 3.0 Device port | USB STORAGE |
===== How to make release image =====
Make a directory.
$ mkdir emmc
$ cd emmc
Make boot.ini file
#------------------------------------------------------------------------------------------------------
#
# EMMC to EMMC Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
emmc open 0
movi w z f 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
emmc open 0
movi w z b 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
emmc open 0
movi w z u 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
emmc open 0
movi w z t 0 40008000
emmc close 0
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 0 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 0 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 0
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 0
fastboot flash userdata 57000000 0
fastboot flash cache 61000000 0
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
fatformat mmc 0:1
reset
$ mkdir sd
$ cd sd
Make boot.ini file
#------------------------------------------------------------------------------------------------------
#
# SD to SD Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
movi w f 0 40008000
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
movi w b 0 40008000
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
movi w u 0 40008000
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
movi w t 0 40008000
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 0 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 0 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 0
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 0
fastboot flash userdata 57000000 0
fastboot flash cache 61000000 0
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
fatformat mmc 0:1
reset
$ mkdir sd2emmc
$ cd sd2emmd
Make boot.ini file
#------------------------------------------------------------------------------------------------------
#
# SD to EMMC Recovery boot.ini text file
#
#------------------------------------------------------------------------------------------------------
ODROIDXU-UBOOT-CONFIG
#------------------------------------------------------------------------------------------------------
# BL1 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl1.bin
emmc open 1
movi w z f 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# BL2 write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 bl2.bin
emmc open 1
movi w z b 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# Bootloader write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 u-boot.bin
emmc open 1
movi w z u 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# Turst Zone Soft Ware write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 tzsw.bin
emmc open 1
movi w z t 1 40008000
emmc close 1
#------------------------------------------------------------------------------------------------------
# UBOOT ENV Erase
#------------------------------------------------------------------------------------------------------
mmc write 1 40008000 0x4CF 0x20
#------------------------------------------------------------------------------------------------------
# Kernel Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40008000 zImage-dtb
movi write kernel 1 40008000
#------------------------------------------------------------------------------------------------------
# System Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 40000000 system.img
#------------------------------------------------------------------------------------------------------
# Userdata Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 57000000 userdata.img
#------------------------------------------------------------------------------------------------------
# Cache Image write to eMMC
#------------------------------------------------------------------------------------------------------
fatload mmc 0:1 61000000 cache.img
#------------------------------------------------------------------------------------------------------
# Partition Create to eMMC
#------------------------------------------------------------------------------------------------------
fdisk -c 1
#------------------------------------------------------------------------------------------------------
fastboot flash system 40000000 1
fastboot flash userdata 57000000 1
fastboot flash cache 61000000 1
#------------------------------------------------------------------------------------------------------
# SD/eMMC FAT Format
#------------------------------------------------------------------------------------------------------
fatformat mmc 1:1
fastboot poweroff
$ sudo mkdir /media/[username]/fat32
Copy update.zip and unzip update.zip
$ cp out/target/product/odroidxu3/update.zip .
$ unzip update.zip
$ ls update
bl1.bin bl2.bin cache.img ramdisk.img system.img tzsw.bin u-boot.bin userdata.img zImage zImage-dtb
Copy uboot directory.
$ cp -a device/hardkernel/odroidxu3/uboot .
$ ls
emmc sd sd2emmc uboot update update.zip
Run script
#!/bin/bash
sudo umount /media/[username]/fat32
sudo losetup -d /dev/loop0
# make image of loop devices filled zero.
echo "dd if=/dev/zero of=./installer.img count=1024000"
dd if=/dev/zero of=./installer.img count=1024000
# mount loop devices.
echo "sudo losetup /dev/loop0 installer.img"
sudo losetup /dev/loop0 installer.img
# create partition table.
echo "sudo parted /dev/loop0 mktable msdos"
sudo parted /dev/loop0 mktable msdos
# make file-system.
echo "sudo parted /dev/loop0 mkpart primary fat32 105 525"
sudo parted /dev/loop0 mkpart primary fat32 90 525
# format file-system.
echo "sudo mkfs.vfat -F 32 /dev/loop0p1"
sudo mkfs.vfat -F 32 /dev/loop0p1
# fusing u-boot.
echo "pushd uboot"
pushd uboot
echo "./sd_fusing.sh /dev/loop0"
sudo ./sd_fusing.sh /dev/loop0
echo "popd"
popd
# mount user fat partition.
echo "sudo mount /dev/loop0p1 /media/[username]/fat32/"
sudo mount /dev/loop0p1 /media/[username]/fat32/
# copy android images and u-boot binaries.
echo "sudo cp update/* /media/[username]/fat32/"
sudo cp update/* /media/[username]/fat32/
# eMMC
# copy script for eMMC.
echo "sudo cp emmc/boot.ini /media/[username]/fat32/"
sudo cp emmc/boot.ini /media/[username]/fat32/
echo "sudo umount /media/[username]/fat32"
sleep 3
sudo umount /media/[username]/fat32
# dump binary
echo "sudo dd if=/dev/loop0 of=emmc/self-emmc.img count=1024000"
sudo dd if=/dev/loop0 of=emmc/self-emmc.img count=1024000
# SD
# copy script for SD.
echo "sudo mount /dev/loop0p1 /media/[username]/fat32/"
sudo mount /dev/loop0p1 /media/[username]/fat32/
echo "sudo cp sd/boot.ini /media/[username]/fat32/"
sudo cp sd/boot.ini /media/[username]/fat32/
echo "sudo umount /media/[username]/fat32"
sleep 3
sudo umount /media/[username]/fat32
# dump binary
echo "sudo dd if=/dev/loop0 of=sd/self-sd.img count=1024000"
sudo dd if=/dev/loop0 of=sd/self-sd.img count=1024000
# SD to eMMC
# copy script for SD to eMMC.
echo "sudo mount /dev/loop0p1 /media/[username]/fat32/"
sudo mount /dev/loop0p1 /media/[username]/fat32/
echo "sudo cp sd2emmc/boot.ini /media/[username]/fat32/"
sudo cp sd2emmc/boot.ini /media/[username]/fat32/
echo "sudo umount /media/[username]/fat32"
sleep 3
sudo umount /media/[username]/fat32
# dump binary
echo "sudo dd if=/dev/loop0 of=sd2emmc/sd2emmc.img count=1024000"
sudo dd if=/dev/loop0 of=sd2emmc/sd2emmc.img count=1024000
# umount loop device.
echo "sudo losetup -d /dev/loop0"
sudo losetup -d /dev/loop0