在Docker中运行Yocto,“make menuconfig”失败

时间:2017-02-14 16:56:54

标签: docker embedded yocto bitbake

在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

4 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

布拉德的答案是正确的(代表太低甚至不能+1或评论回来)

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

从我当地的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建议安装屏幕&#39;以root用户身份(默认情况下在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,在屏幕上开始构建&#39;会话:

$ 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

答案 2 :(得分:0)

我们使用相同的设置(在docker容器中放置yocto),但是tty确实显示了有效的tty(也许是因为我们将--ttydocker exec一起使用了?)。

尽管如此,我们仍然在图像中缺少终端仿真器。使用较新版本的yocto时,将为您提供yocto尝试生成开发外壳程序的命令列表,如下所示:

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)。

答案 3 :(得分:0)

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