xref: /freebsd/tools/boot/universe.sh (revision 1f474190)
1#!/bin/sh
2
3# $FreeBSD$
4
5#
6# Full list of all arches, but we only build a subset. All different mips add any
7# value, and there's a few others we just don't support.
8#
9#	mips/mipsel mips/mips mips/mips64el mips/mips64 mips/mipsn32 \
10#	mips/mipselhf mips/mipshf mips/mips64elhf mips/mips64hf \
11#	powerpc/powerpc powerpc/powerpc64 powerpc/powerpcspe \
12#	riscv/riscv64 riscv/riscv64sf
13#
14# This script is expected to be run in stand (though you could run it anywhere
15# in the tree). It does a full clean build. For stand you can do all the archs in
16# about a minute or two on a fast machine. It's also possible that you need a full
17# make universe for this to work completely.
18#
19# Output is put into _.boot.$TARGET_ARCH.log in sys.boot.
20#
21
22die()
23{
24    echo $*
25    exit 1
26}
27
28dobuild()
29{
30    local ta=$1
31    local lf=$2
32    local opt=$3
33
34    echo -n "Building $ta ${opt} ... "
35    objdir=$(make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make -V .OBJDIR" | tail -1)
36    case ${objdir} in
37	/*) ;;
38	make*) echo Error message from make: $objdir
39	       continue ;;
40	*) die Crazy object dir: $objdir ;;
41    esac
42    rm -rf ${objdir}
43    if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make clean cleandepend cleandir obj depend"  \
44	 > $lf 2>&1; then
45	echo "Fail (cleanup)"
46	continue
47    fi
48    if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make ${opt} -j 20 all"  \
49	 >> $lf 2>&1; then
50	echo "Fail (build)"
51	continue
52    fi
53    echo "Success"
54}
55
56top=$(make -V SRCTOP)
57cd $top/stand
58
59# Build without forth
60for i in \
61	amd64/amd64 \
62	i386/i386 \
63	; do
64    ta=${i##*/}
65    dobuild $ta _.boot.${ta}.no_forth.log "WITHOUT_FORTH=yes"
66done
67
68# Build without GELI
69for i in \
70	amd64/amd64 \
71	i386/i386 \
72	; do
73    ta=${i##*/}
74    dobuild $ta _.boot.${ta}.no_geli.log "WITHOUT_LOADER_GEIL=yes"
75done
76
77# Default build for a goodly selection of architectures
78for i in \
79	amd64/amd64 \
80	arm/armv7 \
81	arm64/aarch64 \
82	i386/i386 \
83	mips/mips mips/mips64 \
84	powerpc/powerpc powerpc/powerpc64 \
85	; do
86    ta=${i##*/}
87    dobuild $ta _.boot.${ta}.log ""
88done
89
90# Default build for a goodly selection of architectures with Lua
91for i in \
92	amd64/amd64 \
93	arm/armv7 \
94	arm64/aarch64 \
95	i386/i386 \
96	mips/mips mips/mips64 \
97	powerpc/powerpc powerpc/powerpc64 \
98	; do
99    ta=${i##*/}
100    dobuild $ta _.boot.${ta}.lua.log "MK_LOADER_LUA=yes MK_FORTH=no"
101done
102
103# Build w/o ZFS
104for i in \
105	amd64/amd64 \
106	i386/i386 \
107	; do
108    ta=${i##*/}
109    dobuild $ta _.boot.${ta}.no_zfs.log "MK_ZFS=no"
110done
111
112# Build with firewire
113for i in \
114	amd64/amd64 \
115	i386/i386 \
116	; do
117    ta=${i##*/}
118    dobuild $ta _.boot.${ta}.firewire.log "MK_LOADER_FIREWIRE=yes"
119done
120