diff --git a/board/alix/INIT b/layer/bsp-alix/INIT similarity index 100% rename from board/alix/INIT rename to layer/bsp-alix/INIT diff --git a/board/alix/LDPATH b/layer/bsp-alix/LDPATH similarity index 100% rename from board/alix/LDPATH rename to layer/bsp-alix/LDPATH diff --git a/board/alix/ROOTFS b/layer/bsp-alix/ROOTFS similarity index 100% rename from board/alix/ROOTFS rename to layer/bsp-alix/ROOTFS diff --git a/board/alix/TOOLCHAIN b/layer/bsp-alix/TOOLCHAIN similarity index 88% rename from board/alix/TOOLCHAIN rename to layer/bsp-alix/TOOLCHAIN index d9cb229..698e0a3 100644 --- a/board/alix/TOOLCHAIN +++ b/layer/bsp-alix/TOOLCHAIN @@ -1,3 +1,4 @@ +RELEASEPKG="release-alix" TARGET="i686-linux-musl" GCC_CPU="i686" MUSL_CPU="i386" diff --git a/board/alix/ifrename b/layer/bsp-alix/ifrename similarity index 100% rename from board/alix/ifrename rename to layer/bsp-alix/ifrename diff --git a/board/alix/linux.config b/layer/bsp-alix/linux.config similarity index 100% rename from board/alix/linux.config rename to layer/bsp-alix/linux.config diff --git a/board/rpi3/INIT b/layer/bsp-rpi3/INIT similarity index 100% rename from board/rpi3/INIT rename to layer/bsp-rpi3/INIT diff --git a/board/rpi3/LDPATH b/layer/bsp-rpi3/LDPATH similarity index 100% rename from board/rpi3/LDPATH rename to layer/bsp-rpi3/LDPATH diff --git a/board/rpi3/ROOTFS b/layer/bsp-rpi3/ROOTFS similarity index 100% rename from board/rpi3/ROOTFS rename to layer/bsp-rpi3/ROOTFS diff --git a/board/rpi3/TOOLCHAIN b/layer/bsp-rpi3/TOOLCHAIN similarity index 88% rename from board/rpi3/TOOLCHAIN rename to layer/bsp-rpi3/TOOLCHAIN index 79d40a5..6af48d9 100644 --- a/board/rpi3/TOOLCHAIN +++ b/layer/bsp-rpi3/TOOLCHAIN @@ -1,3 +1,4 @@ +RELEASEPKG="release-rpi3" TARGET="arm-linux-musleabihf" GCC_CPU="armv6" MUSL_CPU="arm" diff --git a/board/rpi3/ifrename b/layer/bsp-rpi3/ifrename similarity index 100% rename from board/rpi3/ifrename rename to layer/bsp-rpi3/ifrename diff --git a/board/rpi3/linux.config b/layer/bsp-rpi3/linux.config similarity index 100% rename from board/rpi3/linux.config rename to layer/bsp-rpi3/linux.config diff --git a/product/router/alix/INIT b/layer/router-alix/INIT similarity index 100% rename from product/router/alix/INIT rename to layer/router-alix/INIT diff --git a/product/router/alix/dnsmasq.conf b/layer/router-alix/dnsmasq.conf similarity index 100% rename from product/router/alix/dnsmasq.conf rename to layer/router-alix/dnsmasq.conf diff --git a/product/router/alix/interfaces/port0 b/layer/router-alix/interfaces/port0 similarity index 100% rename from product/router/alix/interfaces/port0 rename to layer/router-alix/interfaces/port0 diff --git a/product/router/alix/interfaces/port1 b/layer/router-alix/interfaces/port1 similarity index 100% rename from product/router/alix/interfaces/port1 rename to layer/router-alix/interfaces/port1 diff --git a/product/router/alix/nftables.rules b/layer/router-alix/nftables.rules similarity index 100% rename from product/router/alix/nftables.rules rename to layer/router-alix/nftables.rules diff --git a/product/router/INIT b/layer/router-base/INIT similarity index 100% rename from product/router/INIT rename to layer/router-base/INIT diff --git a/product/router/ROOTFS b/layer/router-base/ROOTFS similarity index 100% rename from product/router/ROOTFS rename to layer/router-base/ROOTFS diff --git a/product/router/dhcpcd.conf b/layer/router-base/dhcpcd.conf similarity index 100% rename from product/router/dhcpcd.conf rename to layer/router-base/dhcpcd.conf diff --git a/product/router/resolv.conf b/layer/router-base/resolv.conf similarity index 100% rename from product/router/resolv.conf rename to layer/router-base/resolv.conf diff --git a/product/router/sshd_config b/layer/router-base/sshd_config similarity index 100% rename from product/router/sshd_config rename to layer/router-base/sshd_config diff --git a/product/router/sysctl.conf b/layer/router-base/sysctl.conf similarity index 100% rename from product/router/sysctl.conf rename to layer/router-base/sysctl.conf diff --git a/product/router/unbound.conf b/layer/router-base/unbound.conf similarity index 100% rename from product/router/unbound.conf rename to layer/router-base/unbound.conf diff --git a/product/router/rpi3/INIT b/layer/router-rpi3/INIT similarity index 100% rename from product/router/rpi3/INIT rename to layer/router-rpi3/INIT diff --git a/product/router/rpi3/dnsmasq.conf b/layer/router-rpi3/dnsmasq.conf similarity index 100% rename from product/router/rpi3/dnsmasq.conf rename to layer/router-rpi3/dnsmasq.conf diff --git a/product/router/rpi3/hostapd.conf b/layer/router-rpi3/hostapd.conf similarity index 100% rename from product/router/rpi3/hostapd.conf rename to layer/router-rpi3/hostapd.conf diff --git a/product/router/rpi3/interfaces/wlan0 b/layer/router-rpi3/interfaces/wlan0 similarity index 100% rename from product/router/rpi3/interfaces/wlan0 rename to layer/router-rpi3/interfaces/wlan0 diff --git a/product/router/rpi3/nftables.rules b/layer/router-rpi3/nftables.rules similarity index 100% rename from product/router/rpi3/nftables.rules rename to layer/router-rpi3/nftables.rules diff --git a/mk.sh b/mk.sh index 0246ad3..85598eb 100755 --- a/mk.sh +++ b/mk.sh @@ -2,49 +2,33 @@ set -e -if [ ! $# -eq 2 ]; then - echo "usage: $0 " +if [ ! $# -eq 1 ]; then + echo "usage: $0 " exit 1 fi -BOARD="$1" -PRODUCT="$2" +PRODUCT="$1" ################################ basic setup ################################ BUILDROOT=$(pwd) SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l) -HOSTTUPLE=$($SCRIPTDIR/util/config.guess) -if [ ! -d "$SCRIPTDIR/product/$PRODUCT" ]; then - echo "No configuration for this product: $PRODUCT" +LAYERCONF="$SCRIPTDIR/product/${PRODUCT}.layers" + +if [ ! -f "$LAYERCONF" ]; then + echo "Cannot find layer configuration for $PRODUCT" exit 1 fi -if [ ! -d "$SCRIPTDIR/board/$BOARD" ]; then - echo "No configuration for this board: $BOARD" - exit 1 -fi - -if [ -e "$SCRIPTDIR/product/$PRODUCT/BOARDS" ]; then - if ! grep -q "$BOARD" "$SCRIPTDIR/product/$PRODUCT/BOARDS"; then - echo "Error, $PRODUCT cannot be built for $BOARD" - exit 1 - fi -fi - -TCDIR="$BUILDROOT/${BOARD}-${PRODUCT}/toolchain" -PKGBUILDDIR="$BUILDROOT/${BOARD}-${PRODUCT}/build" PKGSRCDIR="$BUILDROOT/src" -PKGDEPLOYDIR="$BUILDROOT/${BOARD}-${PRODUCT}/deploy" -PKGLOGDIR="$BUILDROOT/${BOARD}-${PRODUCT}/log" PKGDOWNLOADDIR="$BUILDROOT/download" -PACKAGELIST="$BUILDROOT/${BOARD}-${PRODUCT}/pkglist" +PKGBUILDDIR="$BUILDROOT/$PRODUCT/build" +PKGDEPLOYDIR="$BUILDROOT/$PRODUCT/deploy" +PKGLOGDIR="$BUILDROOT/$PRODUCT/log" +PACKAGELIST="$BUILDROOT/$PRODUCT/pkglist" -mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" -mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin" - -export PATH="$TCDIR/bin:$PATH" +mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" "$PKGDEPLOYDIR" pushd "$SCRIPTDIR" > /dev/null OS_NAME="Pygos" @@ -63,14 +47,19 @@ source "$SCRIPTDIR/util/autotools.sh" ############################## toolchain config ############################## include_merge "TOOLCHAIN" -mkdir -p "$TCDIR/$TARGET" +HOSTTUPLE=$($SCRIPTDIR/util/config.guess) +TCDIR="$BUILDROOT/$PRODUCT/toolchain" + +export PATH="$TCDIR/bin:$PATH" + +mkdir -p "$TCDIR/$TARGET" "$TCDIR/bin" CMAKETCFILE="$TCDIR/toolchain.cmake" ############################### build packages ############################### echo "--- resolving package dependencies ---" -include_pkg "release-${BOARD}" +include_pkg "$RELEASEPKG" dependencies | tsort | tac > "$PACKAGELIST" cat "$PACKAGELIST" diff --git a/product/router-alix.layers b/product/router-alix.layers new file mode 100644 index 0000000..5e6515b --- /dev/null +++ b/product/router-alix.layers @@ -0,0 +1,3 @@ +bsp-alix +router-base +router-alix diff --git a/product/router-rpi3.layers b/product/router-rpi3.layers new file mode 100644 index 0000000..2002ac8 --- /dev/null +++ b/product/router-rpi3.layers @@ -0,0 +1,3 @@ +bsp-rpi3 +router-base +router-rpi3 diff --git a/product/router/BOARDS b/product/router/BOARDS deleted file mode 100644 index 2019f7b..0000000 --- a/product/router/BOARDS +++ /dev/null @@ -1,2 +0,0 @@ -rpi3 -alix diff --git a/util/override.sh b/util/override.sh index 9dfb670..08be3d1 100644 --- a/util/override.sh +++ b/util/override.sh @@ -1,16 +1,12 @@ file_path_override() { - if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then - echo "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" - return - fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then - echo "$SCRIPTDIR/product/$PRODUCT/$1" - return - fi - if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then - echo "$SCRIPTDIR/board/$BOARD/$1" - return - fi + local layer + + tac "$LAYERCONF" | while read layer; do + if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then + echo "$SCRIPTDIR/layer/$layer/$1" + return + fi + done } cat_file_override() { @@ -22,15 +18,13 @@ cat_file_override() { } cat_file_merge() { - if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then - cat "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" - fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then - cat "$SCRIPTDIR/product/$PRODUCT/$1" - fi - if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then - cat "$SCRIPTDIR/board/$BOARD/$1" - fi + local layer + + while read layer; do + if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then + cat "$SCRIPTDIR/layer/$layer/$1" + fi + done < "$LAYERCONF" } include_override() { @@ -42,13 +36,11 @@ include_override() { } include_merge() { - if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then - source "$SCRIPTDIR/board/$BOARD/$1" - fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then - source "$SCRIPTDIR/product/$PRODUCT/$1" - fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then - source "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" - fi + local layer + + while read layer; do + if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then + source "$SCRIPTDIR/layer/$layer/$1" + fi + done < "$LAYERCONF" }