2016년 1월 5일 화요일

pxe 로 ubuntu 14.04 설치

0. 환경

      공유기
 ┌──┴──┐
서버PC     설치PC

공유기: 192.168.0.1
         dhcp 기능 끔

서버PC: 192.168.0.99
       ubuntu 12.04 server
       dhcp 서비스
       tftp 서비스
       PXE 부팅 파일

설치이미지: ubuntu 14.04 desktop

1. 서버PC에 서비스 설치
1-1 dhcp 서비스 설치
busybox 에 들어있는 udhcpd 를 사용

udhcpd.conf
--------------------------------------------------------------------------------
# The start and end of the IP lease block
start            192.168.0.200
end             192.168.0.210

# The interface that udhcpd will use
interface       eth0

# Currently supported options, for more info, see options.c
opt router      192.168.0.1
opt subnet     255.255.255.0

opt bootfile    pxelinux.0
--------------------------------------------------------------------------------

1-2 tftp 서버 설치
http://shallweeee.blogspot.kr/2015/04/tftp.html 참고

1-3 PXE 부팅 파일 설치
$ mkdir /work2/tftpboot
$ cd /work2/tftpboot
$ wget -O - http://ftp.daumkakao.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/netboot.tar.gz | tar zx
# 14.04 64bit 용 네트워크 부트 패키지

--------------------------------------------------------------------------------
$ ln -sf ubuntu-installer/amd64/pxelinux.0 `printf "pxelinux.0\xff"`
# 설치 PC 는 LG 노트북 R570 인데 udhcpd 가 넘겨준 정보 중 옵션 종료를
# 의미하는 0xff 를 파일명의 일부로 인식하여 bootfile 이 다운로드 되지않는
# 문제가 발생했다. 부트파일명에 0xff를 추가하여 문제 회피.
--------------------------------------------------------------------------------

2. 설치 전 준비
2-1 공유기에서 dhcp 기능 OFF
2-2 udhcpd 서버 실행
$ sudo udhcpd -fS udhcpd.conf 또는 $ sudo busybox udhcpd -fS udhcpd.conf
# 설치할 때만 필요해서 데몬으로 띄우지 않았다.

3. 설치
3-1. 설치PC 의 Boot Menu 에서 네트워크 카드 선택
3-2. Install 선택
3-3. 미러 사이트 설정
    [수동으로 정보 입력하기] 선택
    미러 사이트 호스트 이름: ftp.daumkakao.com
    미러 디렉토리: /ubuntu/

4. 설치 후 정리
4-1. 공유기의 dhcp 기능 ON
4-2. udhcpd 종료

참고
* https://help.ubuntu.com/community/Installation/LocalNet


2016년 1월 3일 일요일

메시지큐 마운트

mkdir ./mq # 임의의 이름
sudo mount -t mqueue none ./mq
umount ./mq

2015년 12월 8일 화요일

ubuntu 12.04 에서 virtualbox 5.0 설치

ubuntu 12.04

$ sudo apt-get install dkms
$ wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" >> /etc/apt/sources.list.d/virtualbox.list'
$ sudo apt-get update
$ sudo apt-get install virtualbox-5.0
$ adduser $USER vboxusers
$ virtualbox

--------------------------------------------------------------------------------
# virtualbox 실행시 VERR_SUPLIB_OWNER_NOT_ROOT 에러가 나면
/usr/lib/virtualbox 까지의 경로중 root 권한이 아닌 디렉토리가 있기
때문이므로 권한을 수정한다.
$ sudo chmod root:root "루트 권한이 아닌 경로"
--------------------------------------------------------------------------------


참고
https://www.virtualbox.org/wiki/Linux_Downloads
http://www.howopensource.com/2013/04/install-virtualbox-ubuntu-ppa/
https://forums.virtualbox.org/viewtopic.php?f=7&t=39179
http://askubuntu.com/questions/140081/virtualbox-doesnt-recognize-usb
http://blog.ruecker.fi/2013/10/06/adventures-in-bluetooth-4-0-part-i/
https://forums.virtualbox.org/viewtopic.php?f=7&t=67761

2015년 11월 14일 토요일

spelling checker

LANG=C aspell -c <file>

2015년 11월 10일 화요일

gdbserver

gdbserver 실행 (Target)
# gdbserver --attach :5039 <PID>
Attached; pid = 7148
Listening on port 5039
 
 또는
 
# gdbserver :5039 <BINARY PATH>
Process xxx created; pid = 6232
Listening on port 5039
 
 
gdb 실행 (Host)
$ gdb-multiarch
(gdb) set arch arm
(gdb) file <BINARY PATH>
(gdb) target remote [gdbserver ip]:5039
 
 
참고
https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver

gdb

  • 심볼파일 로드
(gdb) symbol-file 


  • 사용 가능한 명령어 리스트
(gdb) <tab><tab>
(gdb) 명령 <tab><tab>
  • 콜스택
(gdb) bt
(gdb) i s
  • 레지스터 보기
(gdb) i r
(gdb) i r pc
(gdb) p/x $pc
(gdb) set $sp += 4 
  • 변수 값 보기
(gdb) p 변수
(gdb) x 변수
  • 포인터 대상 출력
(gdb) p {구조체 또는 클래스}어드레스
(gdb) p *(구조체 또는 클래스*)어드레스
(gdb) p *this
  • 구조체 또는 클래스의 크기 구하기
(gdb) p sizeof(구조체 또는 클래스)

  • 메모리맵
(gdb) i files
$ cat /proc/<pid>/maps

  • print 출력 길이 제한
(gdb) set print elements 숫자

  • print format
(gdb) set print pretty on


  • print 옵션
(gdb) show print [항목]
(gdb) set print 항목 값

  • 배열 P 에서 N개의 요소를 출력
(gdb) p P@N

  • myVector 의 배열 주소
myVector._M_impl._M_start

  • 로칼 변수
(gdb) i lo
  • 타입 보기
(gdb) i ty

함수 정의 보기
(gdb) i fu

변수 보기
(gdb) i va


스택 프레임 정보
(gdb) i f
(gdb) fr [번호]

줄 정보
(gdb) i li

소스 리스트 보기
(gdb) i sources

공유라이브러리 보기
(gdb) i sh

시그널 핸들 상태
(gdb) i h


실행 옵션
빌드 옵션 확인
-configuration

-nx 설정파일 실행 안 함

부트시퀀스
  1. -interpreter 옵션 처리.
  2. 시스템 설정 파일 실행(/etc/gdb/gdbinit)
  3. 사용자 설정 파일 실행(~/.gdbinit)
  4. -iex 및 -ix 옵션을 순서대로 실행
  5. -ex 와 -x 를 제외한나머지 옵션 실행
  6. 현재 디렉토리의 설정 파일 실행(./.gdbinit) (set auto-load local-gdbinit on 필요)
  7. auto-load
    Disable auto-load $ gdb -iex "set auto-load python-scripts off" myprogram
  8. -ex 및 -x 옵션을 순서대로 처리
  9. command history 로드
참고
https://sourceware.org/gdb/onlinedocs/gdb/index.html
https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver

arm 레지스터 이름

r9, sb, static base r10, sl, stack limit
r11, fp, frame pointer
r12, ip, intra-procedure call scratch register
r13, sp, stack pointer
r14, lr, link register
r15, pc, program counter

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0040d/ch06s02s01.html