aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: efd504d73e77391d8c56a384edcd55fb199a4a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
usage() {
    echo "usage: BUILDROOT_DIR=${BUILDROOT_DIR} $0 {boardname} all"
    echo
    echo "with boardname in"
    echo " - raspberrypi0w"
    echo " - raspberrypi3"
}

test -z ${BUILDROOT_DIR} && BUILDROOT_DIR="../buildroot-2022.02.1"

if [ ! -d ${BUILDROOT_DIR} ]; then
    usage
    echo
    echo "Error: the path to buildroot \"${BUILDROOT_DIR}\" does not exists"
    exit 1
fi

export BOARDNAME=$1

case "$BOARDNAME" in
  raspberrypi0w)
  ;;
  raspberrypi3)
  ;;
  *)
    usage
    echo
    echo "Error: unknown card \"$1\""
    exit 1
  ;;
esac

# Merge custom buildroot configurations
CONFIG_="BR2" KCONFIG_CONFIG="configs/${BOARDNAME}_defconfig" "$BUILDROOT_DIR/support/kconfig/merge_config.sh" -m -r configs/config "configs/$BOARDNAME"
sed "1i ### DO NOT EDIT, this file was automatically generated\n" -i "configs/${BOARDNAME}_defconfig"

## Create full buildroot configuration
BR2_EXTERNAL="$(pwd)" make O="$(pwd)/output/$BOARDNAME" -C "$BUILDROOT_DIR" "${BOARDNAME}_defconfig"

# Build
BR2_EXTERNAL="$(pwd)" make O="$(pwd)/output/${BOARDNAME}" -C ${BUILDROOT_DIR} "$2"