2018년 3월 30일 금요일

[Android] porting - iperf3

How to Install iperf3 on Android system

- 본 문서는 Iperf3 utility를 Android 개발환경에 적용하기 위한 내용을 기술한다.

Android : 7.1.0
Build System : Ubuntu 14.04 LTS
--------------------------------------------------------------------
ref : https://github.com/esnet/iperf
version : iperf 3.1.3
--------------------------------------------------------------------

소스코드는 github 또는 download 사이트를 통해 다운로드 가능하다.
  1. Project site (source code repository, issue tracker) hosted on GitHub:
    • https://github.com/esnet/iperf
  2. Source code downloads:
    • http://downloads.es.net/pub/iperf/

Android platform build 시 system.img 에 포함되어 릴리즈 되도록 적용한다.
  1. 소스코드 인출
    • git clone https://github.com/esnet/iperf.git
  2. Build
    • copy source files to android/external/iperf-3.1.3
      • $ copy -Rf ./iperf <Android_SRC_Root_DIR>/external/iperf3
    • $ configure - generate iperf_config.h file
      • $ cd <Android_SRC_Root_DIR>/external/iperf3
      • $ ./configure [enter]
    • generate Android.mk
      • $ vi <Android_SRC_Root_DIR>/external/iperf3/Android.mk
      •   1 LOCAL_PATH:= $(call my-dir)
          2 
          3 include $(CLEAR_VARS)
          4 
          5 LOCAL_MODULE_TAGS := optional
          6 
          7 # set SRC_FILES_LIST to all the .c files in $(LOCAL_PATH)/src/
          8 SRC_FILE_LIST := $(wildcard $(LOCAL_PATH)/src/*.c)
          9 
         10 # exclude test files $(LOCAL_PATH)/src/t_timer.c t_units.c t_uuid.c
         11 EXCLUD_FILE_LIST := $(wildcard $(LOCAL_PATH)/src/t_*.c)
         12 
         13 LOCAL_SRC_FILES := $(filter-out $(EXCLUD_FILE_LIST:$(LOCAL_PATH)/%=%),$(SRC_FILE_LIST:$(LOCAL_PATH)/%=%))
         14 
         15 LOCAL_C_INCLUDES :=  \
         16     $(LOCAL_PATH) \
         17     $(LOCAL_PATH)/src
         18 
         19 LOCAL_CFLAGS := -DHAVE_CONFIG_H -g -O2 -Wall -MT
         20 LDFLAGS="-fPIE -pie -fuse-ld=bfd"
         21 
         22 LOCAL_SHARED_LIBRARIES :=
         23 
         24 LOCAL_MODULE:= iperf3
         25 
         26 include $(BUILD_EXECUTABLE)
        3.2.2 partial build
         $ cd [android source root directory]
         $ source ./build/envsetup.sh
         $ mmm ./external/iperf-3.1.3

    • Partial build
      • $ source ./build/envsetup.sh [enter]
      • $ lunch [enter]
        • Select Lunch menu
      • mmm ./external/iperf3/ [enter]
  3. Run-time error 수정
    • case : iperf3: error - unable to create a new stream: No such file or directory
    • resolve : modify iperf_new_stream() at iperf_api.c ( external/iperf3/src/ )
    • 2657 struct iperf_stream *
      2658 iperf_new_stream(struct iperf_test *test, int s)
      2659 { 
      2660     int i;                 
      2661     struct iperf_stream *sp;
      2662   
      2663     char template[1024];
      2664     if (test->tmp_template) {
      2665         snprintf(template, sizeof(template) / sizeof(char), "%s", test->tmp_template);
      2666     } else {             
      2667         /* Android patch :               
      2668          * iperf3: error - unable to create a new stream: No such file or directory
      2669          */
      2670 #ifdef __ANDROID__
      2671         char buf[] = "/system/bin/iperf3.XXXXXX";
      2672 #else
      2673         char buf[] = "/tmp/iperf3.XXXXXX";
      2674 #endif           
      2675         snprintf(template, sizeof(template) / sizeof(char), "%s", buf);
      2676     } 

2018년 2월 27일 화요일

[TIP] CANON MF4800 Ubuntu Driver

Canon MF4800 Printer Driver 다운로드 경로 및 설치 방법

OS : Ubuntu  14.04 LTS

1. Download : http://support-asia.canon-asia.com/contents/ASIA/EN/0100270810.html
2. 설치방법
2-1. 다운로드 받은 linux-UFRII-drv-v340-uken.tar.gz 파일을 압축해제 후 install.sh 실행한다.

  • $ tar xzf linux-UFRII-drv-v340-uken.tar.gz
  • $ cd linux-UFRII-drv-v340-uken
  • $ ./install.sh

2018년 2월 21일 수요일

[MAN] strlcpy


Ref : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205gk/CJAEJFDB.html

strlcpy()

strlcpy() 함수는 NUL 종료 문자열 src에서 dst로 최고 size-1 문자를 복사합니다. 이 함수는 버퍼의 전체 크기(길이만이 아닌)를 차지하며 size가 0을 초과하는 한 NUL을 사용하여 결과를 종료합니다. size 값에 NUL에 해당하는 1바이트를 포함하십시오.
strlcpy() 함수는 공간 제한이 없었다면 복사되었을 문자열의 총 길이를 반환합니다. 이것은 충분한 공간이 있었는지에 따라 실제로 복사된 문자열의 길이와 동일할 수도 있고 그렇지 않을 수도 있습니다. 그러므로 필요한 공간이 어느 정도인지 확인하기 위해 strlcpy()를 한 번 호출한 다음 현재 공간이 충분하지 않을 경우 공간을 할당하고서 마지막에 strlcpy()를 두 번째로 호출하여 필요한 복사를 수행할 수 있습니다.
이 함수는 많은 C 라이브러리에 대한 공통 BSD 파생 확장입니다.

구문

extern size_t strlcpy(char *dst,  const char *src, size_t  size)

2018년 1월 29일 월요일

[Ubuntu16.04] Xshell4에서의 SSH 접속 설정

XShell4 (Xshell5 이하 버전)을 사용하여 Ubuntu16.04 서버에 SSH 접속 시 발생하는 오류 현상 및 해결방법에 대해 기술한다.

1.     현상
Ubuntu16.04 LTS 버전에 sshd 설치 후 Xshell4를 이용한 접속 시 서버에 맞는 outgoing encryption 알고리즘을 찾을 수 없습니다.” 팝업 발생 후 접속 불가

 


2.     대책 (아래 A, B 중 선택할 수 있다)
A.     Xshell5 버전으로 업데이트 한다.
B.     Xshell4 버전에서 지원하는 Ciphers를 서버의 sshd config 파일에 등록해 준다.
                         i.         참조 : http://manpages.ubuntu.com/manpages/zesty/man5/sshd_config.5.html
                        ii.         Xshell에서 지원하는 한 Cipher List 중 선택하여 /etc/ssh/ssh_config에 아래 내용을 추가한다.
$sudo vi /etc/ssh/ssh_config

    Ciphers aes256-cbc
$sudo service ssh restart

2017년 6월 11일 일요일

[WEB] PHP 환경 설정 변경(개발과정) - Error Display & Opcache

개발과정에서 Coding Error 및 빠른 업데이트를 위해 설정을 변경하자

php.ini 파일의 display_errors 화 opcache 옵션을 변경한다.
설정을 변경한 후에는 Apache Web Server를 Restart 해 줘야 변경사항을 적용된다.

상용버전에서는 Development 옵션은 지양한다.

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = On

[opcache]
zend_extension=php_opcache.dll
; Determines if Zend OPCache is enabled
; opcache.enable=1 -> 0 // 수정 즉시 반영되도록 설정
opcache.enable=0

[Ubuntu] Warning sudo: unable to resolve host

Ubuntu 설치 후 hostname을 /etc/hostname 파일만 변경한 경우, 아래와 같은 warning 문구가 표시된다.
Warning 제거는 hosts 파일(/etc/hosts) 에 변경된 hostname을 추가해 준다.

** warning message : sudo : unable to resolve host

원인 : /etc/hostname 에 적용된 hostname 이 /etc/hosts 파일에 등록되어 있지 않음.
대책 : /etc/hosts 파일에 변경된 hostname 추가

2017년 2월 3일 금요일

[Ubuntu] warning message 처리 (sudo : unable to resolve host)


Ubuntu 설치 후 hostname을 /etc/hostname 파일만 변경한 경우, 아래와 같은 warning 문구가 표시된다.

[ warning message ]
-  sudo : unable to resolve host

원인 : /etc/hostname 에 적용된 hostname 이 /etc/hosts 파일에 등록되어 있지 않음.
대책 : /etc/hosts 파일에 변경된 hostname 추가

$ sudo vi /etc/hostname
127.0..0.1 [HOSTNAME]  <-- [HOSTNAME] : 실제 hostname