From 9d1694b9fdee379cabdf8744be50dfbf360da09c Mon Sep 17 00:00:00 2001 From: Ben Swartzlander Date: Wed, 19 Oct 2016 14:59:38 -0400 Subject: [PATCH] Split out one-time steps into their own script Clarify the documentation on building --- README | 22 ++++++++++------------ doc/building.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ init-buildroot.sh | 33 +++++++++++++++++++++++++++++++++ run-buildroot.sh | 25 +------------------------ 4 files changed, 87 insertions(+), 36 deletions(-) create mode 100644 doc/building.txt create mode 100755 init-buildroot.sh diff --git a/README b/README index df76bda..c8b5a61 100644 --- a/README +++ b/README @@ -26,25 +26,23 @@ On Fedora: sudo dnf -y install bison flex texinfo gettext ncurses-devel unzip \ sshpass quilt qt-devel qemu-kvm gcc-c++ make glibc-devel.i686 -== Building the image == +== Building the images == -To make buildroot compile the system run: +To build both images run: ./run-buildroot.sh -After buildroot succeeds, create the qcow2 file: - - ./make-bootable-disk.sh client - -== Cleaning == - -To do a simple clean after changing some config options: - - cd buildroot - make O=../output-client clean +== Cleaning up == To nuke everything and start over: rm -rf buildroot output* overlay* sudo rm *.qcow2 +== Detailed Docs == + +More detailed docs are available: + +* doc/building.txt - individual build steps +* doc/configuring.txt - how to change the config +* doc/testing.txt - how to test the images diff --git a/doc/building.txt b/doc/building.txt new file mode 100644 index 0000000..1b570f1 --- /dev/null +++ b/doc/building.txt @@ -0,0 +1,43 @@ + +== Initial setup == + +There are several one time steps that need to be done after cloning a +new repo. These are all handled by running: + + ./init-buildroot.sh + +== Building == + +It's best to look at what run-buildroot.sh does, but the basic flow +for building an image is: + +Create the overlay (for the client image): + + mkdir overlay-client + cp -a common-files/* overlay-client + +Copy the defconfig and create an output directory (for the client +image, for example): + + cp conf/buildroot-client.config buildroot/configs/manila_client_defconfig + ( cd buildroot ; make O=../output-client manila_client_defconfig ) + rm buildroot/configs/manila_client_defconfig + +Then invoke make in the appropriate directory: + + ( cd buildroot ; make O=../output-client all ) + +== Creating the qcow2 image == + +After buildroot succeeds, create the qcow2 file (for the client image, +for example): + + ./make-bootable-disk.sh client + +== Cleaning == + +To do a simple clean after changing some config options (for the client +image, for example): + + cd buildroot + make O=../output-client clean diff --git a/init-buildroot.sh b/init-buildroot.sh new file mode 100755 index 0000000..3590106 --- /dev/null +++ b/init-buildroot.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright 2016 (C) NetApp, Inc. +# Author: Ben Swartzlander +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + + +VERSION=2016.02 +FILENAME=buildroot-${VERSION}.tar.bz2 + +# Download buildroot if we don't have it already +if [ ! -f download/$FILENAME ] +then + wget -P download http://buildroot.org/downloads/$FILENAME +fi + +# Untar buildroot if it's not already there +if [ ! -d buildroot ] +then + mkdir buildroot + tar -C buildroot -xf download/$FILENAME --strip 1 +fi + +# Apply patches to buildroot if we haven't done so before +PATCH_FLAG_FILE=buildroot/.manila-patches-applied +if [ ! -f $PATCH_FLAG_FILE ] +then + ( cd buildroot ; QUILT_PATCHES=../patches quilt push -a ) + touch $PATCH_FLAG_FILE +fi diff --git a/run-buildroot.sh b/run-buildroot.sh index fadff7b..d9bc619 100755 --- a/run-buildroot.sh +++ b/run-buildroot.sh @@ -7,30 +7,7 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. - -VERSION=2016.02 -FILENAME=buildroot-${VERSION}.tar.bz2 - -# Download buildroot if we don't have it already -if [ ! -f download/$FILENAME ] -then - wget -P download http://buildroot.org/downloads/$FILENAME -fi - -# Untar buildroot if it's not already there -if [ ! -d buildroot ] -then - mkdir buildroot - tar -C buildroot -xf download/$FILENAME --strip 1 -fi - -# Apply patches to buildroot if we haven't done so before -PATCH_FLAG_FILE=buildroot/.manila-patches-applied -if [ ! -f $PATCH_FLAG_FILE ] -then - ( cd buildroot ; QUILT_PATCHES=../patches quilt push -a ) - touch $PATCH_FLAG_FILE -fi +./init-buildroot.sh # Create the filesystem overlays if [ ! -d overlay-client ]