2019-09-11 17:43:59 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eE
|
|
|
|
|
|
|
|
function msg {
|
|
|
|
echo -e "\x1B[1m$*\x1B[0m" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
trap 'msg "\x1B[31mFailed to install dependencies!"' ERR
|
|
|
|
|
2021-02-22 00:17:28 -05:00
|
|
|
source /etc/os-release
|
|
|
|
|
|
|
|
|
2021-02-22 15:10:43 -07:00
|
|
|
msg "Installing system build dependencies"
|
2021-02-22 00:17:28 -05:00
|
|
|
if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
|
2022-08-29 12:55:07 -06:00
|
|
|
sudo apt-get --quiet update
|
|
|
|
sudo apt-get --quiet install \
|
|
|
|
--no-install-recommends \
|
|
|
|
--assume-yes \
|
2019-09-11 17:43:59 -06:00
|
|
|
bison \
|
2020-11-11 15:10:04 -07:00
|
|
|
build-essential \
|
2019-09-11 17:43:59 -06:00
|
|
|
ccache \
|
2020-11-11 15:10:04 -07:00
|
|
|
cmake \
|
2020-06-18 14:22:24 -06:00
|
|
|
curl \
|
2021-03-03 12:38:54 -07:00
|
|
|
devmem2 \
|
2020-06-18 14:22:24 -06:00
|
|
|
dosfstools \
|
2020-08-04 21:49:14 -06:00
|
|
|
flashrom \
|
2019-09-11 17:43:59 -06:00
|
|
|
flex \
|
|
|
|
git-lfs \
|
|
|
|
gnat \
|
2020-08-04 21:49:14 -06:00
|
|
|
libncurses-dev \
|
2020-10-15 10:50:39 +02:00
|
|
|
libudev-dev \
|
2021-03-03 12:38:54 -07:00
|
|
|
msr-tools \
|
2019-09-11 17:43:59 -06:00
|
|
|
mtools \
|
2020-08-04 21:49:14 -06:00
|
|
|
parted \
|
2021-09-13 16:08:41 -06:00
|
|
|
python-is-python3 \
|
2019-10-10 21:15:03 -06:00
|
|
|
python3-distutils \
|
2019-09-11 17:43:59 -06:00
|
|
|
uuid-dev \
|
|
|
|
zlib1g-dev
|
2021-02-22 00:17:28 -05:00
|
|
|
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
|
2020-06-18 14:22:24 -06:00
|
|
|
sudo dnf group install c-development
|
|
|
|
sudo dnf install \
|
2022-08-29 12:55:07 -06:00
|
|
|
--assumeyes \
|
2021-05-13 10:10:04 -06:00
|
|
|
ccache \
|
2020-11-11 15:10:04 -07:00
|
|
|
cmake \
|
2020-06-18 14:22:24 -06:00
|
|
|
curl \
|
|
|
|
dosfstools \
|
2020-08-04 21:49:14 -06:00
|
|
|
flashrom \
|
2020-06-18 14:22:24 -06:00
|
|
|
gcc-gnat \
|
|
|
|
git-lfs \
|
|
|
|
libuuid-devel \
|
2021-03-03 12:38:54 -07:00
|
|
|
msr-tools \
|
2020-06-18 14:22:24 -06:00
|
|
|
mtools \
|
2020-08-04 21:49:14 -06:00
|
|
|
ncurses-devel \
|
|
|
|
parted \
|
2020-06-18 14:22:24 -06:00
|
|
|
patch \
|
2021-09-29 08:10:27 -06:00
|
|
|
python-unversioned-command \
|
|
|
|
python3 \
|
2020-10-15 16:08:11 +02:00
|
|
|
systemd-devel \
|
2020-06-18 14:22:24 -06:00
|
|
|
zlib-devel
|
2021-03-26 22:56:19 +01:00
|
|
|
elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
2021-05-12 17:25:17 -06:00
|
|
|
sudo pacman -S \
|
2023-04-24 13:01:07 -04:00
|
|
|
--noconfirm \
|
2021-05-12 17:25:17 -06:00
|
|
|
bison \
|
2021-05-13 10:10:04 -06:00
|
|
|
ccache \
|
2021-05-12 17:25:17 -06:00
|
|
|
cmake \
|
2021-03-26 22:56:19 +01:00
|
|
|
curl \
|
|
|
|
dosfstools \
|
|
|
|
flashrom \
|
2021-05-12 17:25:17 -06:00
|
|
|
flex \
|
|
|
|
gcc-ada \
|
2021-03-26 22:56:19 +01:00
|
|
|
git-lfs \
|
|
|
|
msr-tools \
|
|
|
|
mtools \
|
2021-05-12 17:25:17 -06:00
|
|
|
ncurses \
|
2021-03-26 22:56:19 +01:00
|
|
|
parted \
|
|
|
|
patch \
|
2021-05-12 17:25:17 -06:00
|
|
|
python \
|
|
|
|
python-distutils-extra \
|
2022-05-25 09:20:46 -06:00
|
|
|
systemd-libs
|
2019-09-11 17:43:59 -06:00
|
|
|
else
|
2021-02-22 15:10:43 -07:00
|
|
|
msg "Unknown system ID: ${ID}"
|
|
|
|
msg "Please add support for your distribution to: $0"
|
2019-09-11 17:43:59 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg "Installing GIT LFS hooks"
|
|
|
|
git lfs install
|
|
|
|
|
|
|
|
msg "Downloading GIT LFS artifacts"
|
|
|
|
git lfs pull
|
|
|
|
|
2020-08-04 21:49:14 -06:00
|
|
|
msg "Initializing submodules"
|
2023-05-23 07:26:01 -06:00
|
|
|
git submodule update --init --recursive --checkout --progress
|
2020-08-04 21:49:14 -06:00
|
|
|
|
|
|
|
msg "Installing coreboot commit hook"
|
|
|
|
curl -sSf https://review.coreboot.org/tools/hooks/commit-msg \
|
|
|
|
-o .git/modules/coreboot/hooks/commit-msg && \
|
|
|
|
chmod +x .git/modules/coreboot/hooks/commit-msg
|
|
|
|
|
2022-01-14 09:24:24 -07:00
|
|
|
RUSTUP_NEW_INSTALL=0
|
|
|
|
if which rustup &> /dev/null; then
|
|
|
|
msg "Updating rustup"
|
|
|
|
rustup self update
|
|
|
|
else
|
|
|
|
RUSTUP_NEW_INSTALL=1
|
2021-02-22 15:31:13 -07:00
|
|
|
msg "Installing Rust"
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
2022-08-26 13:09:29 -06:00
|
|
|
| sh -s -- -y --default-toolchain stable
|
2019-09-11 17:43:59 -06:00
|
|
|
|
2021-02-22 15:31:13 -07:00
|
|
|
msg "Loading Rust environment"
|
|
|
|
source "${HOME}/.cargo/env"
|
|
|
|
fi
|
2019-09-11 17:43:59 -06:00
|
|
|
|
2021-03-15 09:35:01 -06:00
|
|
|
msg "Installing pinned Rust toolchain and components"
|
|
|
|
rustup show
|
2019-09-11 17:43:59 -06:00
|
|
|
|
2022-05-25 09:20:46 -06:00
|
|
|
msg "Installing EC dependencies"
|
|
|
|
pushd ec
|
|
|
|
./scripts/deps.sh
|
|
|
|
popd
|
|
|
|
|
2022-07-12 10:33:16 -06:00
|
|
|
msg "Building coreboot toolchains"
|
|
|
|
pushd coreboot
|
2022-09-01 16:22:42 -06:00
|
|
|
make CPUS="$(nproc)" crossgcc-i386
|
|
|
|
make CPUS="$(nproc)" crossgcc-x64
|
2022-07-12 10:33:16 -06:00
|
|
|
popd
|
|
|
|
|
2022-01-14 09:24:24 -07:00
|
|
|
if [[ $RUSTUP_NEW_INSTALL = 1 ]]; then
|
|
|
|
msg "\x1B[33m>> rustup was just installed. Ensure cargo is on the PATH with:"
|
|
|
|
echo -e " source ~/.cargo/env\n"
|
|
|
|
fi
|
|
|
|
|
2019-09-11 17:43:59 -06:00
|
|
|
msg "\x1B[32mSuccessfully installed dependencies"
|
|
|
|
echo "Ready to run ./scripts/build.sh [model]" >&2
|