diff --git a/.bashrc b/.bashrc index 8526d6d1..1bbf65dd 100644 --- a/.bashrc +++ b/.bashrc @@ -13,4 +13,8 @@ . setup.env -echo Ready to build OpenNetworkLinux. +if [ -n "$ONL_AUTOBUILD" ]; then + make all +else + echo Ready to build OpenNetworkLinux. +fi diff --git a/Makefile b/Makefile index 62d86c21..07e150db 100644 --- a/Makefile +++ b/Makefile @@ -42,4 +42,4 @@ docker_check: @which docker > /dev/null || (echo "*** Docker appears to be missing. Please install docker.io in order to build OpenNetworkLinux." && exit 1) docker: docker_check - @docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull + @docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull --autobuild --non-interactive diff --git a/docker/tools/onlbuilder b/docker/tools/onlbuilder index 3cde708a..04ec4ae4 100755 --- a/docker/tools/onlbuilder +++ b/docker/tools/onlbuilder @@ -96,6 +96,10 @@ ap.add_argument("--volumes", metavar='DIRECTORY', default=[]) +ap.add_argument("--autobuild", + help="Automatic build in isolation mode.", + action='store_true') + ap.add_argument("--command", "-c", help="Explicit command to run. All arguments after -c are considered to be part of the command.", nargs=argparse.REMAINDER, @@ -171,6 +175,9 @@ else: if ops.hostname: g_docker_arguments += " -h %s" % ops.hostname + if ops.autobuild: + g_docker_arguments += " -e ONL_AUTOBUILD=1 " + else: # Development host mode g_docker_arguments += "-e USER=%(username)s --net host -w %(workdir)s " % g_arg_d diff --git a/docs/Building.md b/docs/Building.md index 951dfee3..abe095d7 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -12,29 +12,37 @@ ONL builds with Docker so the only requirements on the build system is: - docker # to grab the build workspace - binfmt-support # kernel support for ppc builds - About 40G of disk free space # to build all images +- At least 4G of ram and 4G of swap # compilation is memory intensive All of the testing is done with Debian, other Linux distributions may work, but we suggest using Debian 8. - # apt-get install lxc-docker binfmt-support + # apt-get install binfmt-support + then follow the instructions at: https://docs.docker.com/engine/installation/debian/ Build ONL Summary ------------------------------------------------------------ -The easiest way to build is to use the autobuild script: +The easiest way to build is to use the make docker command: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux - #> tools/autobuild/build.sh + #> cd OpenNetworkLinux + #> make docker This will build a Debian 7 based ONL from the master branch -To build a Debian 8 based ONL simply run: +To build a Debian 8 based ONL run: - #> tools/autobuild/build.sh -8 + #> git clone https://github.com/opencomputeproject/OpenNetworkLinux + #> cd OpenNetworkLinux + #> export VERSION=8 + #> make docker + If you would like to build by hand you can do the following: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux #> cd OpenNetworkLinux - #> make docker # enter the docker workspace + #> docker/tools/onlbuilder (-8) # enter the docker workspace + #> source setup.env # pull in necessary environment variables #> make amd64 ppc # make onl for $platform (currently amd64 or powerpc) The resulting ONIE installers are in @@ -50,9 +58,6 @@ RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64.swi Docker installer oneliner (for reference: see docker.com for details) - # apt-get install -y lxc-docker -or - # wget -qO- https://get.docker.com/ | sh