2013년 11월 25일 월요일

ndk 툴체인 만들기

>> make-standalone-toolchain.sh

#!/bin/bash

export ANDROID_NDK=android-ndk-r9   #your ndk path
export ANDROID_NDK_TOOLCHAIN_ROOT=android-toolchain-14  #dir to install
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh \
  --system=linux-x86_64 \   #remove if you have 32
  --toolchain=arm-linux-androideabi-4.6 \
  --platform=android-14 \
  --install-dir=$ANDROID_NDK_TOOLCHAIN_ROOT

curl라이브러리 안드로이드 ndk빌드

jni/Application.mk >>
NDK_TOOLCHAIN_VERSION=4.6
APP_PROJECT_PATH := $(shell pwd)
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/packages/Android/Android.mk

lib/curl_config.h
include/curl/curlbuild.h

Android.mk 에서 build the curl binary 아래부분은 지워준다

ndk-build

so파일을 만들고 싶다면 build-static-library를 build-shared-library로 바꿀것..

2013년 11월 1일 금요일

우분투 12버전의 C 포함

Are you using Ubuntu 12.04? There is a known problem that puts the files in a non standard location. You'll also need to do:

export LIBRARY_PATH=/usr/lib/$(gcc -print-multiarch)
export C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)
export CPLUS_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)

somewhere before you build (say in your .bashrc).

2013년 10월 13일 일요일

우분투 12.04에서 xorg.conf 생성

루트에서 파일 생성(뭐 로그파일 지워야 한다고 나오면 지우고 다시 명령어 입력)
# X -configure

복사
# cp /root/xorg.conf.new /etc/X11/xorg.conf

우분투에서 인텔 그래픽 드라이버 업데이트

sudo add-apt-repository ppa:glasen/inteldriver
sudo apt-get update
sudo apt-get install xorg-xserver-video-intel

2013년 10월 12일 토요일

우분투에서 nvidia 삭제하고 원래대로 복구하기

먼저 nvidia와 관련된 모든 패키지를 삭제한다

$ sudo apt-get remove --purge nvidia-*

그 후 다른 패키지가 있나 검색해본다

$ sudo dpkg -l | grep -i nvidia

nvidia가 삭제된 것으로만 끝나면 해상도 및 각종 문제가 남아있다
원래대로 복구해줘야 한다

$ sudo apt-get install ubuntu-desktop

때때로 nouveau 드라이버를 nvidia에서 막는 경우가 있으므로 이를 복구시켜준다

$ echo 'nouveau' | sudo tee -a /etc/modules

마지막으로 구제불능이 되버린 xorg.conf를 환생시키기 위해 삭제해준다

$ sudo rm /etc/X11/xorg.conf


우분투 해상도 문제

아래의 해상도는 예제이므로 절대 자신의 해상도를 넘어서는 숫자를 넣지 말것!!

우분투 12.04에서 해상도가 갑자기 변경되어버렸을시 돌리고 싶다면..
(X윈도우 상에서 가능)

$ cvt 1920 1080
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

방금 cvt명령에서 나온 결과물에서 Modeline 뒷부분을 복사해서 아래처럼 붙여넣어준다

$ xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

적용 가능한 디스플레이 확인..

$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 720, maximum 8192 x 8192
LVDS1 connected 1280x720+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   640x480        59.9
   1280x720_60.00   59.9*
VGA1 disconnected (normal left inverted right x axis y axis)
   1920x1280_60.00   60.0
   640x480_60.00   59.4
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
  1920x1080_60.00 (0x73)  173.0MHz
        h: width  1920 start 2048 end 2248 total 2576 skew    0 clock   67.2KHz
        v: height 1080 start 1083 end 1088 total 1120           clock   60.0Hz

VGA1은 잘못 추가한것... LVDS1이 커넥되어있으므로 그것을 추가해야 한다

$ xrandr --addmode LVDS1 "1920x1080_60.00"

$ xrandr --output LVDS1 --mode "1920x1080_60.00"

위의 명령어를 넣어서 해상도가 적용되면 완료된 것이다

2013년 10월 1일 화요일

Android에서 구글맵 v2 얻기

1. 이 곳에 가서 자세한 설명을 듣는다
https://developers.google.com/maps/documentation/android/start

2. 그 후 만일 프로젝트를 테스트 하는 거라던가 자신이 keystore에 대해 모른다고 하면
- cd c:\Users\(User Name)\.android\
- keystore -list -v -keystore debug.keystore
를 한 후 나오는 SHA1키를 어디 복사해둔다

3. 그 후 이 곳에 가서 키를 등록해야 한다
https://code.google.com/apis/console
- service에 가서 Google Maps API v2와 Google Maps Android API v2를 On시킨다
- 다음 API Access에 가서 Create Android Key를 선택하면 아래와 같은 형식을 요구한다
  -> 23:32:32:A3:D4: ..... :32;com.example
- 왼쪽은 SHA1키 오른쪽은 패키지명이다

4. 키를 얻었으면 AndroidManifest파일에 얻은 API키를 추가해야한다
<meta-data android:name="com.google.android.maps.v2.API_KEY"
    android:value="<이곳에 추가>"/>

5. 지도를 완성한 후 어플을 실행하면 된다

Android 주소에서 지도얻기


    public static GeoPoint getGeoPointFromLocationName(Context context, String locationName) {
     List<Address> addressList;
     GeoPoint pt = null;
     
     try {
      Geocoder geocoder = new Geocoder(context);
      addressList = geocoder.getFromLocationName(locationName, 5);
      if(addressList != null && addressList.size() > 0) {
       double lat = addressList.get(0).getLatitude();
       double lng = addressList.get(0).getLongitude();
       Log.v("Geocode", String.valueOf(lat) + ":" + String.valueOf(lng));
       pt = new GeoPoint(lat, lng);
      }
     } catch(IOException e) {
      e.printStackTrace();
     }
     return pt;
    }


2013년 9월 29일 일요일

ssh접속시 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

접속하려는 곳의 RSA키가 변경되어 일어나는 문제(보통 서버의 리눅스가 재설치 될 경우)

아래와 같이 입력한 후 다시 접속하면 된다
ssh-keygen -R 서버IP


gtk 설치하기

sudo apt-get install libgtk2.0-0 libgtk2.0-dev

2013년 9월 24일 화요일

안드로이드 빌드

#!/bin/sh

echo create R.java
aapt package -m -J src/ -M AndroidManifest.xml -S res/ -I "/home/tkmaster/data/sdk/platforms/android-17/android.jar"

echo compile R.java
#javac -d bin/ -classpath bin/ -bootclasspath "/home/tkmaster/data/sdk/platforms/android-17/android.jar" src/exam/AndroidExam/AndroidExam.java
javac -d bin/ -classpath bin/ -bootclasspath "/home/tkmaster/data/sdk/platforms/android-17/android.jar" src/exam/*/*.java

#echo compile *.java
#javac -d bin -classpath bin -bootclasspath "/home/tkmaster/data/sdk/platforms/android-17/android.jar" src/exam/AndroidExam/AndroidExam.java
#javac -d bin -classpath bin -bootclasspath "/home/tkmaster/data/sdk/platforms/android-17/android.jar" src/exam/*/*.java

echo convert .class to Dalvik JVM
rm ./bin/*.apk   #if apk file exist, error occured by zip problem
dx --dex --output="./bin/classes.dex" --positions=lines "./bin"

echo create .apk
aapt package -f -M AndroidManifest.xml -S res/ -I "/home/tkmaster/data/sdk/platforms/android-17/android.jar" -F bin/AndroidExam.apk

echo check package contents
#aapt list bin/AndroidExam.apk

echo create debug.apk using apkbuilder
apkbuilder bin/AndroidExam-debug.apk -z bin/AndroidExam.apk -f bin/classes.dex -rf src -rj libs

echo check package contents
#aapt list bin/AndroidExam-debug.apk

#echo sign apk
#jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore bin/tk.keystore bin/tk-debug.apk tktest

echo uninstall existed exam.AndroidExam package
adb uninstall exam.AndroidExam

echo install exam.AndroidExam package
adb install bin/AndroidExam-debug.apk

2013년 9월 23일 월요일

안드로이드 리스트뷰 90도 회전

public class ListFlipper extends Activity {

    private static final int DURATION = 1500;
    private SeekBar mSeekBar;

    private static final String[] LIST_STRINGS_EN = new String[] {
            "One",
            "Two",
            "Three",
            "Four",
            "Five",
            "Six"
    };
    private static final String[] LIST_STRINGS_FR = new String[] {
            "Un",
            "Deux",
            "Trois",
            "Quatre",
            "Le Five",
            "Six"
    };

    ListView mEnglishList;
    ListView mFrenchList;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.rotating_list);
        //FrameLayout container = (LinearLayout) findViewById(R.id.container);
        mEnglishList = (ListView) findViewById(R.id.list_en);
        mFrenchList = (ListView) findViewById(R.id.list_fr);

        // Prepare the ListView
        final ArrayAdapter adapterEn = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, LIST_STRINGS_EN);
        // Prepare the ListView
        final ArrayAdapter adapterFr = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, LIST_STRINGS_FR);

        mEnglishList.setAdapter(adapterEn);
        mFrenchList.setAdapter(adapterFr);
        mFrenchList.setRotationY(-90f);

        Button starter = (Button) findViewById(R.id.button);
        starter.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                flipit();
            }
        });
    }

    private Interpolator accelerator = new AccelerateInterpolator();
    private Interpolator decelerator = new DecelerateInterpolator();
    private void flipit() {
        final ListView visibleList;
        final ListView invisibleList;
        if (mEnglishList.getVisibility() == View.GONE) {
            visibleList = mFrenchList;
            invisibleList = mEnglishList;
        } else {
            invisibleList = mFrenchList;
            visibleList = mEnglishList;
        }
        ObjectAnimator visToInvis = ObjectAnimator.ofFloat(visibleList, "rotationY", 0f, 90f);
        visToInvis.setDuration(500);
        visToInvis.setInterpolator(accelerator);
        final ObjectAnimator invisToVis = ObjectAnimator.ofFloat(invisibleList, "rotationY",
                -90f, 0f);
        invisToVis.setDuration(500);
        invisToVis.setInterpolator(decelerator);
        visToInvis.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator anim) {
                visibleList.setVisibility(View.GONE);
                invisToVis.start();
                invisibleList.setVisibility(View.VISIBLE);
            }
        });
        visToInvis.start();
    }


}

안드로이드 터치이벤트

public boolean onTouchEvent(MotionEvent event){ 
  touchX = (int) event.getX();
  touchY = (int) event.getY();
  touchAction = event.getAction();

  
if (touchAction == MotionEvent.ACTION_MOVE){
   // 드래그 처리
  }
  return true;
}

2013년 9월 12일 목요일

vim 설정하기

"--------------------------------------------------"
" set private
"--------------------------------------------------"
set hlsearch   "add block to a word searched
set nu         "show number
syn on

set ts=8
set sw=4
set sts=4

"--------------------------------------------------"
" set basic variable
"--------------------------------------------------"
set cindent        "들여쓰기
set smartindent
set autoindent
set nowrap
set ff=unix
set bg=dark
set ruler

"--------------------------------------------------"
" set ctags database path
"--------------------------------------------------"
set tags=/home/master/linux/tags

"--------------------------------------------------"
" set cscope database path
"--------------------------------------------------"
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb

cs add /home/master/linux/cscope.out    /home/master/linux
set csverb

"--------------------------------------------------"
" set Tag List
"--------------------------------------------------"
filetype on
nmap  :TlistToggle
let Tlist_Ctags_Cmd = "/usr/bin/ctags"
let Tlist_Inc_Winwidth = 0
let Tlist_Exit_OnlyWindow = 0

let Tlist_Auto_Open = 0
let Tlist_Use_Right_Window = 1

"--------------------------------------------------"
" set Source Explorer
"--------------------------------------------------"
nmap  :SrcExplToggle
nmap  h
nmap  j
nmap  k
nmap  l

let g:SrcExpl_winHeight = 5
let g:SrcExpl_refreshTime = 100
let g:SrcExpl_jumpKey = ""
let g:SrcExpl_gobackKey = ""
let g:SrcExpl_isUpdateTags = 0

"--------------------------------------------------"
" set NERD Tree
"--------------------------------------------------"
let NERDTreeWinPos = "left"
nmap  :NERDTreeToggle

"--------------------------------------------------"
" vim option "
"--------------------------------------------------"
if &t_Co > 2 || has("gui_running")
    syntax on
    colorscheme ko2
endif
"--------------------------------------------------"

2013년 9월 10일 화요일

안드로이드 관련 링크

about Android ADB

about Android Building and Running

about Android Signing

about Using Hardware Device

Handle Errer : insufficient permissions for device

http://stackoverflow.com/questions/5510284/adb-devices-command-not-working


On my Gentoo/Funtoo linux system I am having similar problems:

I gotting always not the correct device description and insufficient permissions:

# sudo ./adb devices
List of devices attached
????????????    no permissions
# ./adb usb

error: insufficient permissions for device

For me helps the howto from Google. In my case I needed to add the udev rule:

# cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

and setting up the filesystem rights

# chmod a+r /etc/udev/rules.d/51-android.rules

After replugging my smartphone the access to the phone was successful, it also appears now in Eclipse' Android Device Chooser:

# sudo ./adb devices
List of devices attached
3XXXXXXXXXXXXXC device
# sudo ./adb usb
restarting in USB mode

You also have to check the membership of your user to the plugdev-group.

 

USB Vendor IDs

This table provides a reference to the vendor IDs needed in order to add USB device support on Linux. The USB Vendor ID is the value given to the ATTR{idVendor} property in the rules file, as described above.
CompanyUSB Vendor ID
Acer 0502
ASUS 0b05
Dell 413c
Foxconn 0489
Fujitsu 04c5
Fujitsu Toshiba 04c5
Garmin-Asus 091e
Google 18d1
Haier 201E
Hisense 109b
HTC 0bb4
Huawei 12d1
K-Touch 24e3
KT Tech 2116
Kyocera 0482
Lenovo 17ef
LG 1004
Motorola 22b8
MTK 0e8d
NEC 0409
Nook 2080
Nvidia 0955
OTGV 2257
Pantech 10a9
Pegatron 1d4d
Philips 0471
PMC-Sierra 04da
Qualcomm 05c6
SK Telesys 1f53
Samsung 04e8
Sharp 04dd
Sony 054c
Sony Ericsson 0fce
Teleepoch 2340
Toshiba 0930
ZTE 19d2

2013년 9월 8일 일요일

2013년 9월 4일 수요일

망고보드 펭귄로고 바꾸기

png 그림파일을 보드 첫화면 로고로 넣기위한 가공(망고보드 최대화면 800 * 480)

# pngtopnm image.png | pnmtoplainpnm > image.ppm
# pnmquant -fs 223 image.ppm > image_256.ppm
# pnmnoraw image_256.ppm > logo_linux_clut224.ppm

# cp logo_linux_clut224.ppm drivers/video/logo/

우분투 테마설정

우분투 컬러테마를 고르는중 koheler scheme을 입맛대로 수정해보았다..

vi ~/.vim/colors/(any name).vim 에 넣으면 된다
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer:   Ron Aaron 
" Last Change:  2006 Dec 10

hi clear
set background=dark
if exists("syntax_on")
  syntax reset
endif
let g:colors_name = "koheler"
hi Normal                 guifg=white guibg=black
hi Scrollbar      guifg=darkcyan guibg=cyan
hi Menu                   guifg=black guibg=cyan
hi SpecialKey     term=bold  cterm=bold  ctermfg=darkred  guifg=#cc0000
hi NonText                term=bold  cterm=bold  ctermfg=darkred  gui=bold      guifg=#cc0000
hi Directory      term=bold  cterm=bold  ctermfg=brown  guifg=#cc8000
hi ErrorMsg               term=standout  cterm=bold  ctermfg=grey  ctermbg=red  guifg=White  guibg=Red
hi Search                 term=reverse  ctermfg=white  ctermbg=red      guifg=white  guibg=Red
hi MoreMsg                term=bold  cterm=bold  ctermfg=darkgreen      gui=bold  guifg=SeaGreen
hi ModeMsg                term=bold  cterm=bold  gui=bold  guifg=White  guibg=Blue
hi LineNr                 term=underline  cterm=bold  ctermfg=darkcyan  guifg=Yellow
hi Question               term=standout  cterm=bold  ctermfg=darkgreen  gui=bold  guifg=Green
hi StatusLine     term=bold,reverse  cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
hi StatusLineNC   term=reverse  ctermfg=white ctermbg=lightblue guifg=white guibg=blue
hi Title                  term=bold  cterm=bold  ctermfg=darkmagenta  gui=bold  guifg=Magenta
hi Visual                 term=reverse  cterm=reverse  gui=reverse
hi WarningMsg     term=standout  cterm=bold  ctermfg=darkred guifg=Red
hi Cursor                 guifg=bg      guibg=Green
hi Comment                term=bold  cterm=bold ctermfg=darkgray guifg=#80a0ff
hi Constant               term=underline  cterm=bold ctermfg=magenta  guifg=#ffa0a0
hi Special                term=bold  cterm=bold ctermfg=red  guifg=Orange
hi Identifier     term=underline   ctermfg=brown  guifg=#40ffff
hi Statement      term=bold  cterm=bold ctermfg=darkyellow      gui=bold  guifg=#ffff60
hi PreProc                term=underline  ctermfg=darkmagenta   guifg=#ff80ff
hi Type                   term=underline  cterm=bold ctermfg=green  gui=bold  guifg=#60ff60
hi Error                  term=reverse  ctermfg=darkcyan  ctermbg=black  guifg=Red      guibg=Black
hi Todo                   term=standout  ctermfg=black  ctermbg=darkcyan  guifg=Blue  guibg=Yellow
hi CursorLine     term=underline  guibg=#555555 cterm=underline
hi CursorColumn   term=underline  guibg=#555555 cterm=underline
hi MatchParen     term=reverse  ctermfg=blue guibg=Blue
hi TabLine                term=bold,reverse  cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
hi TabLineFill    term=bold,reverse  cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
hi TabLineSel     term=reverse  ctermfg=white ctermbg=lightblue guifg=white guibg=blue
hi link IncSearch               Visual
hi link String                  Constant
hi link Character               Constant
hi link Number                  Constant
hi link Boolean                 Constant
hi link Float                   Number
hi link Function                Identifier
hi link Conditional             Statement
hi link Repeat                  Statement
hi link Label                   Statement
hi link Operator                Statement
hi link Keyword                 Statement
hi link Exception               Statement
hi link Include                 PreProc
hi link Define                  PreProc
hi link Macro                   PreProc
hi link PreCondit               PreProc
hi link StorageClass    Type
hi link Structure               Type
hi link Typedef                 Type
hi link Tag                             Special
hi link SpecialChar             Special
hi link Delimiter               Special
hi link SpecialComment  Special
hi link Debug                   Special

2013년 9월 1일 일요일

set number

1. /arch/arm/boot/compressed/misc.c
decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p,
                  int arch_id)
{
        output_data             = (uch *)output_start;  /* Points to kernel start */
        free_mem_ptr            = free_mem_ptr_p;
        free_mem_end_ptr        = free_mem_ptr_end_p;
        __machine_arch_type     = arch_id;

        arch_decomp_setup();

        makecrc();
        putstr("(1)Uncompressing Linux...");
        gunzip();
        putstr(" (1-e)done, booting the kernel.\n");
        return output_ptr;
}
2.

3. /init/version.c
/* FIXED STRINGS! Don't touch! */
const char linux_banner[] =
        "(3)Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
        LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";

const char linux_proc_banner[] =
        "%s version %s"
        " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
        " (" LINUX_COMPILER ") %s\n";
4. /arch/arm/kernel/setup.c
static void __init setup_processor(void)
{
        struct proc_info_list *list;

        /*
         * locate processor in the list of supported processor
         * types.  The linker builds this table for us from the
         * entries in arch/arm/mm/proc-*.S
         */
        list = lookup_processor_type(read_cpuid_id());
        if (!list) {
                printk("CPU configuration botched (ID %08x), unable "
                       "to continue.\n", read_cpuid_id());
                while (1);
        }

        cpu_name = list->cpu_name;

#ifdef MULTI_CPU
        processor = *list->proc;
#endif
#ifdef MULTI_TLB
        cpu_tlb = *list->tlb;
#endif
#ifdef MULTI_USER
        cpu_user = *list->user;
#endif
#ifdef MULTI_CACHE
        cpu_cache = *list->cache;
#endif

        printk("(4)CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
               cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
               proc_arch[cpu_architecture()], cr_alignment);

        sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS);
        sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS);
        elf_hwcap = list->elf_hwcap;
#ifndef CONFIG_ARM_THUMB
        elf_hwcap &= ~HWCAP_THUMB;
#endif

        cacheid_init();
        cpu_proc_init();
}
5. /arch/arm/kernel/setup.c
static void __init cacheid_init(void)
{
        unsigned int cachetype = read_cpuid_cachetype();
        unsigned int arch = cpu_architecture();

        if (arch >= CPU_ARCH_ARMv6) {
                if ((cachetype & (7 << 29)) == 4 << 29) {
                        /* ARMv7 register format */
                        cacheid = CACHEID_VIPT_NONALIASING;
                        if ((cachetype & (3 << 14)) == 1 << 14)
                                cacheid |= CACHEID_ASID_TAGGED;
                } else if (cachetype & (1 << 23))
                        cacheid = CACHEID_VIPT_ALIASING;
                else
                        cacheid = CACHEID_VIPT_NONALIASING;
        } else {
                cacheid = CACHEID_VIVT;
        }

        printk("(5)CPU: %s data cache, %s instruction cache\n",
                cache_is_vivt() ? "VIVT" :
                cache_is_vipt_aliasing() ? "VIPT aliasing" :
                cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown",
                cache_is_vivt() ? "VIVT" :
                icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" :
                cache_is_vipt_aliasing() ? "VIPT aliasing" :
                cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown");
}
6. /arch/arm/kernel/setup.c
static struct machine_desc * __init setup_machine(unsigned int nr)
{
        struct machine_desc *list;

        /*
         * locate machine in the list of supported machines.
         */
        list = lookup_machine_type(nr);
        if (!list) {
                printk("Machine configuration botched (nr %d), unable "
                       "to continue.\n", nr);
                while (1);
        }

        printk("(6)Machine: %s\n", list->name);

        return list;
}
7. /arch/arm/kernel/setup.c
static void __init parse_tags(const struct tag *t)
{
        for (; t->hdr.size; t = tag_next(t))
                if (!parse_tag(t))
                        printk(KERN_WARNING
                                "(7)Ignoring unrecognised tag 0x%08x\n",
                                t->hdr.tag);
}
8. /arch/arm/mm/mmu.c
switch (cp->pmd) {
        case PMD_SECT_WT:
                mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_WT;
                break;
        case PMD_SECT_WB:
        case PMD_SECT_WBWA:
                mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_WB;
                break;
        }
        printk("(8)Memory policy: ECC %sabled, Data cache %s\n",
                ecc_mask ? "en" : "dis", cp->policy);

        for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
                struct mem_type *t = &mem_types[i];
                if (t->prot_l1)
                        t->prot_l1 |= PMD_DOMAIN(t->domain);
                if (t->prot_sect)
                        t->prot_sect |= PMD_DOMAIN(t->domain);
        }
9. /arch/arm/mm/mmu.c
/*
                 * Check whether this memory bank would partially overlap
                 * the vmalloc area.
                 */
                if (__va(bank->start + bank->size) > VMALLOC_MIN ||
                    __va(bank->start + bank->size) < __va(bank->start)) {
                        unsigned long newsize = VMALLOC_MIN - __va(bank->start);
                        printk(KERN_NOTICE "(9)Truncating RAM at %.8lx-%.8lx "
                               "to -%.8lx (vmalloc region overlap).\n",
                               bank->start, bank->start + bank->size - 1,
                               bank->start + newsize - 1);
                        bank->size = newsize;
                }

10. /arch/arm/plat-samsung/init.c
void __init s3c_init_cpu(unsigned long idcode,
                         struct cpu_table *cputab, unsigned int cputab_size)
{
        cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);

        if (cpu == NULL) {
                printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
                panic("Unknown S3C24XX CPU");
        }

        printk("(10)CPU %s (id 0x%08lx)\n", cpu->name, idcode);

        if (cpu->map_io == NULL || cpu->init == NULL) {
                printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
                panic("Unsupported Samsung CPU");
        }

        cpu->map_io();
}
11. /arch/arm/plat-samsung/clock.c
int __init s3c24xx_register_baseclocks(unsigned long xtal)
{
        printk(KERN_INFO "(11)S3C24XX Clocks, Copyright 2004 Simtec Electronics\n");

        clk_xtal.rate = xtal;

        /* register our clocks */

        if (s3c24xx_register_clock(&clk_xtal) < 0)
                printk(KERN_ERR "failed to register master xtal\n");

        if (s3c24xx_register_clock(&clk_mpll) < 0)
                printk(KERN_ERR "failed to register mpll clock\n");

        if (s3c24xx_register_clock(&clk_upll) < 0)
                printk(KERN_ERR "failed to register upll clock\n");

        if (s3c24xx_register_clock(&clk_f) < 0)
                printk(KERN_ERR "failed to register cpu fclk\n");

        if (s3c24xx_register_clock(&clk_h) < 0)
                printk(KERN_ERR "failed to register cpu hclk\n");

        if (s3c24xx_register_clock(&clk_p) < 0)
                printk(KERN_ERR "failed to register cpu pclk\n");

        return 0;
}
12.

13.

14. /arch/arm/mach-s5pv210/clock.c
apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
        mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
        epll = s5p_get_pll90xx(xtal, __raw_readl(S5P_EPLL_CON),
                        __raw_readl(S5P_EPLL_CON_K));

        printk(KERN_INFO "(14)S5PV210: PLL settings, A=%ld, M=%ld, E=%ld\n",
                        apll, mpll, epll);

        clk_fout_apll.ops = &s5pv210_fout_apll_ops;
        clk_fout_mpll.rate = mpll;
        clk_fout_epll.rate = epll;


15 - 26. /arch/arm/plat-s5p/bootmem.c
void s5pv210_reserve_bootmem(void)
{
        struct s3c_media_device *mdev;
        int i, nr_devs;

        nr_devs = sizeof(media_devs) / sizeof(media_devs[0]);
        for (i = 0; i < nr_devs; i++) {
                mdev = &media_devs[i];
                if (mdev->memsize <= 0)
                        continue;

                mdev->paddr = virt_to_phys(__alloc_bootmem(mdev->memsize,
                                PAGE_SIZE, meminfo.bank[mdev->bank].start));
                printk(KERN_INFO "(%d) s5pv210: %lu KB system memory reserved "
                        "for %s at bank[%d] 0x%08x\n", i+15,(unsigned long) mdev->memsize/1024,
                        mdev->name, mdev->bank, mdev->paddr);
        }
}
27. /mm/page_alloc.c
/*
         * Disable grouping by mobility if the number of pages in the
         * system is too low to allow the mechanism to work. It would be
         * more accurate, but expensive to check per-zone. This check is
         * made on memory-hotadd so a system can start with mobility
         * disabled and enable it later
         */
        if (vm_total_pages < (pageblock_nr_pages * MIGRATE_TYPES))
                page_group_by_mobility_disabled = 1;
        else
                page_group_by_mobility_disabled = 0;

        printk("(27)Built %i zonelists in %s order, mobility grouping %s.  "
                "Total pages: %ld\n",
                        nr_online_nodes,
                        zonelist_order_name[current_zonelist_order],
                        page_group_by_mobility_disabled ? "off" : "on",
                        vm_total_pages);
28. /init/main.c
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
        lock_kernel();
        tick_init();
        boot_cpu_init();
        page_address_init();
        printk(KERN_NOTICE "%s", linux_banner);
        setup_arch(&command_line);
        mm_init_owner(&init_mm, &init_task);
        setup_command_line(command_line);
        setup_nr_cpu_ids();
        setup_per_cpu_areas();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */

        build_all_zonelists();
        page_alloc_init();

        printk(KERN_NOTICE "(28)Kernel command line: %s\n", boot_command_line);
        parse_early_param();
        parse_args("Booting kernel", static_command_line, __start___param,
                   __stop___param - __start___param,
                   &unknown_bootoption);
29 - 31. /mm/page_alloc.c
 if (!table)
                panic("Failed to allocate %s hash table\n", tablename);

        int nNumber = getNumberByTableName(tablename);

        printk(KERN_INFO "(%d)%s hash table entries: %d (order: %d, %lu bytes)\n",
               nNumber,
               tablename,
               (1U << log2qty),
               ilog2(size) - PAGE_SHIFT,
               size);

        if (_hash_shift)
                *_hash_shift = log2qty;
        if (_hash_mask)
                *_hash_mask = (1 << log2qty) - 1;









2013년 8월 7일 수요일

2013년 8월 6일 화요일

ubuntu 12.04에서 ROOT계정 로그인 활성화하기

1. 먼저 root 계정의 패스워드를 만든다.

   $ sudo  passwd  root
   Enter new UNIX password:
   Retype new UNIX password:
   passwd: password updated successfully
 
2. gedit 편집기를 이용하여 "lightdm.conf" 파일을 열어서 수정한다.

  $ sudo gedit /etc/lightdm/lightdm.conf

3. gedit 편집기에 의해서 열린 "lightdm.conf"에서 다음을 추가하고,
    저장한다.

   &lt;다음 내용은 존재하고 있다&gt;
   user-session=ubuntu
   greeter-session=unity-greeter
  &lt;다음 내용을 추가한다&gt;
   greeter-show-manual-login=true  // 로그인 선택이 나타나게 함
   autologin-user=root   //root 계정으로 자동 로그인하는 설정임

출처 : http://www.embeddedkorea.co.kr

2013년 6월 7일 금요일

Win32 Window Mode

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;        // current instance
TCHAR szTitle[MAX_LOADSTRING];     // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];   // the main window class name

// Forward declarations of functions included in this code module:
ATOM    MyRegisterClass(HINSTANCE hInstance);
BOOL    InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
 UNREFERENCED_PARAMETER(hPrevInstance);
 UNREFERENCED_PARAMETER(lpCmdLine);

  // TODO: Place code here.
 MSG msg;
 HACCEL hAccelTable;

 // Initialize global strings
 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
 LoadString(hInstance, IDC_TEST2, szWindowClass, MAX_LOADSTRING);
 MyRegisterClass(hInstance);

 // Perform application initialization:
 if (!InitInstance (hInstance, nCmdShow))
 {
  return FALSE;
 }

 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TEST2));

 // Main message loop:
 while (GetMessage(&msg, NULL, 0, 0))
 {
  if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
 }

 return (int) msg.wParam;
}



//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage are only necessary if you want this code
//    to be compatible with Win32 systems prior to the 'RegisterClassEx'
//    function that was added to Windows 95. It is important to call this function
//    so that the application will get 'well formed' small icons associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
 WNDCLASSEX wcex;

 wcex.cbSize = sizeof(WNDCLASSEX);

 wcex.style   = CS_HREDRAW | CS_VREDRAW;
 wcex.lpfnWndProc = WndProc;
 wcex.cbClsExtra  = 0;
 wcex.cbWndExtra  = 0;
 wcex.hInstance  = hInstance;
 wcex.hIcon   = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TEST2));
 wcex.hCursor  = LoadCursor(NULL, IDC_ARROW);
 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
 wcex.lpszMenuName = MAKEINTRESOURCE(IDC_TEST2);
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm  = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

 return RegisterClassEx(&wcex);
}

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, 640, 480, NULL, NULL, hInstance, NULL);//(ClassName, Title, Style, x, y, width, height, handle, handle, instance, param);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND - process the application menu
//  WM_PAINT - Paint the main window
//  WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
 int wmId, wmEvent;
 PAINTSTRUCT ps;
 HDC hdc;
 RECT    rc;
 static TCHAR szOutBuf[] = TEXT("Hello World");

 switch (message)
 {
 case WM_COMMAND:
  wmId    = LOWORD(wParam);
  wmEvent = HIWORD(wParam);
  // Parse the menu selections:
  switch (wmId)
  {
  case IDM_ABOUT:
   DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
   break;
  case IDM_EXIT:
   DestroyWindow(hWnd);
   break;
  default:
   return DefWindowProc(hWnd, message, wParam, lParam);
  }
  break;
 case WM_PAINT:
  hdc = BeginPaint(hWnd, &ps);
  // TODO: Add any drawing code here...
  GetClientRect(hWnd, &rc);
        DrawText(hdc,  szOutBuf, lstrlen(szOutBuf), &rc, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  EndPaint(hWnd, &ps);
  break;
 case WM_DESTROY:
  PostQuitMessage(0);
  break;
 default:
  return DefWindowProc(hWnd, message, wParam, lParam);
 }
 return 0;
}

// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
 UNREFERENCED_PARAMETER(lParam);
 switch (message)
 {
 case WM_INITDIALOG:
  return (INT_PTR)TRUE;

 case WM_COMMAND:
  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  {
   EndDialog(hDlg, LOWORD(wParam));
   return (INT_PTR)TRUE;
  }
  break;
 }
 return (INT_PTR)FALSE;
}


메모리 누수 제거방법..

 ((BitmapDrawable)imageView.getDrawable()).getBitmap().recycle();
  ImageView.setImageBitmap(new Bitmap());
이미지뷰의 비트맵 설정시 이미지뷰의 비트맵을 recycle하라 그리고 가능하면 액티비티 문맥 대신 어플리케이션 문맥을 사용하라.. Context c 대신 getAppContext()...

2013년 6월 3일 월요일

Web.xml에 Log4j설정


org.springframework.web.util.Log4jConfigListener



log4jConfigLocation
classpath:log4j.xml