Qemuarm64 환경의 Lua5시운전 4.0

qemu 환경 만들기


Poky의 clone
$ git clone -b dunfell git://git.yoctoproject.org/poky.git
$ cd poky
$ source oe-init-build-env build001 
conf/local.다음과 같이 conf 수정
MACHINE ?= "qemuarm64" # デフォルトだとqemux86-64となっている
IMAGE_INSTALL_append = " openssh" # devtool deploy-targetで使用するため sshを追加
QB_SERIAL_OPT_append = " -serial mon:stdio" # qemuの起動オプション
meta/conf/machine/qemuarm64.다음과 같이 conf 수정
(-nographic를 지정하지 않으면 -serial mon:stdio가 유효하지 않을 것 같다)
diff --git a/meta/conf/machine/qemuarm64.conf b/meta/conf/machine/qemuarm64.conf
index 2cf1a0206c..63e54bcea0 100644
--- a/meta/conf/machine/qemuarm64.conf
+++ b/meta/conf/machine/qemuarm64.conf
@@ -18,7 +18,8 @@ QB_CPU_KVM = "-cpu host -machine gic-version=3"
 # Standard Serial console
 QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0"
 # For graphics to work we need to define the VGA device as well as the necessary USB devices
-QB_OPT_APPEND = "-show-cursor -device VGA,edid=on"
+QB_OPT_APPEND = "-nographic "
 QB_OPT_APPEND += "-device qemu-xhci -device usb-tablet -device usb-kbd"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
 QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
이미지 생성
$ bitbake core-image-minimal 

Lua5.4.0 추가


devotol을 사용합니다.우선 레시피 파일을 추가합니다.
$ devtool add lua https://www.lua.org/ftp/lua-5.4.0.tar.gz
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
INFO: Fetching https://www.lua.org/ftp/lua-5.4.0.tar.gz...
Loading cache: 100% |###################################################################################################################| Time: 0:00:01
Loaded 1312 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "qemuarm64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "aarch64 armv8a crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       
workspace            = "dunfell:f2ae38a055f54640a968c4a8d5074f044202380e"

Initialising tasks: 100% |##############################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Found 0 Missed 0 Current 0 (0% match, 0% complete)
NOTE: No setscene tasks
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 2 tasks of which 0 didn't need to be rerun and all succeeded.
INFO: Using default source tree path /home/USERNAME/yocto/poky/build001/workspace/sources/lua
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Reconnecting to bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Retrying server connection (#1)...
NOTE: Starting bitbake server...
INFO: Using source tree as build directory since that would be the default for this recipe
INFO: Recipe /home/USERNAME/yocto/poky/build001/workspace/recipes/lua/lua_5.4.0.bb has been automatically created; further editing may be required to make it fully functional
이후 구축 중 오류가 발생했습니다.
$ devtool build lua
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Reconnecting to bitbake server...
NOTE: Previous bitbake instance shutting down?, waiting to retry...
NOTE: Retrying server connection (#2)...
Loading cache: 100% |###################################################################################################################| Time: 0:00:00
Loaded 1312 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
Loading cache: 100% |###################################################################################################################| Time: 0:00:01
Loaded 1312 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "qemuarm64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "aarch64 armv8a crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       
workspace            = "dunfell:f2ae38a055f54640a968c4a8d5074f044202380e"

Initialising tasks: 100% |##############################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Found 0 Missed 0 Current 124 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: lua: compiling from external source tree /home/USERNAME/yocto/poky/build001/workspace/sources/lua
ERROR: lua-5.4.0-r0 do_install: oe_runmake failed
ERROR: lua-5.4.0-r0 do_install: Execution of '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/temp/run.do_install.76390' failed with exit code 1:
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.4 /usr/local/lib/lua/5.4
mkdir: cannot create directory ‘/usr/local/share/lua’: Permission denied
mkdir: cannot create directory ‘/usr/local/lib/lua’: Permission denied
make: *** [Makefile:58: install] Error 1
WARNING: exit code 1 from a shell command.

ERROR: Logfile of failure stored in: /home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/temp/log.do_install.76390
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['virtual:native:/home/USERNAME/yocto/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', '/home/USERNAME/yocto/poky/meta/recipes-devtools/gcc/gcc-cross_9.3.bb:do_populate_sysroot', '/home/USERNAME/yocto/poky/meta/recipes-core/glibc/glibc_2.31.bb:do_populate_sysroot', '/home/USERNAME/yocto/poky/meta/recipes-devtools/gcc/gcc-runtime_9.3.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['pseudo-native', 'gcc-cross-aarch64', 'glibc', 'gcc-runtime', 'automake-native', 'patch-native', 'xz-native', 'flex-native', 'zlib-native', 'gnu-config-native', 'quilt-native', 'linux-libc-headers', 'gmp-native', 'libtool-native', 'autoconf-native', 'texinfo-dummy-native', 'mpfr-native', 'binutils-cross-aarch64', 'libmpc-native', 'libgcc', 'attr-native', 'gettext-minimal-native', 'm4-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_install
| NOTE: make -j 4 install
| cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.4 /usr/local/lib/lua/5.4
| mkdir: cannot create directory ‘/usr/local/share/lua’: Permission denied
| mkdir: cannot create directory ‘/usr/local/lib/lua’: Permission denied
| make: *** [Makefile:58: install] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/temp/run.do_install.76390' failed with exit code 1:
| cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.4 /usr/local/lib/lua/5.4
| mkdir: cannot create directory ‘/usr/local/share/lua’: Permission denied
| mkdir: cannot create directory ‘/usr/local/lib/lua’: Permission denied
| make: *** [Makefile:58: install] Error 1
| WARNING: exit code 1 from a shell command.
| 
ERROR: Task (/home/USERNAME/yocto/poky/build001/workspace/recipes/lua/lua_5.4.0.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 528 tasks of which 523 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/USERNAME/yocto/poky/build001/workspace/recipes/lua/lua_5.4.0.bb:do_install
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
길지만 이유는 다음과 같다.
/usr/local/아래에 설치하려고 합니다.
mkdir: cannot create directory ‘/usr/local/share/lua’: Permission denied
mkdir: cannot create directory ‘/usr/local/lib/lua’: Permission denied
Makefile을 보면 다음과 같이 INSTALL"/usr/local"은 TOP에 지정되어 있습니다.
INSTALL_TOP= /usr/local # <-- ここ
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL_INC= $(INSTALL_TOP)/include
INSTALL_LIB= $(INSTALL_TOP)/lib
INSTALL_MAN= $(INSTALL_TOP)/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
그래서 여기에 논평합니다.
# INSTALL_TOP= /usr/local # コメントアウトする
recipes/lua/lua_5.4.0.bb의 도다음과 같이 설치를 수정합니다.
${D}의 설명은 여기(Yocto Project Mega-Mual)입니다.
do_install () {
	# This is a guess; additional arguments may be required
	oe_runmake install INSTALL_TOP=${D} # INSTALL_TOP=${D}を追加 
}
이제 다시 구축을 시도합니다.
유감스럽게도 이것도 실패했다.
$ devtool build lua
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Reconnecting to bitbake server...
NOTE: Previous bitbake instance shutting down?, waiting to retry...
NOTE: Retrying server connection (#2)...
Loading cache: 100% |###################################################################################################################| Time: 0:00:00
Loaded 1312 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
Loading cache: 100% |###################################################################################################################| Time: 0:00:01
Loaded 1312 entries from dependency cache.
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "qemuarm64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "aarch64 armv8a crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       
workspace            = "dunfell:f2ae38a055f54640a968c4a8d5074f044202380e"

Initialising tasks: 100% |##############################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Found 0 Missed 0 Current 124 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: lua: compiling from external source tree /home/USERNAME/yocto/poky/build001/workspace/sources/lua
ERROR: lua-5.4.0-r0 do_package: Fatal errors occurred in subprocesses:
Command '['aarch64-poky-linux-objcopy', '--only-keep-debug', '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/lua', '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/.debug/lua']' returned non-zero exit status 1.
Subprocess output:aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/lua'
Command '['aarch64-poky-linux-objcopy', '--only-keep-debug', '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/luac', '/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/.debug/luac']' returned non-zero exit status 1.
Subprocess output:aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `/home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/package/bin/luac'

ERROR: Logfile of failure stored in: /home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/temp/log.do_package.79056
ERROR: Task (/home/USERNAME/yocto/poky/build001/workspace/recipes/lua/lua_5.4.0.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 530 tasks of which 526 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/USERNAME/yocto/poky/build001/workspace/recipes/lua/lua_5.4.0.bb:do_package
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
meta/classes/package.bbclass 이하와 관련이 있는 것 같아요.
    #
    # First lets process debug splitting
    #
    if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
        results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, debugdir, debuglibdir, debugappend, debugsrcdir, d))
상세한 상황 불명...
요컨대 가방(´63;)제작은 필요 없습니다. 포장 제작과 관련된 처리를 건너뛰었습니다.
참조 문서는 다음과 같습니다.
  • INHIBIT_PACKAGE_STRIP
  • INHIBIT_PACKAGE_DEBUG_SPLIT
  • Deleting a Task
  • do_packagedata
  • do_package
  • do_package_qa
  • recipes/lua/lua_5.4.0.bb에 다음과 같은 내용을 추가합니다.
    do_package[noexec] = "1"
    do_packagedata[noexec] = "1"
    do_package_qa[noexec] = "1"
    INHIBIT_PACKAGE_STRIP = "1"
    INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
    
    다시 한 번 자세히 보면 컴파일러의 지정은 gcc로 고정되어 있다
    다음과 같이 sources/lua/src/Makefile을 수정합니다.
    # Your platform. See PLATS for possible values.
    PLAT= linux # linuxに変更
    
    #CC= gcc -std=gnu99 # コメントアウト
    
    sources/lua/Makefile도 다음과 같이 수정되었습니다.
    PLAT= linux # linuxに変更
    
    빌딩이 마침내 통과되었다.
    $ devtool build lua
    NOTE: Starting bitbake server...
    NOTE: Reconnecting to bitbake server...
    NOTE: Retrying server connection (#1)...
    Loading cache: 100% |###################################################################################################################| Time: 0:00:00
    Loaded 1312 entries from dependency cache.
    Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
    Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
    Loading cache: 100% |###################################################################################################################| Time: 0:00:01
    Loaded 1312 entries from dependency cache.
    Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
    Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    
    Build Configuration:
    BB_VERSION           = "1.46.0"
    BUILD_SYS            = "x86_64-linux"
    NATIVELSBSTRING      = "universal"
    TARGET_SYS           = "aarch64-poky-linux"
    MACHINE              = "qemuarm64"
    DISTRO               = "poky"
    DISTRO_VERSION       = "3.1.2"
    TUNE_FEATURES        = "aarch64 armv8a crc"
    TARGET_FPU           = ""
    meta                 
    meta-poky            
    meta-yocto-bsp       
    workspace            = "dunfell:f2ae38a055f54640a968c4a8d5074f044202380e"
    
    Initialising tasks: 100% |##############################################################################################################| Time: 0:00:00
    Sstate summary: Wanted 0 Found 0 Missed 0 Current 124 (0% match, 100% complete)
    NOTE: Executing Tasks
    NOTE: Tasks Summary: Attempted 531 tasks of which 529 didn't need to be rerun and all succeeded.
    

    qemu 환경으로 복사


    먼저 qemu를 시작합니다.
    $ runqemu tmp/deploy/images/qemuarm64/
    
    다음은 다른 창에서 아래와 같다.
    devotol을 실행합니다.이렇게 되면 Lua는 qemu 환경으로 복사됩니다.
    $ devtool deploy-target -s lua [email protected]
    NOTE: Starting bitbake server...
    NOTE: Reconnecting to bitbake server...
    NOTE: Retrying server connection (#1)...
    Loading cache: 100% |###################################################################################################################| Time: 0:00:01
    Loaded 1312 entries from dependency cache.
    Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00
    Parsing of 773 .bb files complete (771 cached, 2 parsed). 1314 targets, 56 skipped, 0 masked, 0 errors.
    devtool_deploy.list                                                                                                  100%  187    34.2KB/s   00:00    
    devtool_deploy.sh                                                                                                    100% 1017   324.8KB/s   00:00    
    ./
    ./lib/
    ./lib/liblua.a
    ./lib/lua/
    ./lib/lua/5.4/
    ./include/
    ./include/lauxlib.h
    ./include/lua.hpp
    ./include/lualib.h
    ./include/lua.h
    ./include/luaconf.h
    ./man/
    ./man/man1/
    ./man/man1/luac.1
    ./man/man1/lua.1
    ./bin/
    ./bin/lua
    ./bin/luac
    ./share/
    ./share/lua/
    ./share/lua/5.4/
    INFO: Successfully deployed /home/USERNAME/yocto/poky/build001/tmp/work/aarch64-poky-linux/lua/5.4.0-r0/image
    
    방금 시작한 qemu 측에서 lua를 실행합니다.
    root@qemuarm64:~# lua
    Lua 5.4.0  Copyright (C) 1994-2020 Lua.org, PUC-Rio
    > exit()
    stdin:1: attempt to call a nil value (global 'exit')
    stack traceback:
    	stdin:1: in main chunk
    	[C]: in ?
    > a = 10
    > b = 20
    > b + a
    30
    > ^C
    root@qemuarm64:~# 
    
    완료.

    좋은 웹페이지 즐겨찾기