2015년 4월 10일 금요일

WiringPi on ODROID-C1(Android)

WiringPi on ODROID-C1(Android)



ODROID-C1 Ubuntu에서 Raspberry Pi에서 사용되는 WiringPi를 사용할 수 있도록 porting 하였습니다.

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

wiringPi를 사용한 example-led 예제를 Android 에서도 사용할 수 있도록 작업을 해 보았습니다.

먼저 소스를 다운 받습니다.

git clone https://github.com/codewalkerster/example-led

다운 받은 소스를 eclipse에서 import 시킵니다.


그리고 NDK를 이용하여 wiringPi를 build합니다.

$ cd example-led/jni
$ ndk-build
Android NDK: WARNING: APP_PLATFORM android-16 is larger than android:minSdkVersion 7 in /media/codewalker/92fc070a-3bc1-43e0-af27-03d08ba9dd3e/home/codewalker/workspace/xxxx/example-led/AndroidManifest.xml  
[armeabi] Compile thumb  : wiringPi <= wiringPi.c
/media/codewalker/92fc070a-3bc1-43e0-af27-03d08ba9dd3e/home/codewalker/workspace/xxxx/example-led/jni/wiringPi/wiringPi.c:147:0: warning: "PAGE_SIZE" redefined [enabled by default]
 #define PAGE_SIZE   (4*1024)
 ^
In file included from /home/codewalker/projects/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/signal.h:34:0,
                 from /home/codewalker/projects/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/poll.h:34,
                 from /media/codewalker/92fc070a-3bc1-43e0-af27-03d08ba9dd3e/home/codewalker/workspace/xxxx/example-led/jni/wiringPi/wiringPi.c:59:
/home/codewalker/projects/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/limits.h:119:0: note: this is the location of the previous definition
 #define PAGE_SIZE 4096
 ^
/media/codewalker/92fc070a-3bc1-43e0-af27-03d08ba9dd3e/home/codewalker/workspace/xxxx/example-led/jni/wiringPi/wiringPi.c: In function 'interruptHandler':
/media/codewalker/92fc070a-3bc1-43e0-af27-03d08ba9dd3e/home/codewalker/workspace/xxxx/example-led/jni/wiringPi/wiringPi.c:1865:7: warning: return makes pointer from integer without a cast [enabled by default]
       return wiringPiFailure (WPI_FATAL, "wiringPiISR: wiringPi has not been initialised. Unable to continue.\n") ;
       ^
[armeabi] Compile thumb  : wiringPi <= wiringShift.c
[armeabi] Compile thumb  : wiringPi <= piHiPri.c
[armeabi] Compile thumb  : wiringPi <= piThread.c
[armeabi] Compile thumb  : wiringPi <= wiringPiSPI.c
[armeabi] Compile thumb  : wiringPi <= wiringPiI2C.c
[armeabi] Compile thumb  : wiringPi <= softPwm.c
[armeabi] Compile thumb  : wiringPi <= softTone.c
[armeabi] Compile thumb  : wiringPi <= mcp23008.c
[armeabi] Compile thumb  : wiringPi <= mcp23016.c
[armeabi] Compile thumb  : wiringPi <= mcp23017.c
[armeabi] Compile thumb  : wiringPi <= mcp23s08.c
[armeabi] Compile thumb  : wiringPi <= mcp23s17.c
[armeabi] Compile thumb  : wiringPi <= sr595.c
[armeabi] Compile thumb  : wiringPi <= pcf8574.c
[armeabi] Compile thumb  : wiringPi <= pcf8591.c
[armeabi] Compile thumb  : wiringPi <= mcp3002.c
[armeabi] Compile thumb  : wiringPi <= mcp3004.c
[armeabi] Compile thumb  : wiringPi <= mcp4802.c
[armeabi] Compile thumb  : wiringPi <= mcp3422.c
[armeabi] Compile thumb  : wiringPi <= max31855.c
[armeabi] Compile thumb  : wiringPi <= max5322.c
[armeabi] Compile thumb  : wiringPi <= sn3218.c
[armeabi] SharedLibrary  : libwiringPi.so
[armeabi] Install        : libwiringPi.so => libs/armeabi/libwiringPi.so
[armeabi] Compile thumb  : wiringPiDev <= ds1302.c
[armeabi] Compile thumb  : wiringPiDev <= maxdetect.c
[armeabi] Compile thumb  : wiringPiDev <= piNes.c
[armeabi] Compile thumb  : wiringPiDev <= gertboard.c
[armeabi] Compile thumb  : wiringPiDev <= piFace.c
[armeabi] Compile thumb  : wiringPiDev <= lcd128x64.c
[armeabi] Compile thumb  : wiringPiDev <= lcd.c
[armeabi] Compile thumb  : wiringPiDev <= piGlow.c
[armeabi] SharedLibrary  : libwiringPiDev.so
[armeabi] Install        : libwiringPiDev.so => libs/armeabi/libwiringPiDev.so
[armeabi] Compile thumb  : wpi_android <= wpi_android.c
[armeabi] SharedLibrary  : libwpi_android.so
[armeabi] Install        : libwpi_android.so => libs/armeabi/libwpi_android.so 



jni/Android.mk 에 libwingPi.so와 libwingPiDev.so 빌드하도록 추가 하였습니다.

include $(CLEAR_VARS)
LOCAL_C_INCLUDES += \
    $(NDK_PATH)/platforms/android-21/arch-arm/usr/include \
    $(LOCAL_PATH)/wiringPi

LOCAL_MODULE    := wiringPi
LOCAL_SRC_FILES := \
    wiringPi/wiringPi.c \
    wiringPi/wiringShift.c \
    wiringPi/piHiPri.c \
    wiringPi/piThread.c \
    wiringPi/wiringPiSPI.c \
    wiringPi/wiringPiI2C.c \
    wiringPi/softPwm.c \
    wiringPi/softTone.c \
    wiringPi/mcp23008.c \
    wiringPi/mcp23016.c \
    wiringPi/mcp23017.c \
    wiringPi/mcp23s08.c \
    wiringPi/mcp23s17.c \
    wiringPi/sr595.c \
    wiringPi/pcf8574.c \
    wiringPi/pcf8591.c \
    wiringPi/mcp3002.c \
    wiringPi/mcp3004.c \
    wiringPi/mcp4802.c \
    wiringPi/mcp3422.c \
    wiringPi/max31855.c \
    wiringPi/max5322.c \
    wiringPi/sn3218.c

LOCAL_CFLAGS    += -UNDEBUG -DANDROID

LOCAL_LDLIBS    := -ldl -llog
include $(BUILD_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_C_INCLUDES += \
    $(NDK_PATH)/platforms/android-21/arch-arm/usr/include \
    $(LOCAL_PATH)/wiringPi

LOCAL_MODULE    := wiringPiDev
LOCAL_SRC_FILES := \
    devLib/ds1302.c \
    devLib/maxdetect.c \
    devLib/piNes.c \
    devLib/gertboard.c \
    devLib/piFace.c \
    devLib/lcd128x64.c \
    devLib/lcd.c \
    devLib/piGlow.c

LOCAL_SHARED_LIBRARIES := libwiringPi

LOCAL_CFLAGS    += -UNDEBUG
include $(BUILD_SHARED_LIBRARY)

그리고 wirinPi에서 사용해야 하는 function을 jni 형식으로 만듭니다.

jint Java_com_hardkernel_wiringpi_MainActivity_analogRead(JNIEnv* env, jobject obj, jint port) {
    return analogRead(port);
}

void Java_com_hardkernel_wiringpi_MainActivity_digitalWrite(JNIEnv* env, jobject obj, jint port, jint onoff) {
    digitalWrite(port, onoff);
}

int Java_com_hardkernel_wiringpi_MainActivity_wiringPiSetupSys(JNIEnv* env, jobject obj) {
    wiringPiSetupSys();
    return 0;
}

사용한 GPIO를 선언합니다.

    private final int ledPorts[] = {
        97, // GPIOX.BIT0(#97)
        108, // GPIOX.BIT11(#108)
        100, // GPIOX.BIT3(#100)
        101, // GPIOX.BIT4(#101)
        105, // GPIOX.BIT8(#105)
        106, // GPIOX.BIT9(#106)
        107, // GPIOX.BIT10(#107)
        115,  // GPIOX.BIT18(#115)
        116,  // GPIOX.BIT19(#116)
        88,  // GPIOY.BIT8(#88)
        83,  // GPIOY.BIT3(#83)
        87,  // GPIOY.BIT7(#87)
        104,  // GPIOX.BIT7(#104)
        102,  // GPIOX.BIT5(#102)
        103,  // GPIOX.BIT6(#103)
        117, // GPIOX.BIT20(#117)
        99, // GPIOX.BIT2(#99)
        118, // GPIOX.BIT21(#118)
        98, // GPIOX.BIT1(#98)
    };

MainActivity에 jni function들을 선언합니다.

    public native int wiringPiSetupSys();
    public native int analogRead(int port);
    public native void digitalWrite(int port, int onoff);

    static {
        System.loadLibrary("wpi_android");
    }

/sys/class/gpio/export를 이용하여 GPIO sysfs 노드를 만듭니다.
sysfs 방식은 pinMode()를 사용할 수 없기 때문에 directionout으로 설정 합니다.
그리고 value, direction의 접근 권한을 바꿉니다.

    boolean exportGPIO() {
        try {
            DataOutputStream os = new DataOutputStream(mProcess.getOutputStream());
            for (int port: ledPorts) {
                os.writeBytes("echo " +  port + " > /sys/class/gpio/export\n");
                os.writeBytes("chmod 666 /sys/class/gpio/gpio" + port + "/direction\n");
                os.writeBytes("echo out > /sys/class/gpio/gpio" + port + "/direction\n");
                os.writeBytes("chmod 666 /sys/class/gpio/gpio" + port + "/value\n");
            }
            os.flush();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
            return false;
        }

        return true;
    }

wiringPi의 "/dev/mem"을 open 하여 mmap을 사용하는 방식으로 만들려고 하였으니 "/dev/mem"은 root가 아니면 접근을 제한하도록 되어 있어서 불가능합니다.
jni의 library에는 root 권한을 줄 방법이 없습니다.

그래서 wiringPiSetupSys()를 호출 하여 wiringPi library를 초기화 합니다.


주기적으로 update()를 호출 하도록 만들고 UI와 LED를 control 합니다.

    public void update() {
        int i = 0;
        int adcValue = 0;
        int ledPos = 0;
        if ((adcValue = analogRead (PORT_ADC1)) > 0) {
            ledPos = (adcValue * ledPorts.length * 1000) / 1024;
            ledPos = (ledPorts.length - (ledPos / 1000));
            mADC.setProgress(adcValue);
        } else
            ledPos = 0;

        for (i = 0; i < ledPorts.length; i++) {
            digitalWrite (ledPorts[i], 0);
            mLeds.get(i).setChecked(false);
        }

        for (i = 0; i < ledPos; i++) {
            digitalWrite (ledPorts[i], 1);
            mLeds.get(i).setChecked(true);
        }

        if (!mStop)
            handler.postDelayed(runnable, 100);
    }


2015년 3월 19일 목요일

android에서 USB GPS Module 확인 방법

hardkernel에서 판매 중인 USB GPS Module입니다.

ODROID에 연결하면 아래와 같이 /dev/ttyACM0 노드가 생깁니다.

root@odroidxu3:/ # ls -l /dev/ttyACM0                                        
crw-rw-rw- gps      gps      166,   0 2015-03-19 16:46 ttyACM0

cat으로 노드를 읽어 보면 NMEA 값이 출력이 됩니다.

root@odroidxu3:/ # cat /dev/ttyACM0                                            
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,04,06,,,22,16,,,21,18,,,23,23,,,28*7C
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,04,06,,,22,16,,,21,18,,,22,22,,,22*76
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,04,06,,,22,16,,,21,18,,,22,22,,,21*75
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
^C
130|root@odroidxu3:/ # 

google apps을 설치하고 GPS를 사용하는 app을 실행하면 adb logcat으로도 GPS 정보가 올라오는지 확인이 가능합니다.


D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPRMC,,V,,,,,,,,,,N*53
D/libmbm-gps( 3167): RMC
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPVTG,,,,,,,,,N*30
D/libmbm-gps( 3167): unknown sentence 'GPVTG
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGGA,,,,,,0,00,99.99,,,,,,*48
D/libmbm-gps( 3167): GGA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
D/libmbm-gps( 3167): GSA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSV,1,1,00*79
D/libmbm-gps( 3167): GSV
D/libmbm-gps( 3167): NR sat: 'GSV'
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGLL,,,,,,V,N*64
D/libmbm-gps( 3167): GLL
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPRMC,,V,,,,,,,,,,N*53
D/libmbm-gps( 3167): RMC
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPVTG,,,,,,,,,N*30
D/libmbm-gps( 3167): unknown sentence 'GPVTG
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGGA,,,,,,0,00,99.99,,,,,,*48
D/libmbm-gps( 3167): GGA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
D/libmbm-gps( 3167): GSA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSV,1,1,01,18,,,28*7B
D/libmbm-gps( 3167): GSV
D/libmbm-gps( 3167): NR sat: 'GSV'
D/libmbm-gps( 3167): nmea_reader_parse: GSV message with total satellites 1
D/libmbm-gps( 3167): update sv status
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGLL,,,,,,V,N*64
D/libmbm-gps( 3167): GLL
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPRMC,,V,,,,,,,,,,N*53
D/libmbm-gps( 3167): RMC
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPVTG,,,,,,,,,N*30
D/libmbm-gps( 3167): unknown sentence 'GPVTG
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGGA,,,,,,0,00,99.99,,,,,,*48
D/libmbm-gps( 3167): GGA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
D/libmbm-gps( 3167): GSA
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGSV,1,1,01,17,,,21*7D
D/libmbm-gps( 3167): GSV
D/libmbm-gps( 3167): NR sat: 'GSV'
D/libmbm-gps( 3167): nmea_reader_parse: GSV message with total satellites 1
D/libmbm-gps( 3167): update sv status
D/libmbm-gps( 3167): Got an nmea string, parsing.
D/libmbm-gps( 3167): Received: $GPGLL,,,,,,V,N*64
D/libmbm-gps( 3167): GLL


소스 코드는 아래에서 확인이 가능합니다.


GPS 노드 이름이 다르거나 baud rate가 다르면 build.prop에 아래 부분을 수정 하시면 GPS library에서 두 정보를 읽어 처리 하도록 되어 있습니다.

ro.kernel.android.gps=/dev/ttyACM0
ro.kernel.android.gps.speed=9600

2015년 2월 5일 목요일

KODI for ODROID-C1


KODI is pre-installed on ODROID-C1 1.2 version.



But KODI is not working well because KODI is denied by Superuser.

KODI need SuperSU apps instead Supersuser app.


Settings => Language & input


Turn off Hardware Physical keyboard.
It you want to work IR remote, Turn on after settings.


Download GApps Installer for KitKat.


Install GApps Installer app.





Allow and wait to reboot.


Market installed.


Install SuperSU app.


Continue


Normal


Remember choice forever and Allow.



Grant



2014년 11월 11일 화요일

ODROID-W vs Raspberry Pi A+ vs Raspberry Pi B+




Raspberry Pi
Model B+
Raspberry Pi
Model A+
ODROID-W
SoCBroadcom BCM2835 ARM11 processor @ 700MHz with VideoCore IV GPU
System Memory512 MB (PoP)256 MB (PoP)512 MB (PoP)
Storagemicro SD card slotmicro SD card slot
eMMC module socket
AV OutputHDMI and 3.5 mm AV jackHDMI
Connectivity10/100M EthernetN/A
USB4x USB 2.0 host port +
micro USB port
1x USB 2.0 host port +
micro USB port
1x USB 2.0 host port +
micro USB port
Expansion40-pin header for GPIO
CSI interface
DSI interface
40-pin header for GPIO
CSI interface
Power5V via micro USB port
Power Consumption600 mA to 1.8 A @ 5VTBD but lower150 mA to 1.8 A @ 5V
Dimensions85 x 56 mm65 x 56 mm60 x 36 mm
Price$35$20$30
PMICN/ARicoh RC5T619 includes DCDCs, LDOs, ADCs, RTC, Battery charger and Fuel gauge
RTC powerN/ABackup battery connector (Molex 53398-0271)






2014년 10월 2일 목요일

How to make Installer for ODROID-XU3

Insert microSD/eMMC to PC.
Check media node name.
$ sudo fdisk -l

Fill zero data to media.
$ sudo dd if=/dev/zero of=/dev/sdX bs=512 count=1024000

Run Gparted.
menu -> Device -> Create Partition Table...

menu -> Partition -> New
Free space preceding (MiB) 100
New size (MiB): 400
File system: fat32

Apply All Operations

fuse u-boot binaries for SD media.
$ cd device/hardkernel/odroidxu3/uboot
$ sudo sh sd_fusing.sd /dev/sdX

mount fat32 partition.

copy bl1.bin, bl2.bin, tzsw.bin, u-boot.bin files to mounted partition.

$ cd out/target/product/odroidxu3/update/

copy zImage-dtb, system.img, userdata.img, cache.ing to mounted partition.

copy boot.ini file too.


sync and umount.

dump image.

$ sudo dd if=/dev/sdX of=./sd_installer.img bs=512 count=1024000

Extract img file and make checksum by md5sum.






2014년 7월 30일 수요일

build ODROID-U3(Kitkat) on Ubuntu 14.04

build ODROID-U3(Kitkat) on Ubuntu 14.04

# Download and install Ubuntu 14.04 LTS

http://www.ubuntu.com/download/desktop/

# Install packages

http://source.android.com/source/initializing.html

$ sudo apt-get update
$ sudo apt-get install git gnupg flex bison gperf zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 
$ sudo apt-get install build-essential g++-multilib

$ sudo add-apt-repository "deb http://ftp.debian.org/debian squeeze main contrib non-free"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

# Setup serial terminal

Install minicom

$ sudo apt-get install minicom
$ sudo minicom -s

Setup Serail port


            +-----[configuration]------+
            | Filenames and paths      |
            | File transfer protocols  |
            | Serial port setup        |
            | Modem and dialing        |
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |
            +--------------------------+
=================================================================
    +-----------------------------------------------------------------------+
    | A -    Serial Device      : /dev/ttyUSB0                              |
    | B - Lockfile Location     : /var/lock                                 |
    | C -   Callin Program      :                                           |
    | D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 115200 8N1                                |
    | F - Hardware Flow Control : No                                       |
    | G - Software Flow Control : No                                        |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |
            +--------------------------+
=================================================================

Save setup as dfl

                                                                             
            +-----[configuration]------+                                  
            | Filenames and paths      |                                  
            | File transfer protocols  |                                  
            | Serial port setup        |                                  
            | Modem and dialing        |                                  
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |
            +--------------------------+

fix permission

$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0  7월 29 12:30 ttyUSB0

minicom: Cannot open /dev/ttyUSB0: Permission denied

Just add your user to the dialout group so you have appropriate permissions on the device.
$ sudo usermod -a -G dialout [username]
logout. 

# Install fastboot and adb

$ sudo apt-get install android-tools-adb android-tools-fastboot
or download android sdk.
$ unzip adt-bundle-linux-x86_64-20140702.zip
$ mv adt-bundle-linux-x86_64-20140702 ~
$ vi ~/.bashrc
export PATH=$PATH:/home/odroid/adt-bundle-linux-x86_64-20140702/sdk/platform-tools

make 99-android.rules
$ sudo vi /etc/udev/rules.d/99-android.rules
# Hardkernel Odroid MTP mode (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="0002", MODE="0666" # MTP media 


# Install cross compiler


$ unxz arm-2010q1.tar.xz
$ tar xvf arm-2010q1.tar
$ sudo mkdir /opt/toolchains
$ sudo mv arm-2010q1 /opt/toolchains/
$ vi ~/.bashrc
add this lines. 

export PATH=$PATH:/home/odroid/adt-bundle-linux-x86_64-20140702/sdk/platform-tools:/opt/toolchains/arm-2010q1/bin
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-

$ source ~/.bashrc
$ $ arm-none-linux-gnueabi-gcc --version
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# Download source


$ git config --global user.email xxx@xxx.xxx
$ git config --global user.name xxx

kernel

$ git clone https://github.com/hardkernel/linux.git -b odroid-3.0.y-android

android

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ./repo
$ sudo cp repo /usr/bin
$ sudo chmod a+x ~/bin/repo
$ repo init -u https://github.com/hardkernel/android.git -b 4412_4.4.4_master
$ repo sync

# Build kernel

ODROID-U3 kernel

$ make odroidu_android_442_defconfig
$ make -j8

connect UART-USB module kit and micro USB cable


open minicom

$ minicom

keep typing the space bar in the minicom.
apply power.
entry to uboot mode.


U-Boot 2010.12-svn (May 12 2014 - 15:05:46) 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                                                                   
Manufacture ID 0x45 [ 29820MB ]                                                 
NAME: S5P_MSHC4                                                                 
MMC Device 0: 29820 MB                                                          
MMC Device 1: 0 MB                                                              
MMC Device 2 not found                                                          
USB3503 NINT = OUTPUT LOW!                                                      
ModeKey Check... run normal_boot                                                
No ethernet found.                                                              
Hit any key to stop autoboot:  0                                                
Exynos4412 #

format disk


Exynos4412 # fdisk -c 0
Count: 10000
NAME: S5P_MSHC4
fdisk is completed

partion #    size(MB)     block start #    block count    partition_Id 

   1          4110          6702223         8418828          0x0C 

   2          1027           134343         2104707          0x83 

   3          2048          2239050         4194487          0x83 

   4           131          6433537          268686          0x83


1 -> fat partition
2 -> system partition
3 -> userdate partition
4 -> cache partition

Exynos4412 # fastboot
[Partition table on MoviNAND]                                                   
ptn 0 name='fwbl1' start=0x1 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=0x0(~16777216KB) (use hard-coded info. (cmd:)
ptn 6 name='system' start=0x1 len=0x0(~1073741824KB)                            
ptn 7 name='userdata' start=0x1 len=0x0(~-2147483648KB)                         
ptn 8 name='cache' start=0x1 len=0x0(~134217728KB)                              
ptn 9 name='fat' start=0x1 len=0x0(~2009071616KB)                               
Insert a OTG cable into the connector! 

run fastboot

$ fastboot flash kernel arch/arm/boot/zImage
sending 'kernel' (3401 KB)...
OKAY [  0.559s]
writing 'kernel'...
OKAY [  0.385s]
finished. total time: 0.944s

write to success

Insert a OTG cable into the connector!
OTG cable Connected!
Starting download of 3482864 bytes
...
downloading of 3482864 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

CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0 

# Build android

ODROID-U3 Android-4.4.4 (kitkat)



$ ./build_android odroidu
$ ./build_android.sh odroidu
Build android for odroidu
including device/generic/mips/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/sscr/sc1_dvt1/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/hardkernel/odroidx/vendorsetup.sh
including device/hardkernel/odroidu/vendorsetup.sh
including device/hardkernel/odroidx2/vendorsetup.sh
including sdk/bash_completion/adb.bash
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.4
TARGET_PRODUCT=odroidu
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KTU84Q
OUT_DIR=out
============================================
[[[[[[[ Build android platform ]]]]]]]
make -j1 PRODUCT-odroidu-eng
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.4
TARGET_PRODUCT=odroidu
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KTU84Q
OUT_DIR=out
============================================
Checking build tools versions...
including ./art/Android.mk ...
including ./bionic/Android.mk ...
including ./bootable/diskinstaller
including ./abi/cpp/Android.mk ...

write images

$ fastboot flash system out/target/product/odroidu/system.img
$ fastboot flash userdate out/target/product/odroidu/userdate.img
$ fastboot flash cache out/target/product/odroidu/cache.img
$ fastboot reboot

# Fusing uboot

fusing micro SD

Insert micro SD to PC
$ sudo fdisk -l
Disk /dev/sdd: 4072 MB, 4072669184 bytes
36 heads, 52 sectors/track, 4249 cylinders, total 7954432 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: 0x000d2157
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048     7954431     3976192    b  W95 FAT32
$ cd device/hardkernel/proprietary/uboot_4412
$ sudo sh ./sd_fusing_4412.sh /dev/sdd

fusing eMMC

boot from microSD
connect eMMC

Exynos4412 # movi init 1
emmc reset...
REVISION: 2.0
Manufacturer TOSHIBA [ 7456MB ]
NAME: S5P_MSHC4
Device: S5P_MSHC4
Manufacturer ID: 11
OEM: 100
Name: 008G9 
Tran Speed: 0
Rd Block Len: 512
MMC version 4.0
High Capacity: Yes
Size: 0MB (block: 7456)
Bus Width: 8-bit DDR
Boot Partition Size: 4096 KB
Exynos4412 # 
Exynos4412 # pri
baudrate=115200
bootargs=fb_x_res=1280 fb_y_res=720 hdmi_phy_res=720 
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         run default_bootcmd;     f 
bootdelay=1
bootscript=source 40008000
cfg_file_name=boot.ini
cfg_load_base_mem=41000000
cfg_load_device=0
cfg_load_partition=1
cfg_load_partition_type=fat
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 u 1 ;
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;emmc;
default_bootcmd=echo >>> Run Default Bootcmd <<<;movi read kernel 0 40008000;movi read rootfs 0 41000000 100000;bootm 40008000 41000000
erase_uboot_env=mmc write 0 0x40008000 0x977 0x20;
ethaddr=00:40:5c:26:0a:5b
extra_arg_0=0
extra_arg_1=0
extra_arg_2=0
extra_arg_3=0
gatewayip=192.168.0.1
ipaddr=192.168.0.20
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
netmask=255.255.255.0
serverip=192.168.0.10
usb_invert_clken=0

Environment size: 1706/16380 bytes

Exynos4412 # 
Exynos4412 # 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 written: 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 written: OK
completed
eMMC CLOSE Success.!!
reading bootloader..device 0 Start 63, Count 2048 
MMC read: dev # 0, block # 63, count 2048 ... 2048 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 2048 
MMC write: dev # 1, block # 62, count 2048 ... 2048 blocks written: OK
completed
eMMC CLOSE Success.!!
reading 0 TrustZone S/W.. Start 2111, Count 312 
MMC read: dev # 0, block # 2111, count 312 ... 312 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 2110, Count 312 
MMC write: dev # 1, block # 2110, count 312 ... 312 blocks written: OK
completed
eMMC CLOSE Success.!!

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


Exynos4412 #