reform2_mkuboot/src/make_uboot.sh
2021-04-20 02:40:59 +02:00

73 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -e
function usage {
cat <<EOF
Compile uboot for MNT Reform
---
This script compile uboot for the MNT Reform2 laptop.
USAGE:
make_uboot.sh <target>
where <target> can be:
sdcard: build uboot for sdcard (default)
emmc: build uboot for emmc
The <target> arguments can be replaced by UBOOT_BUILD environment variable
EOF
}
function error {
>&2 printf "\e[31mE\e[0m %s\n" "$1"
}
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
GIT_URL="https://source.mnt.re/reform/reform-boundary-uboot"
if [ -n "$1" ]
then
UBOOT_BUILD="$1"
fi
if [ -z "$UBOOT_BUILD" ]
then
UBOOT_BUILD="sdcard"
fi
if [ ! -d u-boot ]
then
printf "Cloning uboot form MNTMN repo...\n"
if ! git clone --depth 1 "$GIT_URL" u-boot
then
error "Can't clone uboot from MNT, check version"
exit 11
fi
fi
cp u-boot/mntreform-config u-boot/.config
cd u-boot
case $UBOOT_BUILD in
" emmc")
make -j$(nproc) flash.bin KCPPFLAGS='-DMNTREFORM_BOOT_EMMC'
;;
"sdcard")
make -j$(nproc) flash.bin
;;
*)
error "${UBOOT_BUILD} is not a valid option"
esac
cd ..
exit 0