xref: /src/tools/boot/universe.sh (revision 6a0ab05eb5eeb701ce71630154f903668d750786)
1#!/bin/sh
2
3#
4# This script is expected to be run in stand (though you could run it anywhere
5# in the tree). It does a full clean build. For stand you can do all the archs in
6# about a minute or two on a fast machine. It's also possible that you need a full
7# make universe for this to work completely.
8#
9# Output is put into _.boot.$TARGET_ARCH.log in sys.boot.
10#
11
12die()
13{
14    echo $*
15    exit 1
16}
17
18dobuild()
19{
20    local ta=$1
21    local lf=$2
22    local opt=$3
23
24    echo -n "Building $ta ${opt} ... "
25    objdir=$(make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make -V .OBJDIR" | tail -1)
26    case ${objdir} in
27	/*) ;;
28	make*) echo Error message from make: $objdir
29	       continue ;;
30	*) die Crazy object dir: $objdir ;;
31    esac
32    rm -rf ${objdir}
33    if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make clean cleandepend cleandir obj depend"  \
34	 > $lf 2>&1; then
35	echo "Fail (cleanup)"
36	continue
37    fi
38    if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make ${opt} -j 40 all"  \
39	 >> $lf 2>&1; then
40	echo "Fail (build)"
41	continue
42    fi
43    echo "Success"
44}
45
46top=$(make -V SRCTOP)
47cd $top/stand
48
49# Build without forth
50for i in \
51	arm64/aarch64 \
52	amd64/amd64 \
53	i386/i386 \
54	; do
55    ta=${i##*/}
56    dobuild $ta _.boot.${ta}.no_forth.log "WITHOUT_FORTH=yes"
57done
58
59# Build without GELI
60for i in \
61	arm64/aarch64 \
62	amd64/amd64 \
63	i386/i386 \
64	; do
65    ta=${i##*/}
66    dobuild $ta _.boot.${ta}.no_geli.log "WITHOUT_LOADER_GELI=yes"
67done
68
69# Default build for a almost all architectures
70for i in \
71	amd64/amd64 \
72	arm/armv7 \
73	arm64/aarch64 \
74	i386/i386 \
75	powerpc/powerpc \
76	powerpc/powerpc64 \
77	powerpc/powerpc64le \
78	riscv/riscv64 \
79	; do
80    ta=${i##*/}
81    dobuild $ta _.boot.${ta}.log ""
82done
83
84# Build w/o ZFS
85for i in \
86	arm64/aarch64 \
87	amd64/amd64 \
88	i386/i386 \
89	; do
90    ta=${i##*/}
91    dobuild $ta _.boot.${ta}.no_zfs.log "MK_LOADER_ZFS=no"
92done
93
94# Build w/o LOADER_BIOS_TEXTONLY
95for i in \
96	amd64/amd64 \
97	i386/i386 \
98	; do
99    ta=${i##*/}
100    dobuild $ta _.boot.${ta}.no_zfs.log "MK_LOADER_BIOS_TEXTONLY=no"
101done
102