【问题标题】:Running Yocto in Docker, "make menuconfig" fails在 Docker 中运行 Yocto,“make menuconfig”失败
【发布时间】:2017-07-03 01:55:24
【问题描述】:

在 Docker 容器中运行 Yocto,我无法执行“make menuconfig”

$ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite

ERROR: No valid terminal found, unable to open devshell
ERROR: Function failed: do_menuconfig

【问题讨论】:

  • 我认为安装tmux 可以解决这个问题。

标签: docker embedded yocto bitbake


【解决方案1】:
    Solution: gnu "screen" command

    Bitbake tries to spawn a number of terminal programs, most of which fail
    because A) they're not installed or B) they require X Windows.  We can't
    execute X terminals in the docker command-line (no X support).

    So the most viable terminal is gnu screen.

    In my ubuntu docker container:
        $ sudo apt-get install screen
        $ tty             // Shows "not a tty", we're trying to fix that

    Get in the docker containter as root  (something like:   docker exec -it $(docker ps -q) /bin/bash )
        # agetty tty        // This will present you with a login prompt, login as your regular yocto user
        $ tty               // Should show a valid tty
        $ screen            // Start a screen session
        $ cd build          // Got to Yocto build dir
        $ source conf/setenv
        $ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite    // Will spawn a new "screen" terminal, using ncurses for menuconfig

【讨论】:

  • screen 是 yocto 最不喜欢生成开发者 shell 的选项,在我们的例子中会导致一个很小的 ​​menuconfig 屏幕。 tmux 对我们来说效果更好。
【解决方案2】:

布拉德的回答是正确的(代表太低,甚至无法 +1 或评论)

我有一个 Docker 映像(Dockerfile 包括 FROM ubuntu:trusty 并创建了一个 builduser 帐户)并执行了以下操作:

从我的本地 PC 终端 #1 :

// my Dockerfile will default into USER builduser account, use 'sudo' if you need to here
$ docker run -it <my image name from 'docker images'> /bin/bash
$ tty
/dev/console

将图像加载到容器中后,我将打开另一个 PC 终端 #2 并执行 Brad 以 root 身份安装“screen”的建议(在 Ubuntu 图像上默认禁用 root 密码,因此这是一种解决方法):

// -u parameter is <user id> and root's uid is 0
$ docker exec -u 0 -it <my temporary container id from 'docker ps -q'> /bin/bash
// notice command prompt went to '#' indicating root
# apt-get install screen
# tty
not a tty

回到 PC 终端 #1,在“屏幕”会话中开始构建:

$ which screen
/usr/bin/screen
$ tty
/dev/console
// start 'screen' session, will launch /bin/sh by default
$ screen
$ cd <build directory>   # your Yocto build dir
$ source <config file>   # (optional) your Yocto build env config file>
// will launch ncurses menuconfig after a build
$ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite

【讨论】:

    【解决方案3】:

    我们使用相同的设置(docker 容器中的 yocto),但 tty 确实显示了一个有效的 tty(可能是因为我们使用 --ttydocker exec?)。

    不过,我们的映像中仍然缺少终端仿真器。使用较新版本的 yocto 时,您会看到 yocto 尝试生成开发 shell 的命令列表,如下所示:

    ERROR: busybox-1.24.1-r0 do_menuconfig: No valid terminal found, unable to open devshell.
    Tried the following commands:
        tmux split-window "do_terminal"
        [...]
        screen -D -m -t "busybox Configuration" -S devshell do_terminal
    

    在使用旧版本的 yocto 时,您可能需要应用 commit 来实现已尝试命令列表的输出。

    解决方案现在很明显:安装一个(非窗口)终端仿真器,例如 tmux (apt-get install tmux)。

    【讨论】:

      【解决方案4】:

      apt-get install screen 如果 docker 容器是 debian 或 ubuntu。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-13
        • 2021-01-04
        • 2021-03-16
        • 1970-01-01
        • 2017-11-20
        相关资源
        最近更新 更多