changtimwu / changtimwu.github.com

Tim's testing/practice notes
7 stars 2 forks source link

docker & openwrt #12

Open changtimwu opened 9 years ago

changtimwu commented 9 years ago

you have to increase size first. 20GB isn't enough for openwrt compilation. https://docs.docker.com/articles/b2d_volume_resize/

changtimwu commented 9 years ago

my office's is already 100G. Now we can get 100G in a simpler way. https://coderwall.com/p/w-zk9w/increase-boot2docker-space-allocation-in-osx

I just upgraded boot2docker via boot2docker upgrade

changtimwu commented 9 years ago

exited docker container's data are still there. roll a exited container back by

docker start
docker attach
changtimwu commented 9 years ago

create a Dockerfile like this

FROM phusion/baseimage
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y git-core subversion build-essential gcc-multilib lib32stdc++6 lib32z1 libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python libssl-dev

and build it

 docker build -t wrtbuildimg .
changtimwu commented 9 years ago

create (without run) a data container named owbuild based on image wrtbuild, it would be always mounted on /root/owbuild within the image wrtbuildimg. This data container creates a data volume at /root/owbuild.

docker create -v /root/owbuild --name owbuild wrtbuildimg

check it by docker ps -a. You can see a container named owbuild out there. Its status is stopped but that's ok since we want it to be a data-only container.

f5f821eefd69        wrtbuildimg              "/bin/bash"         20 minutes ago         owbuild 

run(create) a container, inherits data volumes from owbuild

docker run -it     --volumes-from owbuild     wrtbuildimg  /bin/bash

in order to access files from host. We should add -v

docker run -it -v "$HOME/docker/shared:/root/shared"  --volumes-from owbuild wrtbuildimg  /bin/bash
changtimwu commented 9 years ago

all the openwrt build should be done in /root/owbuild since it's permanent.

cd /root/owbuild
git clone https://github.com/openwrt-mirror/openwrt.git
cd openwrt
 ./scripts/feeds update

To build luci, please run the two

./scripts/feeds update luci
./scripts/feeds install -a -p luci

copy A385's default config and do necessary modify and then build

wget -o .config https://downloads.openwrt.org/snapshots/trunk/mvebu/generic/config 
make menuconfig
make V=1 -j4

remember to turn on sd/mmc options if your root partition is on SD card.

changtimwu commented 9 years ago
root@ff03fd162011:~/owbuild/openwrt# ls -alh bin/mvebu/ 
total 36M
drwxr-xr-x 3 root root 4.0K Jul 22 06:58 .
drwxr-xr-x 3 root root 4.0K Jul 22 06:28 ..
-rw-r--r-- 1 root root  28M Jul 22 06:56 OpenWrt-Toolchain-mvebu_gcc-4.8-linaro_musl-1.1.10_eabi.Linux-x86_64.tar.bz2
-rw-r--r-- 1 root root  264 Jul 22 06:58 md5sums
-rw-r--r-- 1 root root 3.5M Jul 22 06:57 openwrt-mvebu-385-RD-rootfs.tar.gz
-rw-r--r-- 1 root root 4.8M Jul 22 06:58 openwrt-mvebu-armada-385-rd-squashfs-firmware.bin
drwxr-xr-x 9 root root 4.0K Jul 22 06:58 packages
-rw-r--r-- 1 root root  469 Jul 22 06:58 sha256sums