12/22/2016

Gstreamer의 Elements

1. Gstreamer 기본분석 

아래는 IP Camera 에서 전송하는 H.264 Stream을 받아 Gstreamer로 재생하는 예제이다
각 부분의 Elements와 부분을 간단히 분석해보자. 

  • Gstreamer RTSP 관련부분 TEST 예제 

$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264  ! queue ! \
'application/x-rtp,payload=96,encoding-name=H264,framerate=(fraction)30/1' ! \
rtph264depay ! \
h264parse access-unit=true ! queue ! \
omx_h264dec ! omx_scaler ! \
'video/x-raw-yuv, width=(int)1920, height=(int)1080' ! queue ! \
omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! \
gstperf print-fps=true print-arm-load=true ! \
omx_videosink sync=false enable-last-buffer=false

https://en.wikipedia.org/wiki/GStreamer

  • Elements의 구성

Properties

이  Element 에서 제공해주는 속성 즉 설정들을 말한다.
아래와 같이 Manual을 보면, Elements 내부에 기능의 설정값을 이 속성을 이용하여
변경이 가능하다.

Signal  

이 Element 들은 기본적으로 Pipeline 통신을 하며, 이 사용시 발생되는 Signal Message // Programming 하면 Callback

Element Pads:

Element 내부에는 pad라는 것이 존재하며,본인도 초반에 잠시 헷갈렸지만, 이름에서 알수 있듯이,
그림을 보면 쉽게 이해를 할수 있다. 말그대로 Element의 Pad 기능이다.
Element들의 연결은 Pipeline을 통하여 Source와 Sink 방식으로 연결이 된다.
Source의 Pad가 존재 할수 있고, Sink 에 Pad Interface가 존재 할수도 있는 것이다.
이를 이용하여 Programming 에서는 Call back Function을 구현을 할 수도 있다.

Pad 기능에서 중요하게 봐야 할 부분이 Manual에서 Pad의 방향
발생빈도

  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html
    https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html

URIDECODEBIN
  https://yujuwon.tistory.com/entry/%ED%8C%8C%EC%9D%B4%ED%94%84%EB%9D%BC%EC%9D%B8-%EC%83%81%ED%83%9C-%ED%99%95%EC%9D%B8

Ghost Pad
  https://yujuwon.tistory.com/entry/Ghost-pads-1?category=637930

에는 이름과 방향 발생빈도 및 자세한 내용이 나온다.
                 Element인 경우 source or sink 방향이 있다.
                 이 경우,  source에만 해당하거나, sink에만 해당하는 기능을 말하는 것 같다.

Tee Command 관련 예제(optee가 아님)
  https://gist.github.com/crearo/a49a8805857f1237c401be14ba6d3b03


  • PAD관련 Manual 
  https://gstreamer.freedesktop.org/documentation/application-development/basics/pads.html


  • Plug-in rtspsrc 설명 
  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html

  • Plug-in rtph264depay 설명 
  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtph264depay.html


동영상 Encode/Decode에 있어서는 Gstreamer가 다루는 것은 두가지로 볼수 있다.

  1. OpenMax  : 주로 HW와 함께 연동이 되어 동작이 되며, 관련 MPU Manual 참조 
  2. FFmpeg : SW Codec으로  Interface도 동일하다. 

OpenMax도 거의 동일하게 동작이 되도록 유지되게 했지만, 조금씩 다르다.


2. Plug-In 개발 방법 

만약 Plug-IN을 직접 개발해보고 싶다면, 아래의 Manual을 보고 한번 해보자.
본인도 궁금하고 해보고 싶다.

 https://gstreamer.freedesktop.org/documentation/plugin-development/index.html
 https://gstreamer.freedesktop.org/documentation/tutorials/basic/multithreading-and-pad-availability.html?gi-language=c

12/19/2016

DM8148의 NAND 와 UBIFS 문제 (Power-Cut)

1. Background 

DM8148 Board를 고객에게 Board를 제작해주고, 1년 동안 잘동작이 되었지만, 1년이 지난후 갑자기 문제가 발생이 되어
아래와 같이 원인분석을 하기 시작하였다. 고객은 갑자기 그렇다고 하는데, 일단 사용보드 2개가 동일한 증상을 보여 문제사항을 분석하기로 하였다.


1.1 문제사항

Booting 할때마다 아래와 같이 Kernel에서 Mount할때 UBIFS의 Recovery Mode를 진입을하여,
이를 매번실패한 후 Booting이 되지 않고 에러 발생.

  • UBIFS 문제점 
UBI: attaching mtd4 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: max. sequence number:       240
UBI: attached mtd4 to ubi0
UBI: MTD device name:            "File System"
UBI: MTD device size:            505 MiB
UBI: number of good PEBs:        4040
UBI: number of bad PEBs:         2                        // bad block marking 잘 동작 
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 4040
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 2/0
UBI: image sequence number:  214330113
UBI: background thread "ubi_bgt0d" started, PID 38
....
UBIFS: recovery needed
UBIFS error (pid 1): replay_log_leb: log error detected while replaying the log at LEB 3:0
List of all partitions:
1f00             128 mtdblock0  (driver?)
1f01            2304 mtdblock1  (driver?)
1f02             128 mtdblock2  (driver?)
1f03            4352 mtdblock3  (driver?)
1f04          517376 mtdblock4  (driver?)
No filesystem could mount root, tried:  ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Backtrace: 
[] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c)
 r7:d6412000 r6:c006d928 r5:c002c4c4 r4:c0472b90
[] (dump_stack+0x0/0x1c) from [] (panic+0x60/0x17c)
[] (panic+0x0/0x17c) from [] (mount_block_root+0x1e0/0x220)
 r3:00000000 r2:00000020 r1:d643bf78 r0:c03cce1c
[] (mount_block_root+0x0/0x220) from [] (prepare_namespace+0x94/0x1d4)
[] (prepare_namespace+0x0/0x1d4) from [] (kernel_init+0x114/0x154)
 r5:c00086b0 r4:c0472340
[] (kernel_init+0x0/0x154) from [] (do_exit+0x0/0x5e4)
 r5:c00086b0 r4:00000000


2. UBOOT에서 기본 TEST 및 문제진단


uboot에서 기본적으로 tftp를 이용하여, kernel 및 filesystem을 download 후 이를 다시 NAND에 write 한 후 NAND Boot를 하면 한번은 제대로 동작이 된다.

처음과 같이 전원단에 갑자기 On/Off를 하면 상위와 동일한 증상이 발생한다.

2.1 UBOOT에서 Bad Block TEST

상위 테스트로 일단 Kernel Image와 Filesystem Image에는 문제가 없다고 판단이 되었다.

SLC Type의 NAND 이지만 Bad Block문제라고 생각이 되어 이를 UBOOT에서 Bad Block을 직접 설정하고 해결하려고 했다. (BBT설정 )

  • NAND의 bad block 검출방법
RAM의 Image와 NAND Image를 비교하여 틀린 곳을 발견  
  
U-Boot#  tftp 0x81000000 file_system.img
Bytes transferred = 140771328 (8640000 hex)  

U-Boot#  nand read 0xA0000000 0x6c0000 0x8640000
// 35192832 = 140771328/4 bytes 

U-Boot#  cmp 0x81000000 0xA0000000 35192832
word at 0x8100000c (0x00000000) != word at 0xa000000c (0x01000000)
Total of 3 words were the same 

  // 0x8100000c - 0x81000000 = 0xc + 0x6c0000 
  // 0xa000000c - 0xA0000000 = 0xc + 0x6c0000



  • NAND에  Bad block를 Marking
아래와 같이 문제가되는 Block을 Bad Block이라고 직접 Marking 을 한다 
  
U-Boot#  nand markbad 0x6c000C
U-Boot#  nand bad 
006c0000

// Nand bad block maring 2nd Test 

U-Boot#  nand read 0xA0000000 0x6c0000 0x8640000
U-Boot#  cmp 0x81000000 0xA0000000 35192832

word at 0x897423c4 (0xff7fffff) != word at 0xa87423c4 (0xffffffff)
Total of 35457265 words were the same

  // 0x897423c4 - 0x81000000 = 0x087423C4 + 0x006c0000 = 0x08E023C4 --> read size를 초과했다. 
  // 위 로그를 보면 나의 count 보다 초과 했다. 다른 곳 위치가 filesystem의 범위를 벗어났다. 

위와 같이 진행을 하여 Bad Block을 Marking을 여러번 한 후 TEST를 했으나, 결과는 동일하게 나타났으며, 그 원인을 Bad Block이 아닌 다른문제로 보기로 하였다.
( 물론 Uboot Loader와 Kernel 사이의 Bad block Table의 호환성도 확인해야한다)


2.2 UBIFS 설정변경 

원래 문제를 다시 분석을 해보면, 초반 한번은 제대로 Booting이 된다 , 그리고, 그 다음 Power on/off를 하면 이 문제가 다시 발생을 하는데, 이때 NAND에 무슨 문제가
발생한다고 생각해서 아래와 같이 Kernel의 Argument를 변경하였다.

현재 kernel argument이며, 현재 mtd4에 page size 2048로 설정되어있으며 rw이기때문에 이를 ro로 변경
 
set bootargs "console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M"

  • read only 변경후 해결 (임시방편)
read only로 하면 , 즉 ro , 변경하면 동작은 위 문제는 해결이 되었다. 
 
set bootargs "console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 ro ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M"

  • UBIFS mount 및 kernel argument 
   http://processors.wiki.ti.com/index.php/UBIFS_Support

ro로 하면 문제는 해결이 되지만, UBIFS라는 것이 RW를 사용하기위해서 사용하는것이 목적일텐데, 이것은 해결이 아니고, 임시방편이라고 생각이 들어
다음과 같이 근본적인 원인을 더 분석하기로하였다.

2.3 UBIFS의 문제사항 파악 

UBIFS에서 왜 Recovery를 하는 지 정확한 원인을 알기 위해서 찾던도중 The unstable bits issue라는 것이있다는 것을 알게되었다.
원인은 잦은 Power Cut때문에 위와 같은 문제발생이 된다고 하는데, 예를들면 CPU는 NAND에게 CMD 주고 NAND가 이를 처리하는 도중
지속적으로 전원이 나가면 이런 문제가 발생이 된다고 한다.
현재 우리 보드가 Reset 버튼을 찾기 어려워서 자주 Power를 뽑게되어 있어, 이런문제가 발생한것 같다. (본인도, Reset보다는 Power on/off를 함)


현재 회로도를 보면, PMIC와 DM8148은 연결이 되어있고, PMIC는 SMPS가 지원이 되기때문에, Switch용으로 Capacitor 사용하지만, 현재 이부분과 연관이 있을 것 같다. (추측)
전원이 나가면, SOC에게는 CMD를 주는 여러번의 기회를 주지만, NAND에서 이를 처리할 시간이 없어서 발생하는 문제이니, HW적으로도
이부분은 문제일것이라고 생각이 들면 이부분은 더 살펴보아야 할 것 같다.

시간이 더 허락이 된다면, 추후 회로도와 관련사항을 더 봐야할 것 같다.

  • The unstable bits issue
   http://www.linux-mtd.infradead.org/doc/ubifs.html#L_unstable_bits

  • UBIFS 관련내용 
   http://www.linux-mtd.infradead.org/doc/ubifs.html

  UBIFS의 구조 및 동작원리
  https://bootlin.com/pub/conferences/2016/elce/brezillon-ubi-mlc/ubi-mlc.pdf

  • 구글링을 해서 나와 유사한 문제를 찾았다. 
   http://forum.doozan.com/read.php?2,907,919

 
3. 결론 


3.1 NAND Power-Cut의 문제사항


Power-cut이라는 것이 전원공급을 갑자기 중단하는 방법을 말한다.

  • Unstable bits issue란? 
이용어는 NAND가 write or erase 하는 도중  power-cut 으로 발생되는 불안정한 BIT오류를 말한다.

처음 튼튼한 SLC (robust SLC) 인 경우와 NOR Type에는 나온적이 아직은 없다고 하지만,
현재의 SLC와 MLC에 공통적으로 나오는 현상이라고 한다.
이 문제는 아직 해결이 되지 않았으며, 어느 flash건 나올 수 있다. (UBIFS에서도 해결이 안됨)

잦은 power-cut으로 인하여 NAND 안에는 unstable bits가 존재하며, 이 bit들이 증가하여,
ECC가 이를 보정 못했을 경우 문제가 확산이 되는 경우 발생한다.

UBIFS 경우 이 문제가 발생이되면 ECC Error가 발생이되고 recovery mode 들어가 복구를 시도 하지만 복구가 제대로 안되는 경우가 발생이 한다.
이 때 File system은 오류가 생기고 에러가 발생이된다.
인터넷 글을 읽어보면, 이것은 불안전한 bit이기 때문에 제대로 read가 될 경우도 있다.
그래서 제대로 동작이 될 경우도 있지만, 문제가 지속되는 경우도 발생한다.

결론은 항상 unstable bits는 NAND안에 존재하지만 이는 power-cut에 의해 발생이 되며,
그리고 기본적으로 ECC 알고리즘이 이를 복구를 해주지만, 이 unstalbe bit 가 증가하면 
이를 복구를 못해주어 문제가 발생한다.

* unstable bits : power cut으로 발생으로 되며, NAND안에서 존재하게된다.
* ECC (Error-correcting code) (1bit/4bit ECC)
* bit-flip: 외부의 요인으로 bit가 변경되는 현상, (heat or power cut or low voltage)

unstalbe bits란?
  http://www.linux-mtd.infradead.org/doc/ubifs.html#L_unstable_bits

  • Power Cut Off Interval 비교 (아래 논문참고)
Power Cut off interval은 아래의 논문을 보면,CPU에서 Command 가 NAND에 실행되는 시간부터 Power를 off하는 시간의 간격이다.
이에 따라 간단히 에러율을 볼수가 있는데,  (논문내용을 함부로 가져올수가 없어서)
간단히 정리해본다.

4.1 Program and power failure (논문)
SLC마다 다르지만, 대체적으로  Power cut off는 100ms기반으로 에러율이 많이 틀려지는 것 같다.

4.2 Erase and power failure (논문)
확실히 Erase Command가 실행시간이 오래걸리며, 생각을 해봐도, Block 단위로 할테니,
시간이 많이 걸리는 것 같다.
그래서, 위와 다르게 SLC type 마다 너무 다 다르다.

이는 개별 NAND datasheet에서 Command 실행시간을 확인을 해봐야 할 것같다.


  • 관련논문 
  https://cseweb.ucsd.edu/~swanson/papers/DAC2011PowerCut.pdf


  • Software 해결방안 (unstable bits)
UBIFS 사용할 경우 recovery mode로 인하여 잘못 복구되어서 문제가 확산이 된다.
하지만, yaffs의 구조가 어떻게 작동이 되는지는 정확히 모르겠지만, 이 부분에 있어서
UBIFS보다 낫다고 한다.
Yaffs로 변경이 되어다고 해서 완전히 해결이 되는 문제는 아니지만 발생빈도가 줄어드는것같다.

  위 내용은 아래 참조 (HW내용도 기술됨)
  http://yaffs.net/lurker/message/20140710.203207.b2255691.it.html


  • Hardware 해결방안 (unstable bits)
NAND의 Power 관련인 VCC에 Decoupling Capacitor 달아주는 거나 이에 관련된 부분을 검토하는 것이다.
그리고 가능하다면 회로도가 넓이 및 다른 것도 고려해야 하는 것 같다.

물론 근본적 원인은  power-cut이 될 경우 NAND Controller인 SOC는 먼저 종료가 되는 것 이지만,
Power-Cut 동안 이미 받은 NAND가 Command를 받아 처리하는 것을 완료될때까지 잠시지연시키는 것이 HW 최대 해결방안이다.





  • 상위회로도 아래와 동일
  https://e2e.ti.com/support/arm/sitara_arm/f/791/t/358906

  • NAND or DDR HW 설계시 알아야할 기본내용 
  bypass (decoupling) capacitor 관련내용
  http://magicom9.tistory.com/78

12/16/2016

Kernel Module (모듈관련부분 조사 후 작성 )

1. kernel module 명령어

Module의 기본명령어

/sbin/modprobe
/sbin/modinfo
/sbin/insmod
/sbin/rmmod

  module-init-tools download
  http://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/
  https://wiki.archlinux.org/index.php/Kernel_module

1.1  Module의 저장위치 및 설정 


  • 일반적인 Module의 저장위치 


$ cd /lib/modules/2.6.x/
$ ll
합계 168
drwxr-sr-x 4 jhlee jhlee  4096 12월 16 11:00 ./
drwxr-sr-x 3 jhlee jhlee  4096 12월 26  2012 ../
lrwxrwxrwx 1 jhlee jhlee    91 12월 15 12:20 build -> /home/jhlee/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00/board-support/linux-2.6.37-psp04.04.00.01/
drwxrwsr-x 4 jhlee jhlee  4096 12월 16 10:47 kernel/
-rw-r--r-- 1 root  jhlee   123 12월 16 11:00 modules.alias
-rw-r--r-- 1 root  jhlee   177 12월 16 11:00 modules.alias.bin
-rw-rw-r-- 1 jhlee jhlee  5654 12월 16 10:47 modules.builtin
-rw-r--r-- 1 root  jhlee  7133 12월 16 11:00 modules.builtin.bin
-rw-r--r-- 1 root  jhlee    69 12월 16 11:00 modules.ccwmap
-rw-r--r-- 1 root  jhlee  1093 12월 16 11:00 modules.dep
-rw-r--r-- 1 root  jhlee  1707 12월 16 11:00 modules.dep.bin
-rw-r--r-- 1 root  jhlee    52 12월 16 11:00 modules.devname
-rw-r--r-- 1 root  jhlee    73 12월 16 11:00 modules.ieee1394map
-rw-r--r-- 1 root  jhlee   141 12월 16 11:00 modules.inputmap
-rw-r--r-- 1 root  jhlee    81 12월 16 11:00 modules.isapnpmap
-rw-r--r-- 1 root  jhlee    74 12월 16 11:00 modules.ofmap
-rw-rw-r-- 1 jhlee jhlee   172 12월 16 10:47 modules.order
-rw-r--r-- 1 root  jhlee    99 12월 16 11:00 modules.pcimap
-rw-r--r-- 1 root  jhlee    43 12월 16 11:00 modules.seriomap
-rw-r--r-- 1 root  jhlee   131 12월 16 11:00 modules.softdep
-rw-r--r-- 1 root  jhlee 28409 12월 16 11:00 modules.symbols
-rw-r--r-- 1 root  jhlee 37006 12월 16 11:00 modules.symbols.bin
-rw-r--r-- 1 root  jhlee   189 12월 16 11:00 modules.usbmap
lrwxrwxrwx 1 jhlee jhlee    91 12월 16 10:47 source -> /home/jhlee/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00/board-support/linux-2.6.37-psp04.04.00.01/
drwxr-sr-x 5 jhlee jhlee  4096 12월 31  2012 updates/

DM8147를 보면서, TI 상당히 복잡하게 설정이 되어있어, 내부를 자세히 보기로 결정.

modules.dep
modules.alias

  https://www.kernel.org/doc/Documentation/kbuild/kbuild.txt

 
$ vi /etc/modprobe.d/blacklist     이부분의 기능
$ vi /etc/modprobe.d/media-controller-utils.conf

  blacklist vpss
  blacklist ti81xxfb
  blacklist sii9022a
  blacklist ti81xxhdmi
  blacklist tlc59108

$ vi /etc/modules.conf
$ vi /etc/modules
$ vi /etc/modutils

  https://ko.wikipedia.org/wiki/Modprobe


1.3  udev와 연결과 설정

udev가 plug-in인을 감지하여 자동으로 module을 올리는 방식이다.

  modules.usbmap
  https://linux.die.net/man/8/usbmodules


2. Module의 정보확인방법 

2.1 HOST OS에서 Module 정보 확인 


  • syslink modlue 확인


$ find . -name syslink.ko
./component-sources/syslink_2_20_02_20/packages/ti/syslink/utils/hlos/knl/Linux/syslink.ko
./component-sources/syslink_2_20_02_20/packages/ti/syslink/bin/TI814X/syslink.ko
./filesystem/ezsdk/lib/modules/2.6.37/kernel/drivers/dsp/syslink.ko

$ modinfo ./component-sources/syslink_2_20_02_20/packages/ti/syslink/bin/TI814X/syslink.ko
filename:       ./component-sources/syslink_2_20_02_20/packages/ti/syslink/bin/TI814X/syslink.ko
license:        GPL v2
depends:        
vermagic:       2.6.37 mod_unload modversions ARMv7 p2v8 
parm:           TRACE:charp
parm:           TRACEENTER:charp
parm:           TRACEFAILURE:charp
parm:           TRACECLASS:charp

2.2 Target OS 에서 Module 정보확인

  • syslink와 ti81xxfb 확인

 # modinfo syslink
filename:       /lib/modules/2.6.37/kernel/drivers/dsp/syslink.ko
license:        GPL v2
depends:      
vermagic:       2.6.37 mod_unload modversions ARMv7 p2v8
parm:           TRACE:charp
parm:           TRACEENTER:charp
parm:           TRACEFAILURE:charp
parm:           TRACECLASS:charp

# modinfo ti81xxfb      
filename:       /lib/modules/2.6.37/kernel/drivers/video/ti81xx/ti81xxfb/ti81xxfb.ko
license:        GPL v2
author:         Yihe HU
description:    TI TI81XX framebuffer driver
depends:        vpss
vermagic:       2.6.37 mod_unload modversions ARMv7 p2v8
parm:           debug:bool
parm:           vram:charp
parm:           mmode:int


2.3 Module 정보분석
  • vermagic 
module의 version이름으로 kernel 정보도 들어간다.
  • depends
이 module을 사용하기 위해서 필요한 module
  • parm
module 의 parameter로 module의 설정이 가능하다. 위의 예를 들면 이런식이다.
  1. charp = char pointer 로 string 
  2. int     = int
  3. bool   = true or false


e.g.  ti81xxfb  debug=true vram=0:24M,1:16M,2:6M mmode=1



3. ModuleVersion 문제 

Module은 Version을 Check하여 올리는 옵션이 있다.
가능하다면 사용하는것이 좋으며, 에러가 발생할 경우 좀더 자세한 에러를 보기 위해서
이 부분을 제거해보고 다시 TEST 해보자

3.1 HOST OS 확인 사항 

  • CONFIG_MODVERSIONS 사용시
사용할 경우 아래와 같이 CRC가 추가 된다.

$ cd linux  // linux kernel 
$ vi .config
...
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS=y
....
$ make uImage    //ARCH , CROSS_COMPILE 이미 설정 

$ cat System.map | grep 'notify_numintlines'
c02b44cc T notify_numintlines
c047f490 r __ksymtab_notify_numintlines
c04862f0 r __kcrctab_notify_numintlines
c04974f0 r __kstrtab_notify_numintlines


  • CONFIG_MODVERSIONS 미사용
심볼테이블에서 CRC 함수가 없으며,

$ vi .config
...
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS is not set
....
$ make uImage //ARCH , CROSS_COMPILE 이미 설정 

$ cat System.map | grep 'notify_numintlines'
c02b428c T notify_numintlines
c046d488 r __ksymtab_notify_numintlines
c0480c86 r __kstrtab_notify_numintlines


3.2 Target OS 확인 사항

아래와 같이 Target OS에서 Boot후 현재 심볼 테이블 확인 하여 본인의 uImage 확인
아래것은 CRC가 없기에, CONFIG_MODVERSIONS 미사용 Version이다 상위 uImage와 동일

$cat /proc/kallsyms | grep 'notify_numintlines'
c02b428c T notify_numintlines
c046d488 r __ksymtab_notify_numintlines
c0480c86 r __kstrtab_notify_numintlines 


Kernel을 Build 후 System.map과 Proc의 Symbol table을 보면 주소는 동일하다.


4. Module 관련의 에러사항

동일한 문제인데, 아래와 같이 KERNEL CONFIG을 잠시 제거하여 정확한 원인을 알자.
아래의 문제는 Kernel config을 수정 한 후 make uImage를 만들면, 심볼 테이블의 위치가
변경이 될 것이다.
Module은 Kernel의 Function을 사용을 하면 이부분에서 오류가 나는 것이다.

uImage가 만들어진 후에 이 symbol table 기반으로 관련 module을 다시 만들고 이를
file system에 적용한다면 문제가 없을 것이다.

  • 문제발생-CONFIG_MODVERSION 사용할 경우 

syslink: version magic '2.6.37 mod_unload modversions ARMv7 p2v8 ' should be '2.6.37 mod_unload ARMv7 p2v8 '
FATAL: Error inserting syslink (/lib/modules/2.6.37/kernel/drivers/dsp/syslink.ko): Invalid module format

  • 문제발생-CONFIG_MODVERSION 미사용 할 경우 
위의 CONFIG_MODVERSION을 사용하지 않을 경우, 이제 Debug을 해보자.
syslink모듈이 notify_xxx관련함수를 찾지 못하고 있다.

syslink: no symbol version for notify_numintlines
syslink: Unknown symbol notify_numintlines (err -22)
syslink: no symbol version for notify_send_event
syslink: Unknown symbol notify_send_event (err -22)


  • 해결방법-1
Module의 Version을 Check하지 하지 않지만, 다른 위 두번째 에러가 발생하여,
이부분에 대해 자세히 알고 싶어 아래와 같은 자료를 얻게 되었다.


$ make menuconfig 
Enable loadable module support --> Module versioning support

$ vi .config 
...
CONFIG_MODVERSIONS=y
...

  http://egloos.zum.com/studyfoss/v/5226996


 $ vi .config 
CONFIG_CROSS_COMPILE="" 
CONFIG_LOCALVERSION=""


  https://devtalk.nvidia.com/default/topic/921545/version-magic-does-not-match-in-kernel-module/


12/10/2016

HDMI 및 VPSS 설정

1. HDMI 와 VPSS 설정

아래설정은 기본적으로 DM8148로 SDK기준으로 작성했기때문에, TI BSP에 따라
달라질수 있겠다.
  • HDMI (DM816x AM389x DM814x AM387x)
  1. HDMI Kernel 설정 및  모듈
  2. sysfs 설정방법
  http://processors.wiki.ti.com/index.php/TI81XX_PSP_HDMI_Driver_User_Guide

  • VPSS (HDVPSS) (DM814X AM387X)  관련사항 설정
  HDVPSS의 경우 VIDEO IN/OUT을 담당해주는 Device로 현재 두개까지 지원이 가능하다.
  만약 Display0 or 1 ( VOUTx) 변경하고 싶다면, 아래와 같이 sysfs을 이용하여, 변경해주자.
  sysfs : display0
  아래와 같이 shell program을 수정을하여, LCD or HDMI Mode로 수정을 하자.

$ vi dm8148/targetfs/etc/rc5.d/S01load-hd-firmware.sh
#!/bin/sh
#
# manage HDVICP2 and HDVPSS Engine firmware

PATH=$PATH:/usr/share/ti/ti-media-controller-utils
HDVICP2_ID=1
HDVPSS_ID=2

configure_lcd()
{
    echo "Configuring fb0 to LCD"
    echo 1:dvo2 > /sys/devices/platform/vpss/graphics0/nodes
    echo 0 > /sys/devices/platform/vpss/display1/enabled
    echo 33500,800/164/89/10,480/10/23/10,1 > /sys/devices/platform/vpss/display1/timings
    echo triplediscrete,rgb888 > /sys/devices/platform/vpss/display1/output
    echo 1 > /sys/devices/platform/vpss/display1/enabled
    fbset -xres 800 -yres 480 -vxres 800 -vyres 480
}


case "$1" in
    start)
        echo "Loading HDVICP2 Firmware" 
        prcm_config_app s
        depmod -a
        modprobe syslink
        until [[ -e /dev/syslinkipc_ProcMgr && -e /dev/syslinkipc_ClientNotifyMgr ]]
        do
            sleep 0.5
        done
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 start
        echo "Loading HDVPSS Firmware"
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 start
        modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:1080p-60 i2c_mode=1
        #modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:720p-60 i2c_mode=1
        modprobe ti81xxfb vram=0:24M,1:16M,2:6M
        modprobe ti81xxhdmi
        modprobe tlc59108
      ;;
    stop)
        echo "Unloading HDVICP2 Firmware"
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 stop
        echo "Unloading HDVPSS Firmware"
        rmmod tlc59108
        rmmod ti81xxhdmi
        rmmod ti81xxfb
        rmmod vpss
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 stop
        rm /tmp/firmware.$HDVPSS_ID
        rmmod syslink
      ;;
    *)
        echo "Usage: /etc/init.d/load-hd-firmware.sh {start|stop}"
        exit 1
        ;;
esac

exit 0


  • 실제 수정 및 TEST
아래와 같이 HDVICP와 HDVPSS의 Firmware도 변경이 가능하며, HDMI 설정가능

$ cd etc/rc5.d
$ vi S01load-hd-firmware.sh

PATH=$PATH:/usr/share/ti/ti-media-controller-utils                              
HDVICP2_ID=1                                                                    
HDVPSS_ID=2 
....

case "$1" in                                                                    
   
    start)
 depmod -a
        echo "Loading HDVICP2 Firmware"
        prcm_config_app s
        depmod -a 
        modprobe syslink
        until [[ -e /dev/syslinkipc_ProcMgr && -e /dev/syslinkipc_ClientNotifyMgr ]]
        do                                                
            sleep 0.5
        done
        #firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 start
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814xbm_m3video_whole_program_debug.xem3 start
        echo "Loading HDVPSS Firmware"
        #firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 start
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814xbm_m3vpss_whole_program_debug.xem3 start
        #modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:1080p-60 i2c_mode=1
        modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:720p-60 i2c_mode=1
        modprobe ti81xxfb vram=0:24M,1:16M,2:6M
        modprobe ti81xxhdmi
      ;;
    stop)
        ....
    *)
        echo "Usage: /etc/init.d/load-hd-firmware.sh {start|stop}"
        exit 1
        ;;
esac


$ ls
S01load-hd-firmware.sh  S10telnetd              S99rmnologin
S02dbus-1               S20syslog
S10dropbear             S99gplv3-notice

/etc/rc5.d# ls -al
drwxr-sr-x    2 root     root          672 Dec 30  2015 .
drwxr-sr-x   35 root     root         5504 Dec 30  2015 ..
lrwxrwxrwx    1 root     root           29 Dec 31 05:23 S01load-hd-firmware.sh -> ../init.d/load-hd-firmware.sh
lrwxrwxrwx    1 root     root           16 Dec 30  2015 S02dbus-1 -> ../init.d/dbus-1
lrwxrwxrwx    1 root     root           18 Dec 31 05:23 S10dropbear -> ../init.d/dropbear
lrwxrwxrwx    1 root     root           17 Dec 31 05:22 S10telnetd -> ../init.d/telnetd
lrwxrwxrwx    1 root     root           16 Dec 31 05:23 S20syslog -> ../init.d/syslog
lrwxrwxrwx    1 root     root           22 Dec 31 05:22 S99gplv3-notice -> ../init.d/gplv3-notice
lrwxrwxrwx    1 root     root           19 Dec 31 05:22 S99rmnologin -> ../init.d/rmnologin


~/dm8148/targetfs/etc/rc5.d$ ll
합계 8
drwxr-sr-x  2 jhlee jhlee 4096 12월 15 16:27 ./
drwxr-sr-x 35 jhlee jhlee 4096 12월 15 14:47 ../
lrwxrwxrwx  1 jhlee jhlee   29 12월 31  2012 S01load-hd-firmware.sh -> ../init.d/load-hd-firmware.sh*
lrwxrwxrwx  1 root  jhlee   16 12월 13 14:42 S02dbus-1 -> ../init.d/dbus-1*
lrwxrwxrwx  1 jhlee jhlee   18 12월 31  2012 S10dropbear -> ../init.d/dropbear*
lrwxrwxrwx  1 jhlee jhlee   17 12월 31  2012 S10telnetd -> ../init.d/telnetd*
lrwxrwxrwx  1 jhlee jhlee   17 12월 31  2012 S20netperf -> ../init.d/netperf*
lrwxrwxrwx  1 jhlee jhlee   16 12월 31  2012 S20syslog -> ../init.d/syslog*
lrwxrwxrwx  1 jhlee jhlee   16 12월 31  2012 S20thttpd -> ../init.d/thttpd*
lrwxrwxrwx  1 jhlee jhlee   18 12월 31  2012 S30pvr-init -> ../init.d/pvr-init*
lrwxrwxrwx  1 jhlee jhlee   22 12월 31  2012 S99gplv3-notice -> ../init.d/gplv3-notice*
lrwxrwxrwx  1 jhlee jhlee   22 12월 31  2012 S99matrix-gui-e -> ../init.d/matrix-gui-e*
lrwxrwxrwx  1 jhlee jhlee   19 12월 31  2012 S99rmnologin -> ../init.d/rmnologin*

  • VPSS 설정방법
Video in/out 설정방법

  http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide_PSP_04.01.00.05#SYSFS_Software_Interfaces

  • VPSS와 VICP Firmware
VPSS와 VICP는 OS즉, BIOS6으로 기반으로한 Firmware를 사용한다.
다만, TI DSP가 C6xx 이 아닌 ARM의 Cortex-M3을 사용하여 TI용으로 별도로 Build 한 다음 Linux Booting 후에 이부분을 Loading 하는 방식으로 동작이 된다.

  http://processors.wiki.ti.com/index.php/EZSDK_Reducing_Size_Of_Media_Controller_Firmware
  • HDMI EDID 분석 
Device에서 아래와 같이 EDID를 분석을 하여 영상의 정보를 확인하자.

$ cat /sys/devices/platform/vpss/display0/edid

  https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#Enhanced_EDID_.28E-EDID.29

  • HDMI 기본 VIDEO TEST 
아래 프로그램을 이용하여 frame buffer를 TEST 해보자.
이제 제대로 설정이 되었다면, /dev/fb0, /dev/fb1 /dev/fb2 test

/home/root/dm814x-evm/usr/share/ti/ti-psp-examples/saFbdevDisplayPan를 이용하여 TEST


$ cd ~/dm8148/targetfs   // device targetfs 이동 
$ cd home/root/dm814x-evm/usr/share/ti/ti-psp-examples
$ ls
ReadMe        minimal_capture   saFbdevDisplay     saFbdevHdmiDisplay    saFbdevScalingDisplay  saLoopBackFbdev  saMmapDisplay     saWatchdog
edma_test.ko  minimal_playback  saFbdevDisplayPan  saFbdevMovingDisplay  saLoopBack             saLoopBackScale  saUserptrDisplay

나머지 기능을 프로그램을 이용하여 다양한 TEST도 해보자.


2. DM8167 관련 경우

RDK 관련사항 수정

$ vi ./dvr_rdk/mcfw/src_linux/mcfw_api/ti_vdis.c
....
                enableConfigExtVideoEncoder = TRUE;
....


12/08/2016

DM814x SDK 설치 및 관련 설정

1. EZSDK 설치

수정중
Memory Map 과 구조도 및 Firmware 이해 필요,
Linux File system 부분 수정 부분

1.1 GCC Tool Chain and SDK Download 

  • arm-2009q1-203-arm-none-linux-gnueabi.bin (Code Sourcery ARM GCC Tool Chain)
  • ezsdk_dm814x-evm_5_05_02_00_setuplinux
  http://www.ti.com/tool/linuxezsdk-davinci

1.2 개발환경구성 

  • 환경변수 재설정
아래의 환경변수는 CROSS_COMPILE과 INSTALL_MOD_PATH 등 Makefile과 Rule.make를
보고 필요한부분을 넣었다.
기본정의 Rule.make에 정의가 되어있으면 동작이 제대로 되어야겠지만,
본인이 원하는 대로 동작이 안된다면, 두 파일을 비교하여 오동작되는 부분을 파악해서
환경변수 고치던지 하는것이 편할 것이다.
나는 source 를 이용하여 아래와 같이 그냥 외부에서 설정을 해놓았다.  

$ vi setPATH.sh
#!/bin/sh
# source setPATH.sh
# INSTALL_MOD_PATH : Kernel Module 
# SYSLINK_INSTALL_DIR : syslink.ko 

export PATH=$PATH:/home/jhlee/dm8148/CodeSourcery/Sourcery_G++_Lite/bin
export EZSDK="${HOME}/dm8148/ti-ezsdk_dm814x-evm_xx_xx_xx_xx" 
export CROSS_COMPILE=arm-none-linux-gnueabi-
export ARCH=arm

export INSTALL_MOD_PATH="${HOME}/dm8148/targetfs"     // Kernel module    

$ source setPATH.sh 

  • 개발환경구성설정 (TI에서 제공)
  1. NFS Server 환경구성 
  2. TFTP 설정 
$ cd ~/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00 
$./setup.sh              // 자동으로 설정 NFS/TFTP 



1.3 EZSDK 설치시 구조 및 빌드방법



  • EZSDK 설치시 구조

$ cd ~/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00 
$ tree -d -L 2 
.
├── bin
├── board-support
│   ├── docs
│   ├── external-linux-kernel-modules
│   ├── host-tools
│   ├── linux-2.6.37-psp04.04.00.01
│   ├── media-controller-utils_3_00_00_05
│   ├── prebuilt-images
│   └── u-boot-2010.06-psp04.04.00.01
├── component-sources
│   ├── bios_6_33_05_46
│   ├── c674x-aaclcdec_01_41_00_00_elf
│   ├── codec_engine_3_22_01_06
│   ├── edma3lld_02_11_05_02
│   ├── framework_components_3_22_01_07
│   ├── graphics-sdk_4.04.00.02
│   ├── gst-openmax_GST_DM81XX_00_07_00_00
│   ├── ipc_1_24_03_32
│   ├── linuxutils_3_22_00_02
│   ├── omx_05_02_00_48
│   ├── osal_1_22_01_09
│   ├── rpe_1_00_01_13
│   ├── slog_04_00_00_02
│   ├── syslink_2_20_02_20
│   ├── uia_1_01_01_14
│   ├── xdais_7_22_00_03
│   └── xdctools_3_23_03_53
├── docs
│   └── licenses
├── dsp-devkit
│   ├── cgt6x_7_3_4
│   ├── docs
│   └── packages
├── etc
├── example-applications
│   ├── am-benchmarks-1.1
│   ├── am-sysinfo-1.0
│   ├── linux-driver-examples-psp04.04.00.01
│   ├── matrix-gui-e-1.3
│   └── omtb_01_00_01_07
├── filesystem
├── linux-devkit
│   ├── arm-none-linux-gnueabi
│   ├── bin
│   ├── etc
│   ├── include
│   ├── lib
│   ├── mkspecs
│   ├── share
│   └── usr
└── usr
    ├── lib
    └── share


$ vi Rules.make  // 아래와 같이 수정 
....
#EXEC_DIR=/home/jhlee/dm8148/targetfs/home/root/dm814x-evm   // 기본으로 이것으로 설정하며, 진행한다. 
EXEC_DIR=/home/jhlee/dm8148/targetfs                         // 필요한 것이 있다면 그 때만 이것으로 설정 
                     // 위와 같이 진행하지 않으면 Filesystem이 필요없는것을 다 포함하게되어서 커진다. 

//예를들어 아래와 같이 진행하면, EXEC_DIR/usr/lib/....   설치되므로 필요할때만 위와 같이 변경 
$ make syslink
$ make syslink_install  

//전체 명령어 확인 및 Install 될 주소 확인                                                                
$ make help

Available build targets are  :

    components_linux               : Build the Linux components
    components_dsp                 : Build the DSP components
    components                     : Build the components for which a rebuild is necessary to enable all other build targets listed below. You must do this at least once upon installation prior to attempting the other targets.
    components_clean               : Remove files generated by the 'components' target

    apps                           : Build all Examples, Demos and Applications
    apps_clean                     : Remove all files generated by 'apps' target
    install                        : Install all Examples, Demos and Applications the targets in /home/jhlee/dm8148/targetfs/home/root/dm814x-evm

    linux-devkit                   : Populate the linux devkit
    dsp-devkit                     : Populate the dsp devkit

    cmem                           : Build the CMEM kernel module
    cmem_clean                     : Remove generated cmem files.
    cmem_install                   : Install cmemk module

    syslink                        : Configure and build SYS Link for HLOS and HLOS without sample examples
    syslink_clean                  : Remove generated SysLink files
    syslink_install                : Install HLOS and RTOS link files

    linux                          : Build Linux kernel uImage and module
    linux_clean                    : Remove generated Linux kernel files
    linux_install                  : Install kernel binary and  modules

    u-boot                         : Build the u-boot boot loader
    u-boot_clean                   : Remove generated u-boot files
    u-boot_install                 : Install the u-boot image

    psp-examples                   : Build the driver examples
    psp-examples_clean             : Remove generated driver example files
    psp-examples_install           : Install the psp examples

    osal                           : Build the OSAL
    osal_clean                     : Remove generated OSAL files

    matrix                         : Build matrix application launcher
    matrix_clean                   : Remove all matrix files
    matrix_install                 : Install matrix

    omx                            : Build OMX and OMX IL Clients
    omx_clean                      : Remove OMX generated files
    omx_install                    : Install OMX IL Clients

    omtb                           : Build OMTB IL Clients
    omtb_clean                     : Remove OMTB generated files
    omtb_install                   : Install OMTB IL Clients

    media-controller-utils         : Build media controller utils
    media-controller-utils_clean   : Remove media controller utils generated files
    media-controller-utils_install : Install media controller utils

    edma3lld                       : Build the EDMA3LLD Libraries
    edma3lld_clean                 : Remove generated EDMA3LLD files

    sgx-driver                     : Build SGX kernel module
    sgx-driver_clean               : Remove SGX generated files
    sgx-driver_install             : Install SGX kernel module

    gstomx                         : Build TI GST OpenMax Plugin
    gstomx_clean                   : Remove TI GST OpenMax generated files
    gstomx_install                 : Install TI GST OpenMax Plugin

    rpe                            : Build Remote Processor Execute
    rpe_clean                      : Remove Remote Processor Execute generated files
    rpe_install                    : Install Remote Processor Execute

    all                            : Rebuild everything
    clean                          : Remove all generated files

    install                        : Install all the targets in 
                            /home/jhlee/dm8148/targetfs/home/root/dm814x-evm // 중요: EXEC_DIR 수정 후 변경됨 


  • TI에서 제공하는 User Manual
  http://processors.wiki.ti.com/index.php/Category:EZSDK

  http://developer.ridgerun.com/wiki/index.php/Getting_Started_Guide_for_DM8148_EVM

  http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_User_Guide

  http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_User_Guide#Linux_Kernel

1.4 Video TEST

  • MPEG4 HDMI Decoding TEST 
$ gst-launch filesrc location= test1.mp4 ! qtdemux name=mux mux.video_00 ! queue  ! h264parse output-format=1 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false

  • IP Camera TEST
$ gst-launch -v rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264 caps="video/x-h264,mapping=/video " ! rtph264depay ! queue ! h264parse ! omx_h264dec ! omx_mdeiscaler name=d d.src_00 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false 

$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264 ! rtph264depay ! queue ! \
h264parse output-format=1 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false
  • IP Camera TEST (1080P Resize)
$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264  ! rtph264depay ! queue ! h264parse access-unit=true ! queue ! omx_h264dec ! omx_mdeiscaler name=d d.src_00 ! 'video/x-raw-yuv, width=(int)1920, height=(int)1080' ! queue ! omx_ctrl \
display-mode=OMX_DC_MODE_1080P_30 ! gstperf print-fps=true print-arm-load=true ! omx_videosink sync=false enable-last-buffer=false

  • Gstreamer Examples
  https://developer.ridgerun.com/wiki/index.php/Gstreamer_pipelines_for_DM816x_and_DM814x
  https://developer.ridgerun.com/wiki/index.php/Gstreamer_pipelines_for_DM816x_and_DM814x#RTSP_-_Video_H264_1080.4030fps_2

  • DM8168 Firmware Debug
  https://developer.ridgerun.com/wiki/index.php?title=How_to_build_DM8168_M3_Firmware_and_debug_messages

3. KERNEL Config & Build 

위의 CROSS_COMPILE과 ARCH 환경변수가 설정이 되지 않을 경우 매번 설정하면서 실행.
미리 설정된 File은 아래 존재하며 이곳에서 보자.

$ cd ~/dm8148/
$ source setPATH.sh 
$ cd ti-ezsdk_dm814x-evm_5_05_02_00/board-support/linux-2.6.37-psp04.04.00.01
$ ls ./arch/arm/configs/       // 지원되는 Configs 확인    


$ make ti8148_evm_defconfig   // Kernel Config 설정 
$ make menuconfig             // 상위 setPATH.sh를 설정을 안했다면, ARCH=arm 선언하자.
$ make uImage                 // 상위 setPATH.sh를 설정을 안했다면  setARCH=arm 와 CROSS_COMPILE=arm-none-linux-gnueabi- 

$ cp /arch/arm/boot/uImage  /tftpboot/uImage

3.1 Kernel 분석 및 수정 

  • CTAGS와 CSCOPE 생성
vi 에서 소스분석을 더 용이하게 하기 위해서 아래와 같이 설치 및 사용하자.
  http://ahyuo.blogspot.kr/search?q=sudo+apt-get+install+ctags

  http://processors.wiki.ti.com/index.php/TI81xx_PSP_Porting_Guide


$ vi ./arch/arm/mach-omap2/board-ti8148evm.c
....
MACHINE_START(TI8148EVM, "ti8148evm")
        /* Maintainer: Texas Instruments */
        .boot_params    = 0x80000100,
        .map_io         = ti8148_evm_map_io,    // 변경된 device memory map check 
        .reserve         = ti81xx_reserve,
        .init_irq       = ti8148_evm_init_irq,   // 점검 
        .init_machine   = ti8148_evm_init,       // 변경된 device check , EVM과 현재보드와 사용하는 Device가 다름 (HDMI 변경 및 기타 IO및 사용안함)
        .timer          = &omap_timer,       
MACHINE_END


$ make uImage
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h'는 이미 갱신되었습니다.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  LD      vmlinux.o

drivers/built-in.o: In function `pcf8575_ths7375_enable':
notify_shm_drv.c:(.text+0x15f14): multiple definition of `pcf8575_ths7375_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9ce8): first defined here
drivers/built-in.o: In function `vps_ti816x_set_tvp7002_filter':
notify_shm_drv.c:(.text+0x15f8c): multiple definition of `vps_ti816x_set_tvp7002_filter'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d60): first defined here
drivers/built-in.o: In function `vps_ti816x_select_video_decoder':
notify_shm_drv.c:(.text+0x15f78): multiple definition of `vps_ti816x_select_video_decoder'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d4c): first defined here
drivers/built-in.o: In function `ti816x_pcf8575_init':
notify_shm_drv.c:(.text+0x15f50): multiple definition of `ti816x_pcf8575_init'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d24): first defined here
drivers/built-in.o: In function `pcf8575_ths7360_sd_enable':
notify_shm_drv.c:(.text+0x15f28): multiple definition of `pcf8575_ths7360_sd_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9cfc): first defined here
drivers/built-in.o: In function `pcf8575_ths7360_hd_enable':
notify_shm_drv.c:(.text+0x15f3c): multiple definition of `pcf8575_ths7360_hd_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d10): first defined here
drivers/built-in.o: In function `ti816x_pcf8575_exit':
notify_shm_drv.c:(.text+0x15f64): multiple definition of `ti816x_pcf8575_exit'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d38): first defined here
make: *** [vmlinux.o] 오류 1

$ arm-none-linux-gnueabi-readelf -s arch/arm/mach-omap2/built-in.o | grep -r pcf8575_ths7375_enable
  2521: 00009ce8    20 FUNC    GLOBAL DEFAULT    1 pcf8575_ths7375_enable

$ arm-none-linux-gnueabi-readelf -s drivers/built-in.o | grep -r pcf8575_ths7375_enable
 21182: 00015f14    20 FUNC    GLOBAL DEFAULT    1 pcf8575_ths7375_enable

$ find . -name '*.o' | sed -e 's/o$/c/g' | xargs grep -rs pcf8575_ths7375_enable
./drivers/video/ti81xx/vpss/dctrl.c:  r = pcf8575_ths7375_enable(TI816X_THSFILTER_ENABLE_MODULE);

$ grep -r pcf8575_ths7375_enable .
이진파일 ./drivers/built-in.o 와(과) 일치
이진파일 ./drivers/video/built-in.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/built-in.o 와(과) 일치
./drivers/video/ti81xx/vpss/dctrl.c:  r = pcf8575_ths7375_enable(TI816X_THSFILTER_ENABLE_MODULE);
이진파일 ./drivers/video/ti81xx/vpss/dctrl.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/vpss/built-in.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/vpss/vpss.o 와(과) 일치
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/board-ti8168evm.c /^EXPORT_SYMBOL(pcf8575_ths7375_enable);$/;" v
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/board-ti8168evm.c /^int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)$/;" f
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/include/mach/board-ti816x.h /^int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)$/;" f
./arch/arm/mach-omap2/include/mach/board-ti816x.h:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl);
./arch/arm/mach-omap2/include/mach/board-ti816x.h:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
이진파일 ./arch/arm/mach-omap2/built-in.o 와(과) 일치
./arch/arm/mach-omap2/board-ti8168evm.c:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
./arch/arm/mach-omap2/board-ti8168evm.c:EXPORT_SYMBOL(pcf8575_ths7375_enable);
이진파일 ./arch/arm/mach-omap2/ti81xx_vpss.o 와(과) 일치


$ make menuconfig   // 필요 module을 yes로 변경 및 필요 없은 것들을 제거. 

$ make uImage
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h'는 이미 갱신되었습니다.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  LD      drivers/built-in.o
drivers/media/built-in.o: In function `vps_ti816x_set_tvp7002_filter':        // 이곳에서 에러가 나서 현재 complier가 혼동하는 것 같음 
ti81xxvin_lib.c:(.text+0x30eac): multiple definition of `vps_ti816x_set_tvp7002_filter'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72d0): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7375_enable':
ti81xxvin_lib.c:(.text+0x30e34): multiple definition of `pcf8575_ths7375_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7258): first defined here
drivers/media/built-in.o: In function `ti816x_pcf8575_init':
ti81xxvin_lib.c:(.text+0x30e70): multiple definition of `ti816x_pcf8575_init'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7294): first defined here
drivers/media/built-in.o: In function `ti816x_pcf8575_exit':
ti81xxvin_lib.c:(.text+0x30e84): multiple definition of `ti816x_pcf8575_exit'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72a8): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7360_sd_enable':
ti81xxvin_lib.c:(.text+0x30e48): multiple definition of `pcf8575_ths7360_sd_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x726c): first defined here
drivers/media/built-in.o: In function `vps_ti816x_select_video_decoder':
ti81xxvin_lib.c:(.text+0x30e98): multiple definition of `vps_ti816x_select_video_decoder'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72bc): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7360_hd_enable':
ti81xxvin_lib.c:(.text+0x30e5c): multiple definition of `pcf8575_ths7360_hd_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7280): first defined here
make[1]: *** [drivers/built-in.o] 오류 1
make: *** [drivers] 오류 2

$ vi drivers/media/.built-in.o.cmd  // compile되어 만들어지는 build-in.o를 다시 분석  (video 가 dm8168로 인식)

$ find . -name plat   //             plat/cpu.h 찾아 설정이 제대로 있는지 확인 
./drivers/dsp/syslink/omap_notify/plat
./arch/arm/plat-pxa/include/plat
./arch/arm/plat-s5p/include/plat
./arch/arm/plat-versatile/include/plat
./arch/arm/plat-samsung/include/plat
./arch/arm/plat-omap/include/plat
./arch/arm/plat-nomadik/include/plat
./arch/arm/plat-spear/include/plat
./arch/arm/plat-s3c24xx/include/plat
./arch/arm/plat-orion/include/plat


$ vi ./arch/arm/mach-omap2/ti81xx_vpss.c 

$ vi ./arch/arm/mach-omap2/devices.c

$ vi arch/arm/mach-omap2/board-flash.c

  • 문제점 분석 및 해결
아래와 같이 빌드된 된 source만 찾아 grep으로 이를 검색

$ find . -name '*.o' | sed -e 's/o$/c/g' | xargs grep -rs omap_mux_init

  http://ahyuo.blogspot.kr/search?q=xargs

상위문제 Linux Kernel 사용이 되는 필요없는 Config를 제거하여 문제해결

현재 나의 Board가 EVM이 아니기 때문에 Kernel config를 점검해가면서 수정해서
필요 없는 부분을 제거하고 변경하고 TEST 하자.

3.2 NAND 변경시 관련설정

Device Drivers -> Memory Technology Devices

  http://processors.wiki.ti.com/index.php/Flash_configuration_in_the_Kernel#Enabling_NAND_Support

  http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/177166/641847#641847

12/07/2016

Uboot Nand Command 와 설정확인

1. Uboot env 설정 확인 및 설정 

TI-Davinci Series를 다시 사용할줄을 몰랐으며, 이 오래된 모델을 대학원 교육용으로 팔기위해서 간단히 설정정리하고자 한다.

  • Board Information (RAM Info)
U-Boot# bdinfo
arch_number = 0x00000BBC
env_t       = 0x00000000
boot_params = 0x80000100
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x40000000
DRAM bank   = 0x00000001
-> start    = 0xC0000000
-> size     = 0x40000000
ethaddr     = d0:ff:50:af:35:52
ip_addr     = 192.168.1.78
baudrate    = 115200 bps

  • NAND info 
U-Boot# nand info
Device 0: nand0, sector size 128 KiB

  • Uboot default env info
U-Boot# pri
bootdelay=3
baudrate=115200
autoload=yes
verify=yes
bootfile=uImage
ramdisk_file=ramdisk.gz
loadaddr=0x81000000
script_addr=0x80900000
loadbootscript=fatload mmc 0 ${script_addr} boot.scr
bootscript= echo Running bootscript from MMC/SD to set the ENV...; source ${script_addr}
ethaddr=d0:ff:50:af:35:52
ethact=cpsw
ipaddr=192.168.219.201
serverip=192.168.219.112
bootcmd=nand read 0x81000000 0x00280000 0x300000;bootm 0x81000000
bootargs=console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M

DM368 IPNC :>pri
bootdelay=4
baudrate=115200
bootfile="uImage"
setboot=setenv bootargs $(bootargs)
broadcast=192.168.0.255
gateway=192.168.0.1
ethaddr=00:0C:0C:A0:04:22
verify=no
filesize=2100000
fileaddr=82000000
netmask=255.255.255.0
ipaddr=192.168.0.207
serverip=192.168.0.210
bootcmd=nboot 0x80700000 0 0x500000;bootm 0x80700000
bootargs=mem=48M console=ttyS1,115200n8 noinitrd ip=192.168.1.168:192.168.1.210:192.168.1.1:255.255.255.0:::off rw ubi.mtd=3,2048 rootfstype=ubifs root=ubi0:rootfs cmemk.phys_start=0x83000000 cmemk.phys_end=0x88000000 cmemk.phys_start_1=0x00001000 cmemk.phys_end_1=0x00008000 cmemk.pools_1=1x28672 cmemk.allowOverlap=1 cmemk.useHeapIfPoolUnavailable=1 nohz=off highres=off clocksource=acpi_pm lpj=1077248 eth=00:0C:0C:A0:04:22
stdin=serial
stdout=serial
stderr=serial
ver=U-Boot 1.3.4 (Jun  5 2013 - 12:45:48) DM368-IPNC-5.1.0

Environment size: 843/131068 bytes


CPSW관련
  http://processors.wiki.ti.com/index.php/AM335x_CPSW_(Ethernet)_Driver's_Guide

  • Uboot Config 
U-BOOT는 환경설정은 Device의 의존적인 환경변수존재하며, Uboot도 Kernel Config처럼 Config를 설정하여 추가하고 싶을 설정,
즉 Command를 추가가능하다. 또한 Config 설정에서 각각의 프롬프트 이름을 비롯하여 default env 설정부분을 Uboot Source에서 직접 변경가능하다.

아래는 기본적인 테스트이며, 최종으로 본인의 default env 설정확정되면, Uboot Source에서 default env 관련 부분을 수정하도록 하자.

1.1. Uboot 에서 Kernel 부팅시 문제사항 정리 

  • U-BOOT에서 uncompressing 한 후 바로 멈춤경우
Bytes transferred = 2720236 (2981ec hex)
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux-2.6.37
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2720172 Bytes = 2.6 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.  


  • 기본Boot 문제해결방법 (이외방법은 아래 사이트 참조)
Serial 설정 문제확인
bootargs 설정문제 해결하기위해서 uboot에 rootwait를 추가.

printenv bootargs
bootargs=console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait

세부사항은 kernel argument 참조
  https://linux-sunxi.org/Kernel_arguments

  • 일반적인 Boot 문제사항들 (아래사이트 확인) 
일반적으로 boot 시 발생하는 문제사항 정리
  http://processors.wiki.ti.com/index.php/Kernel_-_Common_Problems_Booting_Linux
bootmem 에러나서 관련내용
  http://jake.dothome.co.kr/bootmem/

  • U-BOOT NAND 문제사항
   jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
   https://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/244611
   http://naito.tistory.com/entry/jffs2scaneraseblock-Magic-bitmask-0x1985-not-found-at-0x0000fcac-0x0b45-instead

  • NXP에서 제공하고 U-Boot Quick Reference
IMX6을 하면서 읽게되었지만, 역시 문서가 쉽고 이해하기가 쉬운거 같다
  http://www.nxp.com/files/32bit/doc/quick_ref_guide/MEDIA5200UBPG/MEDIA5200UBPG.pdf


1.2. Uboot 기본환경변수로 테스트  

Uboot가 booting 한 후 Uboot의 bootdelay 설정시간이후에 Uboot의 bootcmd는 자동실행되어 Uboot의 bootargs를 kernel에 전달하여 Kernel Boot를 진행한다.


  • DM368 설정 (bootcmd)
DM368 IPNC :> setenv verify no                                  // CRC에러 
DM368 IPNC :> setenv bootcmd 'nboot 0x80700000 0 0x500000;bootm 0x80700000'

  • DM8147 설정(bootargs)
아래와 같이 ${} 본인이 원하는 환경변수 별도로 이용하여 각 설정을 변경

U-Boot# setenv bootargs_ubifsrw "console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M"
U-Boot# setenv bootargs_ubifsro "console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 ro ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M"
U-Boot# setenv bootargs "${bootargs_ubifsro}" 
U-Boot# setenv bootargs "${bootargs_ubifsro} ${serverip}"  

bootcmd 인 경우 좀 특별한데 명령어들을 자동으로 실행해주는 환경변수이므로 보다 주의해서 작성하자.
Uboot는 기본적인 Shell 처럼 간단한 Uboot Script도 작성가능하므로 이를 최대이용
  1. 기본적으로 다른 환경변수는 표시는다음과 같이 한다.    ${ name }
  2. Command 구분자 ';' 세미콜론을 사용한다. 
  3. bootcmd에는 run 명령어로 다른 환경변수를 실행가능하다. 
  4. bootcmd에는 기본명령어인 setenv 비롯하여 uboot command가 실행가능
  5. 이외 외부 script 및 if 문도 사용가능        

* 주의사항  setenv or set 할 경우 "" or '' 권하며, 하지 않아도 설정은 되지만 간혹 제대로 설정이 되지 스페이스문제로 설정이 안되는 경우가 발생한다. 

1.3. Uboot Network/Video 기본설정 

bootargs 설정을 NFS로 변경하기 위해서 아래와 같이 각각 변경을 해주고 최후에 bootargs의 root를 network로 설정

NFS설정을 위해 아래와 같이 Uboot에 Network 기본설정 아래와 같이 해준다.
  • Network 환경설정 및 확인 
U-Boot# set serverip 192.168.1.100
U-Boot# set ipaddr 192.168.1.39
U-Boot# set gatewayip 192.168.1.1
U-Boot# set netmask 255.255.255.0
U-Boot# set hostname "jhlee-VirtualBox"
U-Boot# set nfspath "/home/jhlee/dm8148/targetfs"

DM368 IPNC :> setenv ethaddr 00:0C:0C:A0:04:22
DM368 IPNC :> setenv ipaddr 192.168.1.20
DM368 IPNC :> setenv gateway 192.168.1.1
DM368 IPNC :> setenv serverip 192.168.1.100
DM368 IPNC :> setenv netmask 255.255.255.0


  • Host에서 Hostname 확인 
 jhlee@jhlee-VirtualBox:~/dm8148$ hostname
jhlee-VirtualBox


* 주의사항 
  1. set은 setenv와 동일 (가끔씩 set이 동작이 안될때는 setenv로 변경)
  2. hostname 가급적 server이름을 설정해야겠지만, 아무거나 설정해도 무방하다.
  3. nfs mount test는 server에서 반드시 TEST 해보자. 

  • DM814x Video 설정 (2G M설정)
  1. mem =xxx : linux memory 설정
  2. vpssm3

set videoset "notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M vram=50M ti814xfb.vram=0:24M,1:16M,2:6M"

  1. 기본설정확인 (Start 0x80000000  : Size : 512M or 1024M or 2048M) 
  2. 현재 2GM사용하지만, 512M와 1024M 만 지원 (1024 Memory Map 선택)
  3. 0xC0000000 이후 부터 Linux로 모두 할당 
  4. Memory를 연속적으로 설정하지 않았기때문에, 이부분 설정을 따로 해야할 것 같다.
설정시 아래의 Memory Map을 반드시 참조.
  http://processors.wiki.ti.com/index.php/EZSDK_Memory_Map
  http://lxr.linux.no/linux/mm/Kconfig


1.4 Uboot의 bootargs 와 bootcmd 

  • UBIFS 와 NFS Boot Mode (bootargs의 분할)
현재 UBIFS를 RW모드와 RO모드 두개 설정하며, NFS도 일반모드 설정과 뒤에 다시 MEM 설정하기에 이를 지운다.


  • bootargs를 여러개 옵션으로 분할
U-Boot# set bootarg_consol "console=ttyO0,115200n8"
U-Boot# set bootarg_debug  "earlyprintk rootwait=1"
U-Boot# set bootarg_etc    "noinitrd"  
U-Boot# set bootarg_ubifsro  "ro ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs"
U-Boot# set bootarg_ubifsrw "rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs"
U-Boot# set bootarg_nfs "rw root=/dev/nfs nfsroot=${serverip}:${nfspath},nolock"
U-Boot# set bootarg_net "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off"
U-Boot# set bootarg_netnone "ip=none" 

  • bootargs를 조합하여 설정진행 
setnenv bootargs를 상위 변수들을 조합하여 재설정

U-Boot# setenv args_nfs 'setenv bootargs ${bootarg_consol} ${bootarg_debug} ${bootarg_etc}  ${bootarg_nfs} ${bootarg_net} ${videoset}'
U-Boot# setenv args_ubiro 'setenv bootargs ${bootarg_consol} ${bootarg_debug} ${bootarg_etc}  ${bootarg_ubifsro} ${bootarg_netnone} ${videoset}'
U-Boot# setenv args_ubirw 'setenv bootargs ${bootarg_consol} ${bootarg_debug} ${bootarg_etc}  ${bootarg_ubifsrw} ${bootarg_netnone} ${videoset}'

  • bootargs를 UBIFS로 직접설정
DM368 IPNC :> setenv bootargs mem=48M console=ttyS1,115200n8 noinitrd ip=192.168.1.168:192.168.1.210:192.168.1.1:255.255.255.0:::off rw ubi.mtd=3,2048 rootfstype=ubifs root=ubi0:rootfs cmemk.phys_start=0x83000000 cmemk.phys_end=0x88000000 cmemk.phys_start_1=0x00001000 cmemk.phys_end_1=0x00008000 cmemk.pools_1=1x28672 cmemk.allowOverlap=1 cmemk.useHeapIfPoolUnavailable=1 nohz=off highres=off clocksource=acpi_pm lpj=1077248 eth=00:0C:0C:A0:04:22

  • bootargs를 NFS로 직접설정
  1. nfsrootdebug: nfs debug 가능
  2. rootdelay=4: filesystem mount 시점을 조절가능
  3. earlyprintk: KERNEL 의 CONFIG_EARLY_PRINTK=y 설정후 가능
  4. quiet: 에러 이외의 메세지를 보고 싶지 않다면 사용

DM368 IPNC :> setenv bootargs 'console=ttyS1,115200n8 rw mem=48M root=/dev/nfs nfsrootdebug rootdelay=4 nfsroot=192.168.1.100:/home/jhlee/dm368/mt5/Source/ipnc_rdk/target/filesys_dm368,nolock mem=48M cmemk.phys_start="0x83000000" cmemk.phys_end="0x88000000" cmemk.phys_start_1="0x00001000" cmemk.phys_end_1="0x00008000" cmemk.pools_1="1x28672" cmemk.allowOverlap=1 eth=00:0C:0C:A0:04:22 ip=192.168.1.168 nohz=off highres=off clocksource=acpi_pm lpj=1077248 earlyprintk'

NFS Boot Mode
  https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
Kernel Argument (bootargs)
  https://www.kernel.org/doc/Documentation/kernel-parameters.txt

  • bootcmd의 분할과 bootargs 설정 
  1. dhcp : dhcp client로 동작 tftp로 uImage가져온다.
  2. autoload: dhcp에서 자동으로 tftp로 uImage 가져오는 작업을 막는다.
  3. loadaddr: tftp 할 경우 loadaddr주소
  4. tftp or tftpboot: tftp로 data를 가져온다.

아래와 같이 다양한 bootcmd를 지원가능하도록  분할하여 쉽게 구성하도록하자

U-Boot# set autoload no
U-Boot# set loadaddr 0x81000000

U-Boot# set bootcmd_nfs1 'dhcp;run args_nfs; tftp uImage-dm814x-evm.bin;bootm'
U-Boot# set bootcmd_nfs2 'dhcp;run args_nfs; tftp 0x81000000 uImage;bootm'
U-Boot# set bootcmd_nfs3 "dhcp;run args_nfs; tftpboot uImage-dm814x-evm.bin;bootm"

U-Boot# set bootcmd_nfs  'run args_nfs; tftp uImage;bootm'
U-Boot# set bootcmd_ubi  "run args_ubirw;nand read 0x81000000 0x00280000 0x300000;bootm 0x81000000"
U-Boot# set bootcmd_ubi_me  'run args_ubirw; tftp uImage;bootm'

  •  bootcmd의 NFS/UBI_ME/UBI 설정
U-Boot# set bootcmd "run bootcmd_nfs"
U-Boot# set bootcmd "run bootcmd_ubi_me"
U-Boot# set bootcmd "run bootcmd_ubi"

  • U-BOOT의 환경변수 설명 (반드시 확인)
  http://www.denx.de/wiki/DULG/UBootEnvVariables
  http://www.denx.de/wiki/view/DULG/UBootEnvVariables

  • U-BOOT NFS 환경설정 
  http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_U-Boot#Environment_Settings_for_NFS_Filesystem
  http://www.denx.de/wiki/publish/DULG/to-delete/LinuxNfsRoot.html


2. Board 의 정보파악 후 검증

  • Memory info 
Memory Start Address 와 Memory Size를 bdinfo로 파악하자.
이 정보가 잘못되었다면, datasheet를 이용하여 파악하자. (Memory Map)

  • NAND info 
Nand의 Memory Map 주소와 각 영역의 Size를 파악하자.
제대로 동작한다면, Kernel에서 mtd에서 알려준다.

 
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xcc (Micron )
Creating 5 MTD partitions on "omap2-nand.0":
0x000000000000-0x000000020000 : "U-Boot-min"
0x000000020000-0x000000260000 : "U-Boot"
0x000000260000-0x000000280000 : "U-Boot Env"
0x000000280000-0x0000006c0000 : "Kernel"
0x0000006c0000-0x000020000000 : "File System"

Kernel command line: console=ttyO0,115200n8 earlyprintk noinitrd rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs notifyk.vpssm3_sva=0xBF900000 mem=364M@0x80000000 mem=320M@0x9FC00000 mem=1023M@0xC0000000 vmalloc=500M ip=none vram=50M ti814xfb.vram=0:24M,1:16M,2:6M

nand page size : 2048


  • 기본검증방법 
Memory Size를 정확히 파악한 후 Image의 size를 생각하여, 두 Memory 주소를 얻는다.
본인은 1G Memory이며, 0x8000 0000 : DDR START ADDR
                                0x4000 0000 : 1 G

0x81000000  부터 U-BOOT Application을 사용가능하다고, U-BOOT msg에서 파악.
0xA0000000  Size : 0x20000000 : 256M

위의 nand address를 파악해서 이제 검증시작하자.

  https://processors.wiki.ti.com/index.php/Booting_Linux_kernel_using_U-Boot

2.1 Uboot의 Memory TEST

Uboot에서 사용해보니, 너무느리며, 비효율적이다. 만약 시간이 많다면, 사용하고, 시간이 없다면, tftpboot kernel을 이용하여 DRAM을 검증하자.
그리고, NFS System도 같이 이용한다면 더욱 좋을 것 같다.

  • Uboot의 memory test 
U-Boot#  mtest 0x81000000 
U-Boot#  mtest 0x81000000  0x82000000


2.2 Uboot의 NAND TEST

NAND의 Test의 목적은 bad block문제로 인하여 nand boot가 제대로 안되는 것인지 파악하고, NAND의 read/write가 제대로 동작이 되는지를 확인하는 것이다.
일단 nand info를 통해 nand 기본정보를 파악하고, bad block이 scrub 이 되었는지  확인해보자.

nand bad를 해보면 bad block 정보를 읽어 표시해준다.
nand createbbt 명령어가 없을 경우 최근 version uboot는 이 명령어가 사라져 버리고 자동으로 scan해서 만들어 버리는 것 같다.
Uboot version마다 다를수 있으므로, 주의하자

2.3 NAND Image 기본검증

일단 tftpboot를 통해서 kernel의 Image 검증한 후 각각의 NAND Read/Write를 하여 문제없는지 확인하자.

  • TFTPBOOT TEST
DM368 IPNC :> tftpboot 0x80007FC0 dm368ipnc/uImage_ipnc_dm368
DM368 IPNC :> bootm 0x80007FC0;

  • How To update KERNEL & Filesystem
DM368 IPNC :> tftpboot 0x80700000 dm368ipnc/uImage_ipnc_dm368
DM368 IPNC :> tftpboot 0x82000000 dm368ipnc/ipnc_dm368_ubifs

DM368 IPNC :> nand erase 0x500000 0x400000               // NAND ERASE 4MB  
DM368 IPNC :> nand write 0x80700000 0x500000 0x400000    // KERNEL WRITE 4MB

DM368 IPNC :> nand erase 0x900000 0x2800000              //NAND ERASE 4MB
DM368 IPNC :> nand write 0x82000000 0x900000 0x2800000   //FS  WRITE 40MB


  • NAND Image 검증
DM368 IPNC :> tftpboot 0x80700000 dm368ipnc/uImage_ipnc_dm368
DM368 IPNC :> nand read 0x82000000 0x500000 0x400000   // KERNEL READ 4MB
DM368 IPNC :> cmp 0x80700000 0x82000000  0x38a420      // check tftpboot 

상위와 동일함
U-Boot#  tftp 0x81000000 uImage
Bytes transferred = 2215324 (21cd9c hex) 

U-Boot#  nand read 0xA0000000 0x280000 0x21cd9c 

// 553831 = 2215324/4 bytes 

U-Boot#  cmp   0x81000000 0xA0000000 553831
U-Boot#  cmp.l 0x81000000 0xA0000000 553831
 
word at 0x8121cd9c (0x605f9029) != word at 0x8221cd9c (0xffffffff)
Total of 553831 words were the same 

11/29/2016

Google Apps Script

1. Google Apps Script 관련사항 

구글에서 제공하는 datasheet와 document 관련된 apps에 관련 script가 존재하며,
본인은 datasheet를 가지고 간단한 script가 간단히 필요했기에 이를 가지고  TEST 한 결과 쉽게 작성가능했다.

다른 Apps도 쉽게 가능할 것 같으며, 복잡한 Apps은  Javascript를 전문적으로하는 Web 기술이 있어야 할것으로 생각된다.
하지만 구글에서 Manual을 제공을 하고 있어 , 이를 따라하면 누구나 쉽게 작성가능하다.
다만 한글 Manual 지원이 안되어서 문제일 뿐이다.


손쉽게 영어 단어 check script를 만들기 위해서 이것을 시작했지만, 별로 도움이 안되고
그냥 손으로 쓰는 것이 가장 도움이 되는 것 같다.

2. Datasheet Apps Script 

본인의 Gdrive에 가서 Datasheet 만들거나, 가진것을 가지고 TEST 해보자.
  1. open Google Datasheet 
  2. Tools > Script editor  or 도구->스크립터 편집기 실행 
  3. Test Function을 만들어보자. 
  4. Project를 저장하고, 권한을 설정하고 실행을 해보자. 
  5. 스크립터 편집기에서 보기->로그 보면 실행된 결과를 확인 가능하다. 
아래의 화면은 Script 편집기를 통해서 새로만든 프로젝트이다.
이곳에서 보기->로그를 통해 간단히 확인 가능하다.


// Google의 example을 간단히 TEST 

function logProductInfo() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.getDataRange().getValues();
  for (var i = 0; i < data.length; i++) {
    Logger.log('Product name: ' + data[i][0]);
    Logger.log('Product number: ' + data[i][1]);
  }
}







3. Datasheet 에 App Script TEST  

3.1 Basic Datasheet Apps Script  


아래와 같이 메세지를 알려주는 간단한 함수를 만들어 보자,
alert message로 변경을 하고 datasheet 값을 읽어 매번 알려주는 것이다.
위의 log를 alert로 변경을 하고, 너무 길면 적당히 알려주도록 15까지만 하자.
아래는 Javascript와 동일하다.

function logProductInfo() {
  
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.getDataRange().getValues();
  var ui = SpreadsheetApp.getUi();
  var numfinsh=15;

  if(data.length < 15)
       numfinsh = data.length;
    
  for (var i = 0; i < numfinsh; i++) {
   
    var msg = "Test2 Number:" + i + " /" + data.length + "\n\n";
    
    msg += data[0][2] + ":" + data[i][2] + "\n";
    msg += data[0][3] + ":" + data[i][3] + "\n\n";
    msg += data[0][4] + ":"+ data[i][4] + "\n";         
    
    ui.alert(msg);                  

}
    
}



  • TEST 하는 방법
Google Driver에 스프레드시트 보기 및 관리 허가를 받는다.
실행버튼을 누르면 실행이 된다.

* 만약동작이 되지 않는다면 프로젝트에서 문서를 찾아서 직접 넣어 추가해보자.
  게시->부가기능으로 테스트

  • 실제적용하는 방법
트리거를 사용하는 방식, 즉 이벤트가 발생할때 함수를 호출하도록 설정.
위와 같이 하면 문서의 이벤트 발생시마다 함수가 호출이되어 적용이 됨


3.2 개선된 Datasheet Apps Script  

트리거로 파일 오픈할때 onOpen을 적용하여,  "My Menu" 만들어 함수를 실행하도록하자.
원하지 않는다면, 멈추는 기능을 추가하자.
물론 아래도 버그가 있다,
mySecondFunction이나, myThirdFunction을 구현을 안했다.
추후 TEST를 위해서 더 유지를 했다.


function onOpen(e) {
   SpreadsheetApp.getUi()
       .createMenu('My Menu')
       .addItem('My menu item', 'my1stFunction')
       .addSeparator()
       .addSubMenu(SpreadsheetApp.getUi().createMenu('My sub-menu')
           .addItem('One sub-menu item', 'mySecondFunction')
           .addItem('Another sub-menu item', 'myThirdFunction'))
       .addToUi();
}
 

function my1stFunction() {
  
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.getDataRange().getValues();
  var ui = SpreadsheetApp.getUi();
    
  for (var i = 0; i < data.length; i++) {
   
    var msg = "Test Number:" + i + " /" + data.length + "\n\n";
    
    msg += data[0][2] + ":" + data[i][2] + "\n";
    msg += data[0][3] + ":" + data[i][3] + "\n\n";
    msg += data[0][4] + ":"+ data[i][4] + "\n";         
    
    var result = ui.alert(msg,ui.ButtonSet.OK_CANCEL);   
    
    if (result == ui.Button.CANCEL)
          break;        
  }    
}



실제로 적용 해보면, 어렵지 않으며, 약간의 시간이 있다면, 메뉴얼 읽는 시간과
소스 가지고 와서 붙히기 능력과 있으면 된다. ㅋㅋㅋ

메뉴를 바꾸고 싶다면 아래의 사이트에서 본인이 원하는 메뉴로 바꿔보고 테스트 해보자.
어렵지 않다.


4. Apps Script 관련사항  

프로젝트를 보면 다양한 기능을 제공을 하고 있으며, 프로젝트를 동시에 여러개를 운영이 가능하다.
아래는 간단히 기능만 소개한다.
  • 게시->배포기능  
  1. 웹앱 배포   : 크롬 웹 방식으로 하는 것 같음 
  2. API 실행가능으로 배포  :  Google API에 추가하는 식으로 하는 것 같음. 
  3. 스프레드 부가기능으로 배포:  다른 사람도 나의 Script을 사용가능한 것 같음.  
    API 배포방식하면, Gdrive 공유문서에, 배포된 API 연결하여 동작이 가능할 것 같다.
    그러면 HTML안에서 Javacript를 넣어 이를 다 Control이 가능할 것 같다.
    위 사항들은 어디까지나 개인적인 생각일뿐이다.
    아직 배포를 못해봤으며, Key 값이 없다.

    Key가 존재하면, 리소스->라이브러리 도 이용가능하고 다양하게 작성이 가능할 거 같다.
  • 프로젝트 기본정보확인 (파일->속성) 
     프로젝트 관련된 Script ID와 Key 정보가 있으며, 프로젝트 관련 정보가 있다.
     저번에 Google API를 사용하려고 Key를 얻을려고 했더니, $100까지만 무료이고,
     이후 유료인걸로 기억하고 있어, 추후 더 자세한 사항을 읽어봐야겠다.
     나중에 필요하다면 회사차원에서 해보겠다.


  • Google API 적용   
      프로젝트->리소스->고급 Google 서비스 

      다른 Google API를 이곳에서도 적용이 가능한 것 같다.
      이것을 하려면, Key값을 얻어야 할것 같다.
      위의 파일->속성에서 보면 자신이 Key를 가지고 있는지 확인 가능하다.


참고사항 
  • Dialogs Script 
   Dialog Box (alert , prompt box, custom box)
   https://developers.google.com/apps-script/guides/dialogs
   https://developers.google.com/apps-script/reference/base/button-set

  • Custom Menu 
   Google Apps에서 본인이 원하는 Menu를 만들수 있다
   https://developers.google.com/apps-script/guides/menus

  • Datasheet Apps Script Manual
   DataSheet에 관련된 Apps script
   https://developers.google.com/apps-script/reference/spreadsheet/sheet
   https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#getUi()

11/24/2016

Laptop Upgrade 계획

1. My Laptop 기본사양 확인

  • Laptop 기본사양 
  1. 제조사 : HP 
  2. 모델명:  Pavilion DV6 6124tx
  3. 제품번호 : QB388PA#AB1
    확인방법
        HP Support Assistant 사용

  • 세부사양 
    OS: Windows 7 Home Premium K 64-bit Service Pack 1     
         CD 미제공 및 HDD의 Recovery로 복구
  1. CPU:  Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz
  2. Memory: 8GB
  3. Graphic Device1: Mobile Intel(R) HD Graphics (1920x1080)
  4. Graphic Device2: Radeon (TM) HD 6770M      (1920x1080)
  5. HDD: TOSHIBA MK1059GSM - 931.51 GB       (SATA2 Type)
  6. ODD: DVD A  DS8A5LH                              (Slim SATA)

  • Laptop 관련정보 
    아래의 정보를 보면, 현재 Laptop에 비해서도 성능이 많이 떨어지지 않는다.
    다만 SSD와 CPU 성능 약간 아쉬울 뿐이다.

    http://www.bodnara.co.kr/bbs/article.html?num=85730
    http://www.noteforum.co.kr/news/?nm=14947

  • HDD Interface 
    현재 HDD가 SATA2 인 3GBps를 사용하고 있으며
    AHCI가 SATA3도 지원가능하다고 한다.

    https://www.cnet.com/products/toshiba-mk1059gsm-hard-drive-1-tb-sata-3gb-s-hdd2k11/specs/

  • ODD Interface
    SATA Interace이며, Multibay or Mutiboost를 이용하여 추후 HDD를 이곳에 추가.

    http://www.ebay.com/itm/HP-DS-8A5LH-DVD-RW-Drive-Burner-Writer-SATA-LS-SM-DL-Notebook-Laptop-Internal-/181122052833

    내 Laptop 은 구입한지 벌써 5년이 넘었고, 100만원 정도에 구입한 것 같다.
    그 당시 가성비를 생각하면 , 상당히 잘 구입한 Laptop이다.

  • HW Upgrade 계획 
  1.  SATA (1GB HDD) -> SATA2 or 3 (250GB)   MLC Type로 변경 
  2.  사용중 1GB HDD를 ODD를 제거하고 멀티부스트 를 이용하여 추가

  • Upgrade 시 문제사항 
  1. HDD->SDD로 변경시 이를 복구하는 방법
  2. HP Recovery 기능 동작  (기능포기)
  3. Norton Ghost or Arcro Image 사용할 예정 ( 기능포기)

  HP Recovery를 이용하여 SSD에 기본복구
  http://soul0.tistory.com/249   

  • HP의 공식입장
  -요약 복구디스크로 HDD->SSD로 변경시  새 Window 필요
  http://h30491.www3.hp.com/t5/forums/forumtopicpage/board-id/laptop/thread-id/4473
  http://h30491.www3.hp.com/t5/forums/forumtopicpage/board-id/laptop/thread-id/2848

  • 고스트 할 경우 문제 발생 
  http://www.x86osx.com/bbs/view.php?id=osxqna&page=807&sn1=&divpage=7&sn=off&ss=on&sc=on&select_arrange=headnum&desc=desc&no=41764


2. Laptop Upgrade 하기전 확인사항 


  • 기본성능확인 
       제어판 -> 제어판 검색 ( 성능 정보 검색)

  1. 아래 그림에서 (주 하드디스크)  체크 



  • HDD -> SSD 교체시 확인 사항 
  1. SATA Controller 가 SATA2 와 3 지원가능여부 
  2. 구입할 SSD 가격 및 성능고려  (SATA2 or SATA3 지원여부)
  3. 현재 Window System 복구 or 복원 방법 
 
  • ODD -> HDD 교체 시 확인 사항 
  1. 멀티부스트(Multiboost) Interface 확인 (E-IDE or SATA 
  2. 멀티부스트(Multiboost) 사이즈 확인  (12.7mm 확인)

    *멀티부스트(Multiboost) : ODD 즉 DVD 를 제거하고, HDD를 넣어 ODD Interface 연결하는 장치
    http://rapwing.tistory.com/entry/%EC%9D%B4%EA%B2%83%EC%9D%B4-%EB%B0%94%EB%A1%9C-%EB%A9%80%ED%8B%B0%EB%B6%80%EC%8A%A4%ED%8A%B8%EC%9D%98-%EC%8B%9C%EC%9E%91%EA%B3%BC-%EB%81%9D


    아래사이트에서  동일모델 교체 성능확인
    http://dsct1472.tistory.com/512
    http://ceoparkjh.tistory.com/entry/HP-%EB%85%B8%ED%8A%B8%EB%B6%81-dv66124tx-RAM-SSD-%EC%9E%A5%EC%B0%A9


3.  구입물품 결정 

  • SSD 구입 (MLC type, 256 or 250 or 512 ) , 마이크론 Crucial MX200
  • Multiboost 12.7mm SATA to SATA Type 
  • 베젤 구입 (옵션) 
  • USB SATA Connector (옵션)
  • USB 32G (복구용)

  http://itempage3.auction.co.kr/DetailView.aspx?ItemNo=A560306033
  http://66.232.142.245/front/productlist_morning.php?code=073004009000&listnum=&sort=&block=&gotopage=

4.   교체 작업 전 

  • HP Setup Manager 실행  

     백업설정 -> 복구디스크 만들기->HP Recovery Manager 실행

  1. 복구미디어 만들기 (복구 미디어 오직한번)
  2. USB 플래시 (13GB) or DVD (4개) or DVDDL (2개)  중 선택
  3. 복구디스크 만들기 (본인 USB) 

    설사 제대로 동작이 되지 않더라도, 나의 HDD를 다시 복구하기 위해서라도 필요함.
 
    *주의
    이 작업은 한번밖에 기회를 주지 않기 때문에, 이 저장매체를 잘보관해야함

  • HP Laptop 부팅시 
  1. ESC Key :  BIOS 설정 및 Laptop 상태 보기 
  2. F11 Key :  HP Recovery 

4.  교체방법

  • 배터리 제거 및 교체 동영상
    https://www.youtube.com/watch?v=ND6GXwhuMOY

5.  가성비 

가성비를 따져보니, 교체비용이나, Laptop을 비슷한것을 사나 비슷한 것 같으며, 삽질만하고 별 소득이 없는 것이라고 판단이 된다

11/22/2016

DevOps 관련링크 (수정중)

Cloud를 관련내용을 보다가 요즘 하도 DevOps 라는 용어가 많아 관련내용을 정확히
알기 위해 알아 보았다.

  • DevOps : Development와 Operation의 합성어라고 한다. 

처음 Filesystem인 줄 알았는데, 개발 방법론 및 문화이며 아래에서 자세한 내용들을
알수가 있었다.

  https://en.wikipedia.org/wiki/DevOps

  http://bcho.tistory.com/815
  http://bcho.tistory.com/817

11/20/2016

한국 IT 반도체 관련분석

최근 외국계 반도체 회사 고용 및 관련부분이 궁금해서 관련 뉴스를 정리하고
관련된 부분을 정리해가려고 한다.

반도체 외국계회사라고 해서 다 어려운 것은 아니지만 대체적으로 거의 어렵다.
근본적인 원인은 중국이겠지만, 한국의 제조사 기업들이 많이 힘들기 때문이다.


  • 핸드폰관련부분

주제조사가 LG/SAMSUNG/팬택 이겠지만, 거의 LG와 Samsung이겠지만,
관련 외국계 반도체 회사 사업부가 축소되고  구조조정 되어가지고 있다.
현재 다시 이부분은 자동차쪽으로 다시 쏠리는 편이지만 아직도 불안하다


  • 영상업체 제조사 

대표적으로 IP Camera/DVR/NVR 및 기타 다른 영상장치들은 중국기업때문에 점점
매출이 하락으로 가고 있으며 이부분은 어떻게 할수가 없는것 같다.
중국의 hisilicon 칩업체의 등장에 중국 영상제조사로 인하여 이 제조사들은 고급전략이 아닌 이상은 힘이든것 같다.


1. 일반적인 반도체 기사 모음 


  • 2017 03월 기사 
한국 반도체 회사들의 매출 및 회사들 10곳 중 7곳이 1년사이에 30%로가 영업이익이 많이 떨어졌다고 하며, 한국 시장철수도 많이 일어나고 있다고 한다.

아래의 기사를 보면 15개 업체의 매출과 영업이익을 확인가능하지만, 기사를 보면 영업이익이 상당히 많이 늘어난곳도 종종 있지만,
최근 영업이익과 매출은 완벽히 믿을수 없다.

  http://blog.siliconroad.com/bbs/board.php?bo_table=sub1_2&wr_id=876&sca=%EB%B0%98%EB%8F%84%EC%B2%B4&page=2
  http://www.etnews.com/20170306000301


  • 2016년 10월 관련기사 

최근 많은 외국계 반도체 회사의 인수합병으로 사업부 축소로 인하여 많은 엔지니어들의 고용이 불안하며,
재 취업이 힘들다는 기사이다


  1. Avago의 Broadcom 인수
  2. NXP의 Freescale 인수 
  3. Qualcomm CSR 인수

  http://www.etnews.com/20161027000335
  http://blog.siliconroad.com/bbs/board.php?bo_table=sub1_2&wr_id=465&sca=%EB%B0%98%EB%8F%84%EC%B2%B4&page=1
  https://www.qualcomm.com/news/releases/2015/08/13/qualcomm-completes-24-billion-acquisition-csr



  • 2015년 9월 관련기사 


  1.   Marvell의 모바일사업부 축소 및 구조조정 

  http://kotrasv.org/board/bbs/board.php?bo_table=i_news&wr_id=741&page=5 
  http://www.fnnews.com/news/201509271402493382


11/08/2016

adb tools 설치 및 android 해상도 변경방법

1. Android Tools Install 

 https://developer.android.com/studio/index.html?hl=ko

 adb tool 만 사용한다면, android studio는 별도로 필요가 없으며,
아래의 설치 프로그램만 설치

 명령줄 도구만 다운로드
  • installer_r24.4.1-windows.exe  : adb , fastboot 포함 




  • 설치후 확인 

 C:\Program Files (x86)\Android\android-sdk\platform-tools 

2. Android 에서 해상도 변경 

해상도 변경 목적은 Samsung의 Smart view에서 화면이 너무 작게 나와서,
해상도를 변경통해 TV에서 전체화면으로 보려고 했으나 실패

아마도, Smart View Device에서 지원이 되어야 하는 것 같다.


  1. window의 cmd 실행 
  2. adb shell 실행  ( PATH가 설정이 되지 않았다면, 위 디렉토리 찾아가서 실행)
  3. echo %PATH%  (본인 PATH 확인방법) 

주의사항.

  • usb driver 설치 
  • phone이 usb 연결이 되어 있어야 함. 
  • 개발자모드로 전환하여, USB Debugging 허용 

2.1 adb shell 

window manager 인것 같고, density 는 dpi의 정보 인것 같으며,  dot per inch 이다.
overscan은 margin인 것 같은데, 추후 더 살펴보고 정리해야하겠다.


$ wm density 480
$ wm size 720x1280

원상태로 복귀

$ wm size reset
$ wm density reset


 각종 해상도 참조
 https://ko.wikipedia.org/wiki/%ED%95%B4%EC%83%81%EB%8F%84

 상위 명령어 참조
 http://android.stackexchange.com/questions/115484/resize-screen-to-display-only-on-working-part-of-semi-functional-touchscreen

 상위 명령어 참조
 http://dsct1472.tistory.com/565
 http://threeword.com/147

11/01/2016

Heap 과 Heap sort 와 Priority Queue

1. Heap 이란? 

  • 기본구조
Heap은 일종의 이진트리 구조로 구성이 되며 (Binary Tree)
여기서 간단한 한가지 특징 존재한다.

      항상 Parent Node 와 Child Node의 대소관계가 분명해야하는 것이다. 

그래서, 아래와 같이 두가지 종류의 Heap Tree가 만들어 질수 있다.
  1. top-heavy tree          :  Parent Node > Child Node( Left, Right) 
  2. bottom-heavy tree     :  Parent Node < Child Node( Left, Right) 
    이곳에서는 Left Node와 Right Node의 대소관계는 중요하지 않으며, 
    오직  Parent Node와 Child Node의 대소관계만 따진다. 


  • 기본적인 Heap이 완성된 경우의 구조 
  1. top node는 top-heavy tree의 경우  가장 큰 값  
  2. top node는 bottom-heavy tree의 경우 가장 작은 값
  3. 위에서 언급했듯이, 그 다음 작은 값은 child 중 한 Node (Left or Right)

  • Heap의 기본특성
  1. Parent node와 Child node의 대소관계가 분명하다.
  2. Left node와 Right node의 대소관계의 불문명하다.
  3. 오직 Parent와 Child node의 구성만 알수 있다. 
  4. heap은 기본적으로 왼쪽 평형트리 구조를 가지고 있으며, 이는 중요하다.

  • 상위 4번 특성 (왼쪽 평형트리 구조) 로 아래의 추가적인 특성이존재 
  1. Node 추가 할 경우,Child node가 추가되는 방향은 항상 왼쪽에서 오른쪽. 
  2. Node 삭제 or 추가된 경우 Child node가 한개가 될 경우 left node 우선순위가 있음
  3. Binary 탐색을 한다면 BFS 방식

*BFS(Breadth-first search) 대표적인 이진 트리의 탐색 알고리즘으로 넓이 우선 순위이다. 
    
  • Timer complex  설명
    아래 설명에도 자세히 나와 듯이 기본적으로 Binary Tree 구조이며,
    시간의 복잡도는 Insert 할 경우는 Worst Case O(LogN)이다. 
  https://en.wikipedia.org/wiki/Binary_heap


1.2 Heap 기본구현 (Array 방식)
기본적으로 Array로 구현하는 것은 아래와 같으며, 아래와 같은 성질이 존재한다.
기본성질 Array Binary Tree 기본 성질 array를 0부터 사용할 경우 


  • Number Node

      Number of Node = 2^(i+1) -1 ,   N 은 Tree의  Level의 수


Array즉 배열을 이용하여 이진 트리를 구성해야하기 때문에 Array와 binary Tree의 성질
알아야한다.
  • Array로 Binary Tree 구현할 경우 기본성질  

  1. Left Node = 2i+1
  2. Right Node = 2i+2
  3. Parent Node = (i-1)/2  

  자세한 내용은 2.2 Data의 정적구현 참조
  http://ahyuo.blogspot.kr/2016/10/tree.html


  • top-heavy heap 구현방법 
  1. top-heavy heap는 top node는 가장 큰 값을 소유하고 있다. 
  2. Heap의 Length을 정확히 파악하여 last node의 parent와 child 대소 관계를 비교
  3. Child가 큰 경우에만 Parent와 Child 교환진행 
  4. 왼쪽 Parent로 이동가며  Top Node까지 진행하며 3번 반복 (방향 오른쪽 -> 왼쪽 ) 



  • Top-heavy heap Example 

   상위그림 기준으로 보면, Last Node 14이며 , Parent 6 여기서 3 Node를 비교 교환시작.
   Parent 6,5,4,3,2,1,0 비교와 교환 진행 하면 Top-heavy heap 구축된다.


  Heap 자료구조 관련내용
  http://opendatastructures.org/ods-java/10_1_BinaryHeap_Implicit_Bi.html
  https://ko.wikipedia.org/wiki/%ED%9E%99_(%EC%9E%90%EB%A3%8C_%EA%B5%AC%EC%A1%B0)
  https://en.wikipedia.org/wiki/Heap_(data_structure)


2.  Heap Sort

기본적으로 상위 Heap 구현이 된 후에, 이를 이용한 Sort 알고리즘이다.
방법은 간단하며, Heap 기본성질이 최대 or 최소 값을 추출하는 방법을 이용한다.

  • 구현방법 
  1. n 개의 노드를 가진 top-heavy heap 구조 구축 
  2. top-heavy heap는 top node는 가장 큰 값을 소유   
  3. top-node를 last node와 교환진행   (top-node 추출작업과 동일)    
  4. top-heavy heap를 재구축을 heap size를 1을 줄이고 진행한다. 
  • top-heavy heap 재구축 및 추출작업 
  1. top-node가 현재 작은값이기때문에 child 중 두번째로 큰 값을 찾아 교환 
  2. 원래 top-node의 값은 child (left or right) 되었기에 관련 Tree는 비교 및 교환진행  
  3. 2번을 반복하며 방향은 아래로 지속적으로 한쪽 방향으로만 비교 및 교환진행 ( O(logN)     
  아래의 예제들을 보면, heapify가 heap을 구성한다.
  https://ko.wikipedia.org/wiki/%ED%9E%99_%EC%A0%95%EB%A0%AC
  https://en.wikipedia.org/wiki/Heapsort

  다른 Heapsort 예제들
  http://thinkpro.tistory.com/72
  http://ehclub.co.kr/1552

3. Priority Queue

기본적으로 상위 Heap 구현이 된 후에, 이를 이용한 우선순위 Queue를 구현이 가능하다.
Heap sort 와 마찬가지로, Heap의 기본성질인 가장 큰 값 or 가장 작은 값을 이용하는 것이다.
Priority Queue 역시 Heap의 기본 성질을 원하는 것이기 때문에, Heap를 이용하여 쉽게
구현이 가능하다.

  • array 구현방법 (정적으로 구현방법)
  1. pqueue_init : n 개의 노드를 가진 상위 top-heavy heap 구성 
  2. pqueue_insert: 기존의 top-heavy heap 의 마지막 노드에 data 를 삽입 후 다시 heap화 한다.
  3. pqueue_extract: top node를 추출하고 size를 줄이고 다시 heap화 한다. 
  • 구현함수
  1. pqueue_init : 상위 heap 구성과 동일 
  2. pqueue_insert :  pqueue_init와 동일 
  3. pqueue_extract:  top-heavy 재구축과 동일 

  https://ko.wikipedia.org/wiki/%EC%9A%B0%EC%84%A0%EC%88%9C%EC%9C%84_%ED%81%90
  https://en.wikipedia.org/wiki/Priority_queue

  • Heap and Heap sort and Priority Queue 예제 
구글링하다가, 이해하기 쉬운 C source를 찾으려고 했으나, 찾을수 없어 wiki 기반으로,
이해가며, 그냥 내가 다시 구현했다.