1
1
#! /usr/bin/env bash
2
- # Takes the architecture as a parameter
3
- # Currently supported values: arm64
2
+ # Takes a list of architectures to build images for as the parameter
4
3
5
4
# Make sure we don't have any unset variables
6
5
set -u
7
6
7
+ # Generate list of configs to build
8
+ CONFIGS=()
9
+ while (( ${# } )) ; do
10
+ case ${1} in
11
+ all) for CONFIG in * .config; do CONFIGS+=( " ../${CONFIG} " ); done ;;
12
+ arm64|arm|ppc32|ppc64le|x86_64) CONFIGS+=( " ../${1} .config" ) ;;
13
+ * ) echo " Unknown parameter '${1} ', exiting!" ; exit 1 ;;
14
+ esac
15
+ shift
16
+ done
17
+
8
18
# Download latest buildroot release
9
19
BUILDROOT_VERSION=2019.02.3
10
20
if [[ -d src ]]; then
@@ -13,40 +23,37 @@ if [[ -d src ]]; then
13
23
git fetch origin ${BUILDROOT_VERSION}
14
24
git checkout ${BUILDROOT_VERSION}
15
25
fi
16
-
17
- # Clean up artifacts from the last build
18
- make clean
19
26
else
20
27
git clone -b ${BUILDROOT_VERSION} git://git.busybox.net/buildroot src
21
28
cd src || exit 1
22
29
fi
23
30
24
- # Use the config in the parent folder
25
- CONFIG=../${1} .config
26
- if [[ ! -f ${CONFIG} ]]; then
27
- echo " ${CONFIG} does not exist! Is your parameter correct?"
28
- exit 1
29
- fi
30
- BR2_DEFCONFIG=${CONFIG} make defconfig
31
- if [[ -n ${EDITCONFIG:- } ]]; then
32
- make menuconfig
33
- make savedefconfig
34
- fi
31
+ # Build the images for the architectures requested
32
+ for CONFIG in " ${CONFIGS[@]} " ; do
33
+ # Clean up artifacts from the last build
34
+ make clean
35
35
36
- # Build images
37
- make -j" $( nproc) "
36
+ BR2_DEFCONFIG=${CONFIG} make defconfig
37
+ if [[ -n ${EDITCONFIG:- } ]]; then
38
+ make menuconfig
39
+ make savedefconfig
40
+ fi
38
41
39
- # Make sure images folder exists
40
- IMAGES_FOLDER=../../images/${1}
41
- [[ ! -d ${IMAGES_FOLDER} ]] && mkdir -p " ${IMAGES_FOLDER} "
42
+ # Build images
43
+ make -j" $( nproc) "
42
44
43
- # Copy new images
44
- # Make sure images exist before moving them
45
- IMAGES=( " output/images/rootfs.cpio" " output/images/rootfs.ext4" )
46
- for IMAGE in " ${IMAGES[@]} " ; do
47
- if [[ ! -f ${IMAGE} ]]; then
48
- echo " ${IMAGE} could not be found! Did the build error?"
49
- exit 1
50
- fi
51
- cp -v " ${IMAGE} " " ${IMAGES_FOLDER} "
45
+ # Make sure images folder exists
46
+ IMAGES_FOLDER=../../images/$( basename " ${CONFIG// .config} " )
47
+ [[ ! -d ${IMAGES_FOLDER} ]] && mkdir -p " ${IMAGES_FOLDER} "
48
+
49
+ # Copy new images
50
+ # Make sure images exist before moving them
51
+ IMAGES=( " output/images/rootfs.cpio" " output/images/rootfs.ext4" )
52
+ for IMAGE in " ${IMAGES[@]} " ; do
53
+ if [[ ! -f ${IMAGE} ]]; then
54
+ echo " ${IMAGE} could not be found! Did the build error?"
55
+ exit 1
56
+ fi
57
+ cp -v " ${IMAGE} " " ${IMAGES_FOLDER} "
58
+ done
52
59
done
0 commit comments