Build Host Packages 설치하기
$ sudo apt-get install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev |
Build를 하기 위한 패키지들을 빌드 컴퓨터에 설치를 해야 한다.
다음은 poky의 소스코드를 다운로드를 하는 과정이다. 과정 중에서 checkout을 할 때에 Branch를 확인하는 방법은 poky 디렉토리에서 다음의 명령으로 확인 가능하다.
$ git branch -a
sohyemin@ubuntu:~/study$ git clone git://git.yoctoproject.org/poky Cloning into 'poky'... remote: Enumerating objects: 518100, done. remote: Counting objects: 100% (518100/518100), done. remote: Compressing objects: 100% (122261/122261), done. remote: Total 518100 (delta 388049), reused 517728 (delta 387775) Receiving objects: 100% (518100/518100), 175.12 MiB | 16.55 MiB/s, done. Resolving deltas: 100% (388049/388049), done. sohyemin@ubuntu:~/study/poky$ sohyemin@ubuntu:~/study$ cd poky/ sohyemin@ubuntu:~/study/poky$ sohyemin@ubuntu:~/study/poky$ git checkout -t remotes/origin/hardknott -b my-hardknott Branch 'my-hardknott' set up to track remote branch 'hardknott' from 'origin'. Switched to a new branch 'my-hardknott' sohyemin@ubuntu:~/study/poky$ sohyemin@ubuntu:~/study/poky$ git pull Already up to date. sohyemin@ubuntu:~/study/poky$ sohyemin@ubuntu:~/study/poky$ ls bitbake documentation LICENSE.GPL-2.0-only Makefile meta meta-selftest meta-yocto-bsp README.hardware README.poky scripts contrib LICENSE LICENSE.MIT MEMORIAM meta-poky meta-skeleton oe-init-build-env README.OE-Core README.qemu sohyemin@ubuntu:~/study/poky$ sohyemin@yocto:~/study/poky$ |
Build Environment 초기화하기
sohyemin@ubuntu:~/study/poky$ source oe-init-build-env ### Shell environment set up for builds. ### You can now run 'bitbake <target>' Common targets are: core-image-minimal core-image-full-cmdline core-image-sato core-image-weston meta-toolchain meta-ide-support You can also run generated qemu images with a command like 'runqemu qemux86' Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasks sohyemin@ubuntu:~/study/poky/build$ |
Local Configuration
설정과 관련된 파일은 build/conf 디렉토리에서 찾을 수 있으며 local.conf이다. 그리고 build의 default machine은 qemu x86이며 64비트로 설정이 되어 있다.
마지막으로 빌드는 다음의 command로 할 수 있다.
sohyemin@ubuntu:~/study/poky/build$ bitbake core-image-sato Loading cache: 100% |#################################################| Time: 0:00:00 Loaded 1438 entries from dependency cache. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.50.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.3.1" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "my-hardknott:9df1d44de50b175c736d9f7e52f730fac25e3c12" Initialising tasks: 100% |############################################| Time: 0:00:06 Sstate summary: Wanted 2655 Local 0 Network 0 Missed 2655 Current 70 (0% match, 2% complete) NOTE: Executing Tasks Currently 2 running tasks (335 of 6851) 4% |# | |
빌드가 얼마나 걸릴지는 알 수가 없다. 서버에서 돌려야 하는 빌드를 가상화 시스템에서 돌리고 있으니 최소 대여섯 시간은 되지 않을까 싶다.
빌드 에러의 발생
/home/sohyemin/study/poky/build/tmp/hosttools/ld: ifcvt.c:(.text+0x4b62): undefined reference to `flow_find_head_matching_sequence(basic_block_def*, basic_block_def*, rtx_insn**, rtx_insn**, int)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: ifcvt.o: in function `if_convert(bool)': ifcvt.c:(.text+0x7201): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: ifcvt.o: in function `(anonymous namespace)::pass_rtl_ifcvt::execute(function*)': ifcvt.c:(.text+0x971b): undefined reference to `cleanup_cfg(int)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: ifcvt.c:(.text+0x9733): undefined reference to `cleanup_cfg(int)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: ifcvt.c:(.text+0x9746): undefined reference to `cleanup_cfg(int)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: ree.o: in function `combine_reaching_defs(ext_cand*, rtx_def const*, ext_state*)': ree.c:(.text+0x1526): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: lower-subreg.o: in function `decompose_multiword_subregs(bool)': lower-subreg.c:(.text+0x23a9): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: lower-subreg.c:(.text+0x2ac9): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: lower-subreg.c:(.text+0x2c78): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: lower-subreg.c:(.text+0x2d6a): undefined reference to `recog(rtx_def*, rtx_insn*, int*)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: mode-switching.o: in function `(anonymous namespace)::pass_mode_switching::execute(function*)': mode-switching.c:(.text+0x4cf): undefined reference to `cleanup_cfg(int)' /home/sohyemin/study/poky/build/tmp/hosttools/ld: cprop.o: in function `(anonymous namespace)::pass_rtl_cprop::execute(function*)': cprop.c:(.text+0xe73): undefined reference to `delete_unreachable_blocks()' /home/sohyemin/study/poky/build/tmp/hosttools/ld: cprop.c:(.text+0x1669): undefined reference to `delete_unreachable_blocks()' /home/sohyemin/study/poky/build/tmp/hosttools/ld: cprop.c:(.text+0x20c9): undefined reference to `cleanup_cfg(int)' collect2: error: ld returned 1 exit status make[1]: *** [../../../../../../../work-shared/gcc-10.2.0-r0/gcc-10.2.0/gcc/lto/Make-lang.in:88: lto1] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/home/sohyemin/study/poky/build/tmp/work/x86_64-linux/gcc-cross-x86_64/10.2.0-r0/gcc-10.2.0/build.x86_64-linux.x86_64-poky-linux/gcc' make: *** [Makefile:4404: all-gcc] Error 2 WARNING: exit code 1 from a shell command. ERROR: Logfile of failure stored in: /home/sohyemin/study/poky/build/tmp/work/x86_64-linux/gcc-cross-x86_64/10.2.0-r0/temp/log.do_compile.144779 ERROR: Task (/home/sohyemin/study/poky/meta/recipes-devtools/gcc/gcc-cross_10.2.bb:do_compile) failed with exit code '1' |
젠장이다.
다음 페이지에 있는대로 추가 세팅을 해 줬다.
https://docs.yoctoproject.org/ref-manual/system-requirements.html#supported-linux-distributions
1 System Requirements — The Yocto Project ® dev documentation
1 System Requirements Welcome to the Yocto Project Reference Manual! This manual provides reference information for the current release of the Yocto Project, and is most effectively used after you have an understanding of the basics of the Yocto Project. T
docs.yoctoproject.org
몇 번을 poky 디렉토리를 지우고 다시 받고 빌드를 하기를 수차례 했다.
마지막으로는 disk가 꽉 차서 에러가 났다. 지금은 disk 용량을 64에서 100GB로 늘려서 빌드 중이다. 세 시간 정도 돌고 나서 디스크가 꽉찼으니 아직 더 기다려봐야 한다.
즉, ubuntu를 새로 설치를 했다. /dev/sdax의 크기가 증가해야 하기 때문에 다시 설치했다. 그리고 처음부터 차근차근....
별도의 세팅은 필요 없다. 기본 패키지만 설치해 준 후에 다음과 같이 Virtual Machine을 설정해 준다. 우선은 RAM이 8G이다. 4G에서 에러가 났었기 때문에 더블로 했다. PC나 노트북에 있는 용량보다 커도 Swap을 잡기 때문에 괜찮을 것 같다. 나의 경우 노트북 RAM 8G인데 그대로 8G로 세팅을 해 줬다. 그 다음은 하드디스크 용량이다. 최소 80GB는 잡아 줘야 할 것 같다. 64G로 잡았을 때 용량이 부족해서 빌드가 중단되었었다.
그렇게 빌드를 걸어 놓고 아침에 보니 다음과 같이 빌드가 완료되어 있었다.
하드웨어만 맞는다면 아주 쉽게 소스를 받고 빌드를 할 수 있었다. 빌드 시간이 오래 걸리기도 했고 두 번의 우분투 20.04의 설치와 수 차례에 걸친 소스 다운로드 시간이 걸려 2박 3일만에 성공을 했지만 말이다.
sohyemin@ubuntu:~/study/poky/build$ bitbake core-image-sato Loading cache: 100% | | ETA: --:--:-- Loaded 0 entries from dependency cache. Parsing recipes: 100% |#####################################################################################################################################################################| Time: 0:01:01 Parsing of 814 .bb files complete (0 cached, 814 parsed). 1438 targets, 41 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.50.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "ubuntu-20.04" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.3.1" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "my-hardknott:74dbb08c3709fec6563ee65a3661f66fdcbb3e2f" NOTE: Fetching uninative binary shim http://downloads.yoctoproject.org/releases/uninative/3.2/x86_64-nativesdk-libc.tar.xz;sha256sum=3ee8c7d55e2d4c7ae3887cddb97219f97b94efddfeee2e24923c0cb0e8ce84c6 (will check PREMIRRORS first) Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:07 Sstate summary: Wanted 2725 Local 0 Network 0 Missed 2725 Current 0 (0% match, 0% complete) NOTE: Executing Tasks WARNING: expat-2.2.10-r0 do_fetch: Failed to fetch URL https://downloads.sourceforge.net/expat/expat-2.2.10.tar.bz2, attempting MIRRORS if available WARNING: netbase-1_6.2-r0 do_fetch: Failed to fetch URL http://ftp.debian.org/debian/pool/main/n/netbase/netbase_6.2.tar.xz, attempting MIRRORS if available NOTE: Tasks Summary: Attempted 6851 tasks of which 0 didn't need to be rerun and all succeeded. Summary: There were 2 WARNING messages shown. |
빌드가 완료된 후에 df 명령으로 디스크 정보를 보니 100G에서 약 80% 정도를 사용하고 있다.
sohyemin@ubuntu:~/study/poky/build$ df Filesystem 1K-blocks Used Available Use% Mounted on udev 4031544 0 4031544 0% /dev tmpfs 812332 1892 810440 1% /run /dev/sda5 102168536 75770496 21165144 79% / tmpfs 4061656 0 4061656 0% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 4061656 0 4061656 0% /sys/fs/cgroup /dev/loop0 224256 224256 0 100% /snap/gnome-3-34-1804/66 /dev/loop1 56832 56832 0 100% /snap/core18/1988 /dev/loop3 31872 31872 0 100% /snap/snapd/11036 /dev/loop2 66432 66432 0 100% /snap/gtk-common-themes/1514 /dev/loop4 52352 52352 0 100% /snap/snap-store/518 /dev/sda1 523248 4 523244 1% /boot/efi tmpfs 812328 52 812276 1% /run/user/1000 /dev/loop5 33152 33152 0 100% /snap/snapd/12159 /dev/loop6 56832 56832 0 100% /snap/core18/2074 /dev/loop7 52224 52224 0 100% /snap/snap-store/547 /dev/loop8 66688 66688 0 100% /snap/gtk-common-themes/1515 /dev/loop9 224256 224256 0 100% /snap/gnome-3-34-1804/72 |
'IT' 카테고리의 다른 글
Python Image + Masking Image 합성 (0) | 2021.08.06 |
---|---|
Python Making Image 만들기 (0) | 2021.08.06 |
Yocto Project Quick Build / docker를 설치해보자 (0) | 2021.06.19 |
Yocto (0) | 2021.06.18 |
내 손으로 만든 제품들 (0) | 2021.03.20 |
댓글