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