5

I try to build the Linux kernel with Buildroot using Docker. I've created a simple Docker image:

FROM debian:7
MAINTAINER OrangeTux


RUN apt-get update && \
    apt-get install -y \
    build-essential \
    bash \
    bc \
    binutils \
    build-essential \
    bzip2 \
    cpio \
    g++ \
    gcc \
    git \
    gzip \
    make \
    libncurses5-dev \
    patch \
    perl \
    python \
    rsync \
    sed \
    tar \
    unzip \
    wget

WORKDIR /root

RUN git clone git://git.buildroot.net/buildroot 

WORKDIR /root/buildroot

CMD ["/bin/bash"]

I want to keep dl/ andoutput/build/ when container stops, so I don't have to download and compile all dependencies every time. I also want the build products on my host. Therefore I start container like this:

$ docker run -ti -v $(pwd)/dl:/root/buildroot/dl -v \ $(pwd)/output/build:/root/buildroot/output/build -v \ $(pwd)/output/images:/root/buildroot/output/images orangetux/buildroot

I'm able to run make menuconfig which builds the configuration for Buildroot. I've made a few modifications to the defaults. Here's the output of make savedefconfig:

BR2_arm=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_DEFCONFIG="at91_dt"

The next step is to build linux-menuconfig. This action failed and I've no clue what is going wrong:

 $ make linux-menuconfig
/usr/bin/make -j1  HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" silentoldconfig
make[1]: Entering directory `/root/buildroot'
BR2_DEFCONFIG='' KCONFIG_AUTOCONFIG=/root/buildroot/output/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/root/buildroot/output/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/root/buildroot/output/build/buildroot-config/tristate.config BR2_CONFIG=/root/buildroot/.config BR2_EXTERNAL=support/dummy-external SKIP_LEGACY= /root/buildroot/output/build/buildroot-config/conf --silentoldconfig Config.in

*** Error during update of the configuration.

make[1]: *** [silentoldconfig] Error 1
make[1]: Leaving directory `/root/buildroot'
make: *** [/root/buildroot/output/build/buildroot-config/auto.conf] Error 2

The file /root/buildroot/output/build/buildroot-config/auto.conf doesn't exists.

Why does the file not exists and how can I build linux-menuconfig?

  • I just tested with the latest Buildroot, and it works fine for me, with the exact same defconfig. – Thomas Petazzoni Apr 18 '15 at 13:30
  • @ThomasPetazzoni How did you start you container? I've update my answer with the way I start my container. – OrangeTux Apr 18 '15 at 14:26
1

After extensive debugging I found out that mounting a folder on my host system at /root/buildroot/output/ causes the problem. Remove this mount and make linux-menuconfig is possible.

Further debugging revealed that mounting a host folder at /root/buildroot/output/build in the container is the problem. I've no clue why.

  • 2
    Because the folder you're mounting does not belong to root. Do it like so:WORKDIR /usr/src/debian-custom git clone git clone git://git.buildroot.net/buildroot ` ln -s /usr/srx/linux /usr/src/debian-custom, then run make menuconfig` from /usr/src/linux. See Building a Custom Kernel for Debian – eyoung100 Apr 24 '15 at 22:48
  • Unfortunately my Docker container doesn't have a folder /usr/src/linux. And I don't want to compile Linux for Debian, but for a custom root file system. But I don't know it that matters in this case. – OrangeTux Apr 25 '15 at 7:51
0

This sounds like a permissions problem. Either user permissions (chmod or acl), MAC (Mandatory Access Control, often selinux or similar) or filesystem write permissions. I think it is probably the third in that your container is not able to write to the device.

  • Even after chown and chmod to give full access to output/ directory it returns same error. – OrangeTux Apr 25 '15 at 7:56
  • ok, you ruled out the first of the three possibilities I listed. – hildred Apr 25 '15 at 16:10
0

I solved that by:

1- Stop the lxc .

lxc stop <container-name>

2- Adjust the security privileged to true .

 lxc config set <container-name> security.privileged true

3- Start the container again .

lxc start 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.