From 885e93b241cc62c4c483c972a81184f21e391a62 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 3 May 2015 12:13:38 -0700 Subject: [PATCH] feature: Add scripts for generating images. These scripts are intended to be run by Jenkins. minimal/no error checking is done with these scripts at this time. Some ENV variables needs to be set before executing these scripts. --- build/buildsteps/001-prepbuild | 21 ++++++ build/buildsteps/002-makekconfig | 45 +++++++++++++ build/buildsteps/003-buildimage.sh | 35 ++++++++++ build/buildsteps/kconfig/001-architecture | 41 ++++++++++++ build/buildsteps/kconfig/002-ath9kregd | 39 +++++++++++ build/buildsteps/kconfig/003-packages | 82 +++++++++++++++++++++++ build/makeimage.sh | 67 ++++++++++++++++++ 7 files changed, 330 insertions(+) create mode 100755 build/buildsteps/001-prepbuild create mode 100755 build/buildsteps/002-makekconfig create mode 100755 build/buildsteps/003-buildimage.sh create mode 100755 build/buildsteps/kconfig/001-architecture create mode 100755 build/buildsteps/kconfig/002-ath9kregd create mode 100755 build/buildsteps/kconfig/003-packages create mode 100755 build/makeimage.sh diff --git a/build/buildsteps/001-prepbuild b/build/buildsteps/001-prepbuild new file mode 100755 index 00000000..83e328d6 --- /dev/null +++ b/build/buildsteps/001-prepbuild @@ -0,0 +1,21 @@ +#!/bin/sh + +cd "$BUILDROOTBASE" + +# Prep the feeds file +echo "src-git arednpackages git://git.aredn.org/aredn_packages;develop" > feeds.conf +cat feeds.conf.default >> feeds.conf +./scripts/feeds update -a +./scripts/feeds install -p arednpackages olsrd +./scripts/feeds install perl +./scripts/feeds install -p arednpackages vtun +./scripts/feeds install snmpd + +SHORT_COMMIT=$(echo "$GIT_COMMIT" | awk '{ string=substr($0, 1, 8); print string; }' ) +SHORT_BRANCH=$(echo "$GIT_BRANCH" | awk 'match($0,"/"){print substr($0,RSTART+1)}') + +if ( -z "$BUILD_SET_VERSION" ); then + echo "$BUILD_SET_VERSION" > "$BUILDROOTBASE/files/etc/mesh-release" +else + echo "${SHORT_BRANCH}-${BUILD_NUMBER}-${SHORT_COMMIT}" > "$BUILDROOTBASE/files/etc/mesh-release" +fi diff --git a/build/buildsteps/002-makekconfig b/build/buildsteps/002-makekconfig new file mode 100755 index 00000000..4580f5d5 --- /dev/null +++ b/build/buildsteps/002-makekconfig @@ -0,0 +1,45 @@ +#!/bin/sh +<<'LICENSE' + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Conrad Lara + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +LICENSE + +. "$SCRIPTBASE/sh2ju.sh" + +rm "$BUILDROOTBASE/.config" 2> /dev/null + +touch "$BUILDROOTBASE/.config" + +for file in "$SCRIPTBASE"/buildsteps/kconfig/* +do + $file >> "$BUILDROOTBASE/.config" +done diff --git a/build/buildsteps/003-buildimage.sh b/build/buildsteps/003-buildimage.sh new file mode 100755 index 00000000..4dd3deb7 --- /dev/null +++ b/build/buildsteps/003-buildimage.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +cd "$BUILDROOTBASE" + + +make defconfig +# Tools Build +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 tools/install -j3 +# toolchain build +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 toolchain/install +#kernel compile +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 target/compile -j3 +# package compile +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 package/compile -j3 +#package installation +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 package/install -j3 +#package index +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 package/index +#image generation +make IGNORE_ERRORS=m V=99 BUILD_LOG=1 target/install -j3 + +# Cleanup for now until fix cleanup module +rm -Rf build_dir/* +rm -Rf staging_dir/* + +SHORT_COMMIT=$(echo "$GIT_COMMIT" | awk '{ string=substr($0, 1, 8); print string; }' ) +SHORT_BRANCH=$(echo "$GIT_BRANCH" | awk 'match($0,"/"){print substr($0,RSTART+1)}') + +if ( -z "$BUILD_SET_VERSION" ); then + MYBUILDNAME="$BUILD_SET_VERSION" +else + MYBUILDNAME="${SHORT_BRANCH}-${BUILD_NUMBER}-${SHORT_COMMIT}" +fi +rename "s/openwrt/AREDN-$MYBUILDNAME/g" bin/ar71xx/* + diff --git a/build/buildsteps/kconfig/001-architecture b/build/buildsteps/kconfig/001-architecture new file mode 100755 index 00000000..37e8369e --- /dev/null +++ b/build/buildsteps/kconfig/001-architecture @@ -0,0 +1,41 @@ +#!/bin/sh +<<'LICENSE' + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Conrad Lara + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +LICENSE + +# For now lets just return static entries +cat << EOF +CONFIG_TARGET_ar71xx=y +CONFIG_TARGET_ar71xx_Default=y +CONFIG_ARCH=mips +EOF diff --git a/build/buildsteps/kconfig/002-ath9kregd b/build/buildsteps/kconfig/002-ath9kregd new file mode 100755 index 00000000..ec344fe0 --- /dev/null +++ b/build/buildsteps/kconfig/002-ath9kregd @@ -0,0 +1,39 @@ +#!/bin/sh +<<'LICENSE' + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Conrad Lara + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +LICENSE + +# For now lets just return static entries +cat << EOF +CONFIG_ATH_USER_REGD=y +EOF diff --git a/build/buildsteps/kconfig/003-packages b/build/buildsteps/kconfig/003-packages new file mode 100755 index 00000000..b44eab50 --- /dev/null +++ b/build/buildsteps/kconfig/003-packages @@ -0,0 +1,82 @@ +#!/bin/sh +<<'LICENSE' + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Conrad Lara + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +LICENSE + +# For now lets just return static entries + +# Kernel Config entries for packages that should be a part of the build +cat <<'EOF' +CONFIG_ALL=y +CONFIG_PACKAGE_bridge=y +CONFIG_PACKAGE_busybox=y +CONFIG_PACKAGE_dnsmasq=y +CONFIG_PACKAGE_dropbear=y +CONFIG_PACKAGE_iptables=y +CONFIG_PACKAGE_kmod-ipt-nathelper=y +CONFIG_PACKAGE_kmod-usb-core=y +CONFIG_PACKAGE_kmod-usb-uhci=y +CONFIG_PACKAGE_kmod-usb2=y +CONFIG_PACKAGE_libgcc=y +CONFIG_PACKAGE_mtd=y +CONFIG_PACKAGE_ppp=y +CONFIG_PACKAGE_ppp-mod-pppoe=y +CONFIG_PACKAGE_uhttpd=y +CONFIG_PACKAGE_olsrd=y +CONFIG_PACKAGE_perl=y +CONFIG_PACKAGE_olsrd-mod-arprefresh=y +CONFIG_PACKAGE_olsrd-mod-dyn-gw=y +CONFIG_PACKAGE_olsrd-mod-httpinfo=y +CONFIG_PACKAGE_olsrd-mod-nameservice=y +CONFIG_PACKAGE_olsrd-mod-txtinfo=y +CONFIG_PACKAGE_olsrd-mod-dot-draw=y +CONFIG_PACKAGE_olsrd-mod-watchdog=y +CONFIG_PACKAGE_olsrd-mod-secure=y +CONFIG_PACKAGE_perlbase-essential=y +CONFIG_PACKAGE_perlbase-xsloader=y +CONFIG_PACKAGE_perlbase-file=y +CONFIG_PACKAGE_perlbase-perlio=y +CONFIG_PACKAGE_libpcap=y +CONFIG_PACKAGE_tcpdump-mini=y +CONFIG_PACKAGE_ntpclient=y +CONFIG_PACKAGE_xinetd=y +CONFIG_PACKAGE_kmod-ipv6=y +CONFIG_PACKAGE_ip6tables=y +CONFIG_PACKAGE_kmod-ip6tables=y +CONFIG_PACKAGE_libip6tc=y +CONFIG_PACKAGE_ip=y +CONFIG_PACKAGE_iptables-mod-ipopt=y +CONFIG_PACKAGE_iwinfo=y +CONFIG_PACKAGE_libiwinfo=y +CONFIG_PACKAGE_socat=y +EOF diff --git a/build/makeimage.sh b/build/makeimage.sh new file mode 100755 index 00000000..71084dc3 --- /dev/null +++ b/build/makeimage.sh @@ -0,0 +1,67 @@ +#!/bin/sh +<<'LICENSE' + Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks + Copyright (C) 2015 Conrad Lara + See Contributors file for additional contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 3 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Additional Terms: + + Additional use restrictions exist on the AREDN(TM) trademark and logo. + See AREDNLicense.txt for more info. + + Attributions to the AREDN Project must be retained in the source code. + If importing this code into a new or existing project attribution + to the AREDN project must be added to the source code. + + You must not misrepresent the origin of the material conained within. + + Modified versions must be modified to attribute to the original source + and be marked in reasonable ways as differentiate it from the original + version. + +LICENSE + +SCRIPTBASE=$(dirname "$(readlink -f "$0")") +export SCRIPTBASE + +if [ "$1" != "" ] +then + BUILDROOTBASE=$1 +else + BUILDROOTBASE="$PWD" +fi + +export BUILDROOTBASE + +if [ ! -d "$BUILDROOTBASE" ] +then + + echo "ERROR: $BUILDROOTBASE doesn't exist" + exit 1; +fi + +# Run pre-tests +"$SCRIPTBASE"/tests-prebuild.sh "${BUILDROOTBASE}/files" + +for file in $SCRIPTBASE/buildsteps/* +do + if ( [ -x "$file" ] && [ -f "$file" ] ); then + echo "BUILDSTEP: $file" + $file + fi +done + + +exit 0