요즘 뜨고있는 Go언어에 대해서 공부를 시작하면서 처음에 설정하는데 많은 삽질을 했었기에 다른 분들에게 도움이 되고자 만들었습니다.
앞으로도 공부하는김에 PPT로 만들어서 기존 프로그래밍 언어와 무엇이 다른지에 대해서 생각해보고 제가 공부하면서 느낀 궁금증과 그 해답에 대해 정리해 올리도록 하겠습니다.
'이것이 리눅스다' 책을 일고 공부하면서 느낀점과 공부하면서 조사하였던 관련된 자료를 PPT로 만든 것입니다. (this is Linux, this PPT has Many Things that Resource Related the Linux and other) 감사합니다. Thank you
요즘 뜨고있는 Go언어에 대해서 공부를 시작하면서 처음에 설정하는데 많은 삽질을 했었기에 다른 분들에게 도움이 되고자 만들었습니다.
앞으로도 공부하는김에 PPT로 만들어서 기존 프로그래밍 언어와 무엇이 다른지에 대해서 생각해보고 제가 공부하면서 느낀 궁금증과 그 해답에 대해 정리해 올리도록 하겠습니다.
'이것이 리눅스다' 책을 일고 공부하면서 느낀점과 공부하면서 조사하였던 관련된 자료를 PPT로 만든 것입니다. (this is Linux, this PPT has Many Things that Resource Related the Linux and other) 감사합니다. Thank you
This presentation covers the motivation that led the Samsung OSG to port Tizen to the Raspberry Pi2. It also goes over the technical hurdles that have been overcome and provides insight to where this project is headed in the future.
"Tizen is an open source, standards-based software platform" says tizen.org, but there haven't been a lot of details up until recently. It's time now, with the Tizen 3.0 development starting, for the project to welcoming developers, artists, translators and other types of contributors to participate and improve Tizen, through a process modelled on existing Open Source projects and taking into account the needs of the companies making a business around it.
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트Ji-Woong Choi
Docker를 활용하여 Gitlab CI/CD 설치 구성 및 샘플 테스트를 위한 가이드 문서이며, Docker 및 Gitlab에 대한 개요 및 사용법에 대해서는 다루지 않습니다. Docker image를 이용 Gitlab 및 Gitlab CI/CD 설치 및 구성 후 Sample Spring boot web application을 이용하여 소스 변경에 따른 commit이 발생 했을 때 Gitlab CI/CD 기능을 통해 application 테스트, 빌드, 배포까지의 일련의 과정이 자동으로 진행되는지를 테스트 하는 내용입니다.
Embedded C에서 TDD를 실천하기 위해 시도했던 경험과 방법을 기록해 보았습니다.
HW로부터 생기는 버그인지 SW로부터 생기는 버그인지 짐작조차 되지 않는 상황이 자주 발생한다면, TDD를 시작해보세요.
이 자료에서는 호스트 시스템(PC)에서 TDD를 실천하는 방법과 타깃 시스템(nRF51-DK)에서 TDD를 실천하는 방법을 기록하였습니다.
또한, nRF51-DK가 아닌 다른 보드를 가지고 있더라도 실천 가능합니다.
ktim610@gmail.com
3. 이번 시간에 우리는
• 릴리즈된 타이젠 플렛폼 설치하기
– 파티션 생성
– 부트로더, 펌웨어 설치
– 커널 컴파일 및 설치
– 다운로드한 타이젠 플렛폼 설치
• 타이젠 플렛폼 입맛에 맞게 만들기
– 최신 코드로 특정 패키지 교체
– 내가 만든 패키지 추가
– 불필요한 패키지 제거
5. 준비물
우분투 14.04 LTS
- 인터넷 사용 가능
- 10G 정도 공간
라즈베리파이2 (Mobel B)
- 8G MicroSD
- USB to Serial Cable
6. 준비물
우분투 14.04 LTS
- 인터넷 사용 가능
- 10G 정도 공간
라즈베리파이2 (Mobel B)
- 8G MicroSD
- USB to Serial Cable
여러분의 손
- 하고자 하는 의지
- 반나절 정도의 잉여 시간
- 여친 / 와이프 / 남친 /
서방의 무관심
7. 개발 환경 설정
• 필수 도구
– minicom: Serial 통신 프로그램
– git: 소스코드 형상 관리 도구
– 커널 빌드를 위한 ARM toolchain
$ sudo apt-get install git-core minicom
$ sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
$ sudo apt-get install binutils-arm-linux-gnueabi
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install gcc-arm-linux-gnueabi
$ sudo apt-get install g++-arm-linux-gnueabi
8. 개발 환경 설정
• Tizen 관련 도구
– gbs (git build system)
– mic (Linux Image Creation Tool)
$ sudo add-apt-repository "deb http://download.tizen.org/tools/latest-
release/Ubuntu_14.04 /"
$ sudo apt-get update
$ sudo apt-get install gbs mic
9. 파티션 생성
• 가정
– 8GB MicroSD 사용
– MicroSD가 Linux PC 연결시, /dev/sdc
– Automount disable
• 구성할 파티션
Device Boot Start End Blocks Id System
/dev/sdc1 * 2048 67583 32768 b W95 FAT32
/dev/sdc2 67584 6359039 3145728 83 Linux
/dev/sdc3 6359040 7407615 524288 83 Linux
/dev/sdc4 7409664 15523839 4058112 83 Linux
10. 파티션 생성
• fdisk 실행
• 현재 파티션 확인 및 빈 파티션 테이블 생성
$ sudo fdisk /dev/sdc
Command (m for help):
Command (m for help): p
...
Device Boot Start End Blocks Id System
/dev/sdc1 8192 15523839 7757824 b W95 FAT32
Command (m for help): o
Building a new DOS disklabel with disk identifier 0xcb2f8592.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
11. 파티션 생성
• BOOT 파티션 생성
– bootloader, Linux Kernel, 설정 파일
– FAT32 / Bootable
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): // Enter
First sector (2048-62521343, default 2048): // Enter
Last sector, +sectors or +size{K,M,G,T,P} (2048-62521343, default 62521343): +32M
Created a new partition 1 of type 'Linux' and of size 32 MiB.
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): b
Changed type of partition 'Linux' to 'W95 FAT32'.
Command (m for help): a
Partition number (1-4): 1
12. 파티션 생성
• ROOTFS 파티션 생성
– Tizen Platform
– EXT4
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): // Enter
Using default value 2
First sector (67584-15523839, default 67584): // Enter
Using default value 67584
Last sector, +sectors or +size{K,M,G} (67584-15523839, default 15523839): +3072M
13. 파티션 생성
• SYSTEMDATA 파티션 생성
• USER 파티션 생성
Command (m for help): n
Select (default p): p
Partition number (1-4, default 3): // Enter
Using default value 3
First sector (6359040-15523839, default 6359040): // Enter
Using default value 6359040
Last sector, +sectors or +size{K,M,G} (6359040-15523839, default 15523839): +512M
Command (m for help): n
Select (default e): p
Selected partition 4
First sector (7407616-15523839, default 7407616): // Enter
Using default value 7407616
Last sector, +sectors or +size{K,M,G} (7407616-15523839, default 15523839): // Enter
Using default value 15523839
14. 파티션 생성
• 생성한 파티션 확인 및 저장
Command (m for help): p
Disk /dev/sdc: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xef8a422d
Device Boot Start End Blocks Id System
/dev/sdc1 * 2048 67583 32768 b W95 FAT32
/dev/sdc2 67584 6359039 3145728 83 Linux
/dev/sdc3 6359040 7407615 524288 83 Linux
/dev/sdc4 7407616 15523839 4058112 83 Linux
Command (m for help): w
The partition table has been altered!
15. 파티션 생성
• 파일시스템 생성
$ sudo mkfs.vfat /dev/sdc1 -n BOOT
$ sudo mkfs.ext4 /dev/sdc2 -L ROOTFS
$ sudo mkfs.ext4 /dev/sdc3 -L SYSTEMDATA
$ sudo mkfs.ext4 /dev/sdc4 -L USER
16. 부트로더 & 펌웨어
• 설치할 바이너리 파일
– 라즈베리파이 github
• bootcode.bin: Second stage bootloader
• start.elf: GPU firmware
• fixup.dat: GPU / CPU 사이의 SDRAM 설정 파일
• Kernel과 모듈은 직접 build하여 사용 예정
– 타이젠 라즈베리파이 github
• cmdline.txt: Linux Kernel의 boot parameter
• config.txt: 라즈베리파이의 BIOS 설정 파일
18. 리눅스 커널
• 라즈베리파이용 타이젠 커널 Download
– 그래픽 관련 patch 적용 및 defconfig 정의
• 라즈베리파이 툴 Download
– 부트로더에서 커널 이미지 호환성을 체크하기 때문에,
mkknlimg로 Tagging 필요
$ git clone https://github.com/krzk/tizen-tv-rpi-linux.git
$ git clone https://github.com/raspberrypi/tools
19. 리눅스 커널
• 커널 컴파일
– 결과물
• arch/arm/boot/zImage
• arch/arm/boot/dts/bcm2709-rpi-2-b.dtb
• mkknlimg로 Tagging
$ cd tizen-tv-rpi-linux
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make tizen_rpi2_defconfig
$ make -j16
$ tools/mkimage/mkknlimg --dtok tizen-tv-rpi-linux/arch/arm/boot/zImage
tizen-tv-rpi-linux/arch/arm/boot/zImage
20. 리눅스 커널
• 커널 설치
• 설치된 파일 확인
$ sudo cp tizen-tv-rpi-linux/arch/arm/boot/zImage /mnt/kernel7.img
$ sudo cp tizen-tv-rpi-linux/arch/arm/boot/dts/bcm2709-rpi-2-b.dtb /mnt
$ cd /mnt
$ ls
bcm2709-rpi-2-b.dtb bootcode.bin cmdline.txt config.txt
fixup.dat kernel7.img start.elf
$ cd
$ sudo umount /mnt
21. 리눅스 커널
• 필수 커널 옵션 (참고사항)
– System 관련
• EPOLL, INOTIFY_USER, SIGNALFD, TIMERFD
• CGROUP_*
• SYSFS, PROC_FS, DEVTMPFS
• FHANDLE
– Security 관련
• SECURITY_SMACK_*
22. 타이젠 플렛폼
• Released된 타이젠 플렛폼 (Milestone 1)
– rootfs.img: Tizen Platform의 Root filesystem
– system-data.img: System 관련 설정 (/opt)
– user.img: 사용자 설정 (/opt/usr)
• download.tizen.org에서 이미지 download
$ wget https://download.tizen.org/releases/milestone/tizen/tv-
3.0.m1/latest/images/arm-wayland/tv-wayland-armv7l-odroidu3/tizen-
tv_20150914.3_tv-wayland-armv7l-odroidu3.tar.gz
$ tar xvzf tizen-tv_20150914.3_tv-wayland-armv7l-odroidu3.tar.gz
rootfs.img
user.img
system-data.img
23. 타이젠 플렛폼
• Tizen 이미지 flashing
– 리눅스 PC에 microSD를 USB에 연결
– MicroSD는 /dev/sdc node에 연결
$ sudo dd if=rootfs.img of=/dev/sdc2
$ sudo dd if=system-data.img of=/dev/sdc3
$ sudo dd if=user.img of=/dev/sdc4
24. 타이젠 플렛폼
• Booting
– SD카드를 라즈베라파이에 삽입
– USB to Serial 케이블 연결
– minicom을 setup 모드로 실행
– Serial 설정
• Serial Device: /dev/ttyUSB0
• Speed (baud rate): 115200
• Bits: 8
• Parity: None
• Stop Bits: 1
• Flow Control: None
$ sudo minicom -s
25. 타이젠 플렛폼
• Booting 결과 확인
– minicom 화면에 boot message가 출력
– Login시 root / tizen
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0xf00
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
...
Welcome to Tizen 3.0.0 (Tizen3/TV)!
...
[ OK ] Listening on cert-server.socket.
[ OK ] Listening on MediaController Service socket.
...
localhost login: root
Password: // tizen 입력
Welcome to Tizen
root@localhost:~#
27. 타이젠 플렛폼
• GPU 가속화 및
DRM 활성화
– libdrm package 수정
– mesa package 수정
– efl package 수정
• Tizen Wiki 참조
• Booting된 화면
28. 타이젠 플렛폼 이미지 생성
• 내 입맛에 맞는 최적화 가능
– 특정 package 교체
• sdbd 최신 코드를 git repo에서 받아 빌드 및 교체
– 신규 모듈을 Tizen 이미지에 추가
• sample daemon을 개발 및 추가
– 필요 없는 모듈 제거
29. 특정 패키지 교체
• SDB (Smart Development Bridge)
– 개발용 디바이스 관리 도구
– Target의 명령어 실행, 파일 전송, 디버깅
– sdbd는 Target에서 수행하는 daemon process
• GBS (Git Build System)
– Tizen 패키지 개발 도구
– Git 기반으로 관리되는 코드를 개발 PC에서 빌드,
원격 빌드 시스템에 반영
30. 특정 패키지 교체
• gbs configuration 파일 수정
– Home directory의 .gbs.conf 파일
[general]
profile = profile.tizen
[profile.tizen]
obs = obs.tizen
repos = repo.tizen_latest, repo.public_3.0_base_arm
[obs.tizen]
url = https://api.tizen.org
[repo.public_3.0_base_arm]
url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
[repo.tizen_latest]
url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm-wayland/packages/
31. 특정 패키지 교체
• sdbd 코드 download
• 빌드 및 결과물 확인
$ git clone ssh://sangjung@review.tizen.org:29418/platform/core/system/sdbd
$ cd sdbd/
$ git checkout tizen
$ gbs build -A=armv7l
...
=== Total succeeded built packages: (1) ===
info: generated html format report:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/index.html
info: generated RPM packages can be found from local repo:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/RPMS
info: generated source RPM packages can be found from local repo:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/SRPMS
info: build logs can be found in:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/logs
info: build roots located in:
/home/again4you/GBS-ROOT/local/BUILD-ROOTS/scratch.armv7l.*
info: Done
$ cd /home/again4you/GBS-ROOT/local/repos/tizen/armv7l/RPMS
$ ls
sdbd-2.1.2-4.armv7l.rpm sdbd-debuginfo-2.1.2-4.armv7l.rpm sdbd-debugsource-2.1.2-4.armv7l.rpm
32. 신규 패키지 추가
• Sample project 개발
– 기본 동작
• 1초에 1번씩 "sample daemon is alive" 메시지와 count를 출력
• Tizen booting 후, 자동으로 실행
• 비정상 종료 시, 자동으로 재실행
– Files
├── CMakeLists.txt
├── packaging
│ └── sample_proj.spec
├── sample_proj.c
└── sample_proj.service
33. 신규 패키지 추가
• sample_proj.c
#include <errno.h>
#include <glib.h>
#include <systemd/sd-journal.h>
GMainLoop *loop = NULL;
gboolean timer_callback(gpointer data)
{
int *pcount = (int *)data;
sd_journal_print(LOG_NOTICE, "sample daemon is alive %dn", (*pcount)++); // Log 메시지 출력
return TRUE;
}
int main()
{
int count = 0;
loop = g_main_loop_new(NULL, TRUE);
if (!loop)
return -ENOMEM;
g_timeout_add(1000, timer_callback, &count); // 1초에 한번씩 등록된 Callback 함수 호출
g_main_loop_run(loop);
…
}
34. 신규 패키지 추가
• sample_proj.service
[Unit]
Description=sample project daemon for Tizen Talk
[Service]
ExecStart=/usr/bin/sample_proj
Restart=always
RestartSec=0
[Install]
WantedBy=multi-user.target
36. 신규 패키지 추가
• 빌드 및 결과물 확인
$ gbs build -A=armv7l --include-all
...
=== Total succeeded built packages: (1) ===
info: generated html format report:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/index.html
info: generated RPM packages can be found from local repo:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/RPMS
info: generated source RPM packages can be found from local repo:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/SRPMS
info: build logs can be found in:
/home/again4you/GBS-ROOT/local/repos/tizen/armv7l/logs
info: build roots located in:
/home/again4you/GBS-ROOT/local/BUILD-ROOTS/scratch.armv7l.*
info: Done
$ cd /home/again4you/GBS-ROOT/local/repos/tizen/armv7l/RPMS
$ ls -l
total 228
-rw-r--r-- 1 again4you again4you 5059 1월 15 17:07 sample_proj-1.0.0-1.armv7l.rpm
-rw-r--r-- 1 again4you again4you 5034 1월 15 17:07 sample_proj-debuginfo-1.0.0-1.armv7l.rpm
-rw-r--r-- 1 again4you again4you 1840 1월 15 17:07 sample_proj-debugsource-1.0.0-1.armv7l.rpm
-rw-r--r-- 1 again4you again4you 46130 1월 15 17:03 sdbd-2.1.2-4.armv7l.rpm
-rw-r--r-- 1 again4you again4you 96632 1월 15 17:03 sdbd-debuginfo-2.1.2-4.armv7l.rpm
-rw-r--r-- 1 again4you again4you 63819 1월 15 17:03 sdbd-debugsource-2.1.2-4.armv7l.rpm
37. 타이젠 플렛폼 이미지 생성
• Kickstart 파일
– Redhat 설치 자동화 설정 파일
– Tizen Platform 이미지 생성에 사용
• 파티션 설정
• 설치할 package 설정
• Root password, timezone 등의 시스템 설정
• 바이너리의 Kickstart 파일 다운로드
– 압축된 이미지와 같은 경로에 존재
$ wget https://download.tizen.org/releases/milestone/tizen/tv-3.0.m1/latest/images/arm-
wayland/tv-wayland-armv7l-odroidu3/tizen-tv_20150914.3_tv-wayland-armv7l-odroidu3.ks
38. 타이젠 플렛폼 이미지 생성
• Kickstart 파일 수정
– 이미지 생성시, 로컬 빌드한 패키지를 우선 참조
lang en_US.UTF-8
keyboard us
timezone --utc America/Los_Angeles
part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime
part /opt --fstype="ext4" --size=512 --ondisk=mmcblk0 --label system-data --
fsoptions=defaults,noatime
part /opt/usr --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label user --
fsoptions=defaults,noatime
…
repo --name=local --baseurl=file:///home/again4you/GBS-ROOT/local/repos/tizen/armv7l
--priority=1
repo --name=tv-wayland_armv7l --baseurl=http://download.tizen.org/releases/milestone/tizen/tv-
3.0.m1/tizen-tv_20150914.3/repos/arm-wayland/packages/ --ssl_verify=no --priority=99
39. 타이젠 플렛폼 이미지 생성
• Kickstart 파일 수정
– 불필요한 패키지 그룹 제거
…
%packages
@Generic Base
@TV Base
@Generic Console Tools
@Generic Packaging
@Generic Adaptation
@TV Adaptation
@Generic Wayland
@TV Wayland
@TV Middleware
…
# @TV Bluetooth // Bluetooth와 Telephony 패키지 그룹을 제거
# @TV Telephony
sample_proj // sample proj package 신규 추가
40. 타이젠 플렛폼 이미지 생성
• mic 명령어로 이미지 생성
– 리눅스 이미지 생성/수정을 위한 도구
• Tizen 이미지 Flashing
$ sudo mic --verbose create loop
tizen-tv_20150914.3_tv-wayland-armv7l-odroidu3.ks
--tmpfs -A armv7l –shrink
$ tree mic-out
mic-output
├── manifest.json
├── rootfs.img
├── system-data.img
├── tizen-tv_20150914.3_tv-wayland-armv7l-odroidu3-201601151725.xml
└── user.img
$ sudo dd if=rootfs.img of=/dev/sdc2
$ sudo dd if=system-data.img of=/dev/sdc3
$ sudo dd if=user.img of=/dev/sdc5
41. 타이젠 플렛폼 이미지 생성
• 동작 확인
localhost login: root
Password:
Welcome to Tizen
root@localhost:~#
root@localhost:/usr/lib/systemd/system# rpm -qa | grep sample_proj
sample_proj-1.0.0-1.armv7l // sample_proj 패키지 설치
root@localhost:/usr/lib/systemd/system# ps -ef | grep sample_proj
root 292 1 0 16:00 ? 00:00:00 /usr/bin/sample_proj
root 792 579 0 16:06 ttyAMA0 00:00:00 grep sample_proj
root@localhost:/usr/lib/systemd/system# kill 292
root@localhost:/usr/lib/systemd/system# ps -ef | grep sample_proj
root 801 1 0 16:06 ? 00:00:00 /usr/bin/sample_proj // 비정상 종료시, 재실행
root 804 579 0 16:06 ttyAMA0 00:00:00 grep sample_proj
root@localhost:/usr/lib/systemd/system# journalctl -a –f // 1초에 한번씩, 로그 출력
Dec 31 16:06:47 localhost sample_proj[801]: sample daemon is alive 25
Dec 31 16:06:48 localhost sample_proj[801]: sample daemon is alive 26
Dec 31 16:06:49 localhost sample_proj[801]: sample daemon is alive 27
42. 타이젠 플렛폼 이미지 생성
• 동작 확인
- 동영상 URL: https://youtu.be/HEzSQi0Lvco
43. 마무리
• 이번 시간에 한 일
– 릴리즈된 타이젠 플렛폼 설치하기
– 타이젠 플렛폼 입맛에 맞게 만들기
• 다음 시간에는…
44. 참고 자료
• How to use Mesa with GL/EGL GPU acceleration and DRM for Tizen 3.0
TV profile (wayland backend) on RPI2
– https://wiki.tizen.org/wiki/How_to_use_Mesa_with_GL/EGL_GPU_acceleration_and_DRM_f
or_Tizen_3.0_TV_profile_%28wayland_backend%29_on_RPI2#Installing_a_basic_FS
• Porting Tizen to open source hardware devices for beginners (BBB)
– http://www.slideshare.net/leonanavi/tdc2014-porting-
tizentoopensourcehardwaredevicesforbeginners
• How to Build and Load Tizen on Odroid U3
– https://wiki.tizen.org/wiki/How_to_Build_and_Load_Tizen_on_Odroid_U3