[작성중] 텔레칩스 TOPST 보드 빌드환경 꾸리기
안녕하세요. 도정진입니다.
텔레칩스 TOPST D3 보드에 맞는 빌드환경을 꾸려보도록 하겠습니다.
가이드에는 Virtualbox 같은 것을 사용하도록 되어 있는데 가속이나 최적화를 위해 WSL2 에서 빌드를 해보겠습니다.
일단 권장버전은 18.04 / 20.04 입니다. 저는 20.04로 시도해보도록 하겠습니다.
1. WSL2 설치
파워쉘을 관리자 권한으로 실행합니다.
wsl --install |
후 재부팅하면 설치가 완료됩니다.
다음으로 운영체제를 설치해야합니다.
PS C:\Users\USER> wsl --list --online 다음은 설치할 수 있는 유효한 배포판 목록입니다. 'wsl.exe --install <Distro>'를 사용하여 설치합니다. NAME FRIENDLY NAME Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling Ubuntu-18.04 Ubuntu 18.04 LTS Ubuntu-20.04 Ubuntu 20.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS OracleLinux_7_9 Oracle Linux 7.9 OracleLinux_8_7 Oracle Linux 8.7 OracleLinux_9_1 Oracle Linux 9.1 openSUSE-Leap-15.5 openSUSE Leap 15.5 SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4 SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5 openSUSE-Tumbleweed openSUSE Tumbleweed |
ubuntu 20.04 를 설치해보겠습니다.
PS C:\Users\USER> wsl --install Ubuntu-20.04 설치 중: Ubuntu 20.04 LTS Ubuntu 20.04 LTS이(가) 설치되었습니다. Ubuntu 20.04 LTS을(를) 시작하는 중... Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers # user 계정을 하나 생성합니다. Enter new UNIX username: djjproject New password: Retype new password: passwd: password updated successfully Installation successful! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. |
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Sun Feb 11 14:33:40 KST 2024 System load: 0.47 Processes: 85 Usage of /: 0.1% of 1006.85GB Users logged in: 0 Memory usage: 7% IPv4 address for eth0: 172.27.121.96 Swap usage: 0% Expanded Security Maintenance for Applications is not enabled. 0 updates can be applied immediately. Enable ESM Apps to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status The list of available updates is more than a week old. To check for new updates run: sudo apt update This message is shown once a day. To disable it please create the /home/djjproject/.hushlogin file. djjproject@DESKTOP-D254630:~$ |
wsl1 버전이 적용되었는지 확인하고 wsl1 이면 2로 변환을 시도하며, default 버전을 설정합니다.
PS C:\Users\USER> wsl -l -v NAME STATE VERSION * Ubuntu-20.04 Running 2 |
요즘 win11에서 설치하는 ubuntu wsl 은 기본이 2 인것 같습니다.
혹시 win10 이나 win11 초창기버전에서 하시는 분들은 아래 글을 참고하여 wsl2 에서 하는 것을 권장드립니다.
https://blog.djjproject.com/693
2. WSL 환경 진입하기
일단 wsl 에 진입하고 해당하는 wsl 을 시작하기 위해서 default 설정을 하거나 아니면 직접 지정하여 시작하는 방법이 있습니다.
PS C:\Users\USER> wsl -l -v NAME STATE VERSION * Ubuntu Stopped 2 Ubuntu-20.04 Stopped 2 |
위처럼 되어 있을 경우, wsl 만 입력하면 열리는 쉘이 Ubuntu 의 쉘이 됩니다.
default 를 지정하지 않고 1번 섹션에서 만든 Ubuntu-20.04 를 실행하려면 아래와 같이 입력하여 시작하면 됩니다.
PS C:\Users\USER> wsl -d ubuntu-20.04 To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. djjproject@DESKTOP-D254630:/mnt/c/Users/USER$ |
wsl 을 입력하면 기본적으로 ubuntu-20.04에 진입하고 싶으면 아래 설정을 하면 됩니다.
PS C:\Users\USER> wsl --set-default ubuntu-20.04 작업을 완료했습니다. PS C:\Users\USER> wsl -l -v NAME STATE VERSION * Ubuntu-20.04 Running 2 Ubuntu Stopped 2 PS C:\Users\USER> wsl To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. djjproject@DESKTOP-D254630:/mnt/c/Users/USER$ |
3. 의존 패키지 설치
아래 명령으로 의존 패키지를 설치합니다.
# 패키지 리스트 갱신 djjproject@DESKTOP-D254630:~$ sudo apt update # 패키지 설치 djjproject@DESKTOP-D254630:~$ sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm zstd ncftp curl git-lfs vim net-tools |
4. repo 설치
# repo 스크립트 받기 djjproject@DESKTOP-D254630:~$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo # /usr/local/bin/ 에 복사 djjproject@DESKTOP-D254630:~$ sudo cp repo /usr/local/bin/ # 실행 권한 주기 djjproject@DESKTOP-D254630:~$ sudo chmod a+x /usr/local/bin/repo # 실행 해보기 djjproject@DESKTOP-D254630:~$ repo /usr/bin/env: ‘python’: No such file or directory |
위 repo 에러는 /usr/bin/env python 이 python3를 가르키지 않아 생기는 문제입니다.
그럼 저희가 python-is-python3 같은 패키지 설치를 통해 해결할 수 있겠지만, 그렇게 일반적으로 사용하면 문제가 생기기 때문에 repo 자체를 수정하는 걸 추천합니다.
djjproject@DESKTOP-D254630:~$ sudo vi /usr/local/bin/repo #!/usr/bin/env python3 # # Copyright (C) 2008 The Android Open Source Project # # Licensed under the Apache License, Vers |
그럼 다시 실행하면 아래와 같이 잘 실행됩니다.
djjproject@DESKTOP-D254630:~$ repo error: repo is not installed. Use "repo init" to install it here. |
5. autolinux 소스 받기 - 빌드 경로 설정
wsl 구조상 마운트 구조가 아래와 같습니다.
djjproject@DESKTOP-D254630:~$ df -h Filesystem Size Used Avail Use% Mounted on none 3.8G 4.0K 3.8G 1% /mnt/wsl none 477G 139G 338G 30% /usr/lib/wsl/drivers /dev/sdc 1007G 2.1G 954G 1% / none 3.8G 84K 3.8G 1% /mnt/wslg none 3.8G 0 3.8G 0% /usr/lib/wsl/lib rootfs 3.8G 2.1M 3.8G 1% /init none 3.8G 0 3.8G 0% /dev none 3.8G 900K 3.8G 1% /run none 3.8G 0 3.8G 0% /run/lock none 3.8G 0 3.8G 0% /run/shm tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup none 3.8G 208K 3.8G 1% /mnt/wslg/versions.txt none 3.8G 208K 3.8G 1% /mnt/wslg/doc drvfs 477G 139G 338G 30% /mnt/c snapfuse 54M 54M 0 100% /snap/snapd/19122 snapfuse 64M 64M 0 100% /snap/core20/1891 snapfuse 92M 92M 0 100% /snap/lxd/24061 |
drvfs 와 /dev/sdc가 있습니다. drvfs 는 호스트에 존재하는 disk를 붙여놓은 부분이고
/dev/sdc는 wsl2가 만들어준 가상 디스크로 인지가 되네요.
그럼 컴파일은 /mnt/c 밑에 하는것 보다 그냥 홈폴더에서 하는게 io가 더 빠르기 때문에 /home/[계정명] 경로에서 하시는걸 추천드립니다.
빌드가 끝나면 빌드 결과물만 /mnt/c 에 가져다 두는 것으로 하는게 편할 것 같습니다.
djjproject@DESKTOP-D254630:~$ mkdir topst djjproject@DESKTOP-D254630:~$ cd topst/ djjproject@DESKTOP-D254630:~/topst$ |
가이드를 참고하면 autolinux 를 통해서 빌드하라고 나와 있습니다.
djjproject@DESKTOP-D254630:~/topst$ git clone https://git.huconn.com/linux_ivi_mirror/script/build-autolinux.git djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ls README autolinux classes doc script template |
6. autolinux 통해 소스 받기
일단은 시키는대로 소스를 받은 다음, autolinux 스크립트를 분석하여 autolinux를 사용하지 않는 형대로 가이드는 작성할 예정입니다. 일단은 소스를 autolinux 통해 받아야하기 때문에 가이드를 따라서 받아줍니다.
djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ./autolinux -c configure The command is configure or Add configuration options(sdk,core,manifest) Configure Start Choose a core to build 1.tcc8050-main 2.tcc8050-sub Choose core(1-2): 1 Choose the Features at tcc8050-main * 1. network Install network packages * 2. ssh-server-openssh Install openssh with network packages * 3. meta-micom Enable Micom * 4. meta-update Enable Update * 5. with-subcore Booting with sub-core * 6. with-cr5core Booting with cr5-core * 7. support-4k-video Support 4k Video Contents 0.Exit Choose Features enable/disable (1-7): 0 Choose the Features at tcc8050-sub * 1. meta-micom Enable Micom * 2. meta-update Enable Update 0.Exit Choose Features enable/disable (1-2): 0 Downloading Repo source from https://gerrit.googlesource.com/git-repo repo: Updating release signing keys to keyset ver 2.3 *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. Fetching: 100% (10/10), done in 29.410s Checking out: 100% (10/10), done in 1.449s repo sync has finished successfully. Do you want to use sstate? (y/n) : y /home/djjproject/topst/build-autolinux/poky/download_web.sh buildTools Start buildtools downloading... Please wait ! ~/topst/build-autolinux/tools ~/topst/build-autolinux /home/djjproject/topst/build-autolinux/tools tools --2024-02-11 15:07:21-- https://tost-dl.huconn.com/share/AP/tools/x86_64-buildtools-nativesdk-standalone-3.1.sh Resolving tost-dl.huconn.com (tost-dl.huconn.com)... 121.182.60.114 Connecting to tost-dl.huconn.com (tost-dl.huconn.com)|121.182.60.114|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 25682188 (24M) [application/octet-stream] Saving to: ‘x86_64-buildtools-nativesdk-standalone-3.1.sh’ x86_64-buildtools-nat 100%[=======================>] 24.49M 8.27MB/s in 3.0s 2024-02-11 15:07:24 (8.27 MB/s) - ‘x86_64-buildtools-nativesdk-standalone-3.1.sh’ saved [25682188/25682188] --2024-02-11 15:07:24-- https://tost-dl.huconn.com/share/AP/tools/x86_64-buildtools-extended-nativesdk-standalone-3.0+snapshot-20200315.sh Resolving tost-dl.huconn.com (tost-dl.huconn.com)... 121.182.60.114 Connecting to tost-dl.huconn.com (tost-dl.huconn.com)|121.182.60.114|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 48369100 (46M) [application/octet-stream] Saving to: ‘x86_64-buildtools-extended-nativesdk-standalone-3.0+snapshot-20200315.sh’ |
sstate-cache 는 빌드하면 생기는 캐시라 따로 받을 필요가 없을 수도 있습니다만,
간단히 빌드만 해보겠다는 일반인 입장에서는 이렇게 캐시로 빌드를 빠르게 끝낼 수 있다면 아주 편하고 좋은 시스템인것 같습니다.
다만, qt쪽이나 gstreamer 쪽의 sstate-cache 구성이 잘못되면 잘못된 cache 때문에 빌드가 실패될 수 있어, 조금 개발이 진행되면 새로 sstate-cache 를 생성해야할 수 있습니다.
아래와같이 대략 1시간 만에? 다운로드가 완료되었습니다.
Enabled with-subcore, The autolinux script make new configuration files of Sub-core automatically ================================================================================= SDK=tcc805x_linux_ivi MANIFEST=tcc8050_linux_ivi_tost_0.1.0.xml DATE=2022/04/08 MACHINE=tcc8050-main VERSION=release FEATURES=network,ssh-server-openssh,meta-micom,meta-update,with-subcore,with-cr5core,support-4k-video SUBFEATURES=meta-micom,meta-update ================================================================================= Time taken in 0:59:46.260442 djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ls README autolinux.config build classes doc script tools autolinux boot-firmware buildtools cr5-bsp poky template djjproject@DESKTOP-D254630:~/topst/build-autolinux$ |
7. autolinux 빌드: maincore (ca72)
아래와 같이 빌드합니다.
djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ./autolinux -c build main Read configuration from autolinux.config /home/djjproject/topst/build-autolinux/poky/download_web.sh ubuntu NOTE: Your conf/bblayers.conf has been automatically updated. WARNING: You are running bitbake under WSLv2, this works properly but you should optimize your VHDX file eventually to avoid running out of storage space Parsing recipes: 42% |##################### | ETA: 0:00:22 |
Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "ubuntu-20.04" TARGET_SYS = "aarch64-telechips-linux" MACHINE = "tcc8050-main" DISTRO = "poky-telechips-systemd" DISTRO_VERSION = "3.1.15" TUNE_FEATURES = "aarch64 cortexa72 crc crypto" TARGET_FPU = "" LINUX_VERSION = "5.4.159" KBUILD_DEFCONFIG = "tcc805x_linux_ivi_defconfig" TCMODE = "default" INVITE_PLATFORM = " with-subcore gpu-vz support-4k-video network v4l-utils dp2hdmi wifi-pci-ax200 USB-WEBCAM USB-WiFi-MT7601U USB-SERIAL-CP210X network qt5/wayland micom genivi drm" IMAGE_FEATURES = " debug-tweaks ssh-server-openssh tools-debug eclipse-debug" SDKIMAGE_FEATURES = "dev-pkgs" GCCVERSION = "arm-9.2" GLIBCVERSION = "2.31%" meta meta-poky meta-gplv2 = "HEAD:85d8fc2c0d9b6d9d2710034b19ae3d5eed2df4b2" meta-arm-toolchain = "HEAD:1cfb0a1d773dd6eac3f387fd68ded7c907402d08" meta-telechips-bsp = "HEAD:3b93f65c0817ba3f16754d6c4de84792127f3b0b" meta-qt5 = "HEAD:e3c49254dfa17fe2ebd3367a2adc7bf6016d718c" meta-core meta-extra meta-qt5 meta-micom = "HEAD:fc06c2db4c6fd11e8b6c57a790af279dfb1378f0" meta-update = "HEAD:694c45c2b3d275326254be8daa9217b9096cd68d" meta-ivi meta-genivi = "HEAD:80fca8661da7dcd0f13a569f7616b61d9189e846" meta-mingw = "HEAD:fc06c2db4c6fd11e8b6c57a790af279dfb1378f0" |
sstate-cache 로 거의 매칭되기 때문에 실질적인 빌드과정은 일어나지 않습니다.
실제로 u-boot-tcc / tcc-vpu / linux-telechips 등은 다운로드 되고 빌드가 일어납니다.
아래와 같이 빌드가 완료되었습니다.
WARNING: automotive-linux-platform-image-1.0-r0 do_rootfs: [log_check] automotive-linux-platform-image: found 1 warning message in the logfile: [log_check] Warning: truncating password to 8 characters NOTE: Tasks Summary: Attempted 6300 tasks of which 4877 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory NOTE: Writing buildhistory took: 8 seconds Summary: There were 2 WARNING messages shown. automotive-linux-platform-image building on tcc8050-main ================================================================================= Built Path : /home/djjproject/topst/build-autolinux/build/tcc8050-main ================================================================================= djjproject@DESKTOP-D254630:~/topst/build-autolinux$ |
djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ls build/tcc8050-main/tmp/deploy/images/tcc8050-main/ Image Image--5.4.159-r0-tcc8050-main-20240211073631.bin Image-initramfs--5.4.159-r0-tcc8050-main-20240211073631.bin Image-initramfs-tcc8050-main.bin Image-tcc8050-main.bin automotive-linux-platform-image-tcc8050-main-20240211073631.rootfs.ext4 automotive-linux-platform-image-tcc8050-main-20240211073631.rootfs.manifest automotive-linux-platform-image-tcc8050-main-20240211073631.rootfs.squashfs automotive-linux-platform-image-tcc8050-main-20240211073631.testdata.json automotive-linux-platform-image-tcc8050-main.ext4 automotive-linux-platform-image-tcc8050-main.manifest automotive-linux-platform-image-tcc8050-main.squashfs automotive-linux-platform-image-tcc8050-main.testdata.json ca72_bl3-tcc8050-main-1.0-r0.rom ca72_bl3-tcc8050-main.rom ca72_bl3.rom initramfs-telechips-image-tcc8050-main-20240211073631.rootfs.cpio initramfs-telechips-image-tcc8050-main-20240211073631.rootfs.manifest initramfs-telechips-image-tcc8050-main-20240211073631.testdata.json initramfs-telechips-image-tcc8050-main.cpio initramfs-telechips-image-tcc8050-main.manifest initramfs-telechips-image-tcc8050-main.testdata.json modules--5.4.159-r0-tcc8050-main-20240211073631.tgz modules-tcc8050-main.tgz tc-boot-tcc8050-main.img tc-boot-tcc8050-main_uncompressed.img tc-boot.img tc-boot_uncompressed.img tcc8050-linux-ivi-tost_sv0.1--5.4.159-r0-tcc8050-main-20240211073631.dtb tcc8050-linux-ivi-tost_sv0.1-tcc8050-main.dtb tcc8050-linux-ivi-tost_sv0.1.dtb tcc8050-main-tc-boot-5.4.159-r0.img tcc8050-main-tc-boot_uncompressed-5.4.159-r0.img |
8. autolinux 빌드: subcore (ca53)
아래 명령으로 빌드합니다.
djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ./autolinux -c build sub Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "ubuntu-20.04" TARGET_SYS = "aarch64-telechips-linux" MACHINE = "tcc8050-sub" DISTRO = "poky-telechips-systemd" DISTRO_VERSION = "3.1.15" TUNE_FEATURES = "aarch64 cortexa53 crc" TARGET_FPU = "" LINUX_VERSION = "5.4.159" KBUILD_DEFCONFIG = "tcc805x_a53_subcore_defconfig" TCMODE = "default" INVITE_PLATFORM = " gpu-vz qt-examples qt5/eglfs micom" IMAGE_FEATURES = " debug-tweaks read-only-rootfs" SDKIMAGE_FEATURES = "dev-pkgs" GCCVERSION = "arm-9.2" GLIBCVERSION = "2.31%" SUBCORE_APPS = " rvc" meta meta-poky = "HEAD:85d8fc2c0d9b6d9d2710034b19ae3d5eed2df4b2" meta-qt5 = "HEAD:e3c49254dfa17fe2ebd3367a2adc7bf6016d718c" meta-gplv2 = "HEAD:85d8fc2c0d9b6d9d2710034b19ae3d5eed2df4b2" meta-arm-toolchain = "HEAD:1cfb0a1d773dd6eac3f387fd68ded7c907402d08" meta-telechips-bsp = "HEAD:3b93f65c0817ba3f16754d6c4de84792127f3b0b" meta-qt5 meta-core meta-extra = "HEAD:fc06c2db4c6fd11e8b6c57a790af279dfb1378f0" meta-subcore = "HEAD:84d87a672ebd22d7e5f8feb39c812315ef12de92" meta-micom = "HEAD:fc06c2db4c6fd11e8b6c57a790af279dfb1378f0" meta-ivi = "HEAD:80fca8661da7dcd0f13a569f7616b61d9189e846" meta-update = "HEAD:694c45c2b3d275326254be8daa9217b9096cd68d" Initialising tasks: 100% |################################################| Time: 0:00:03Sstate summary: Wanted 1112 Found 1049 Missed 63 Current 0 (94% match, 0% complete) NOTE: Executing Tasks Currently 6 running tasks (0 of 0) 100% | |0: alsa-plugins-1.2.1-r0 do_populate_lic_setscene - 0s (pid 158349) 1: alsa-topology-conf-1.2.1-r0 do_package_write_deb_setscene - 0s (pid 158390) 2: alsa-plugins-1.2.1-r0 do_populate_sysroot_setscene - 0s (pid 158353) 3: alsa-topology-conf-1.2.1-r0 do_populate_lic_setscene - 0s (pid 158391) |
Initialising tasks: 100% |################################################| Time: 0:00:03Sstate summary: Wanted 1112 Found 1049 Missed 63 Current 0 (94% match, 0% complete) NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 3748 tasks of which 2806 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory NOTE: Writing buildhistory took: 4 seconds Summary: There were 2 WARNING messages shown. telechips-subcore-image building on tcc8050-sub ================================================================================= Built Path : /home/djjproject/topst/build-autolinux/build/tcc8050-sub ================================================================================= djjproject@DESKTOP-D254630:~/topst/build-autolinux$ |
djjproject@DESKTOP-D254630:~/topst/build-autolinux$ ls build/tcc8050-sub/tmp/deploy/images/tcc8050-sub/ Image Image--5.4.159-r0-tcc8050-sub-20240211081232.bin Image-tcc8050-sub.bin ca53_bl3-tcc8050-sub-1.0-r0.rom ca53_bl3-tcc8050-sub.rom ca53_bl3.rom modules--5.4.159-r0-tcc8050-sub-20240211081232.tgz modules-tcc8050-sub.tgz tc-boot-tcc8050-sub.img tc-boot-tcc8050-sub_uncompressed.img tc-boot.img tc-boot_uncompressed.img tcc8050-linux-subcore-ivi-tost_sv0.1--5.4.159-r0-tcc8050-sub-20240211081232.dtb tcc8050-linux-subcore-ivi-tost_sv0.1-tcc8050-sub.dtb tcc8050-linux-subcore-ivi-tost_sv0.1.dtb tcc8050-sub-tc-boot-5.4.159-r0.img tcc8050-sub-tc-boot_uncompressed-5.4.159-r0.img telechips-subcore-image-tcc8050-sub-20240211081232.rootfs.ext4 telechips-subcore-image-tcc8050-sub-20240211081232.rootfs.manifest telechips-subcore-image-tcc8050-sub-20240211081232.testdata.json telechips-subcore-image-tcc8050-sub.ext4 telechips-subcore-image-tcc8050-sub.manifest telechips-subcore-image-tcc8050-sub.testdata.json |
9. autolinux 빌드: mcu (cr5)