diff options
Diffstat (limited to 'resources/scripts')
| -rwxr-xr-x | resources/scripts/build/boot/roms_helper | 81 | ||||
| -rwxr-xr-x | resources/scripts/build/clean/u-boot | 49 | ||||
| -rwxr-xr-x | resources/scripts/build/dependencies/debian | 5 | ||||
| -rwxr-xr-x | resources/scripts/build/payload/u-boot | 8 | ||||
| -rwxr-xr-x | resources/scripts/build/release/src | 3 | ||||
| -rwxr-xr-x | resources/scripts/download/u-boot | 14 | 
6 files changed, 112 insertions, 48 deletions
| diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index bd1f3860..66a7be8f 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -146,12 +146,6 @@ if [ "${payload_uboot}" = "y" ] && \  	uboot_config="default"  fi -if [ "${payload_memtest}" = "y" ]; then -	if [ ! -f "memtest86plus/memtest" ]; then -		./build module memtest86plus -	fi -fi -  # Override all payload directives with cmdline args  if [ ! -z ${payloads} ]; then	  	echo "setting payloads $payloads" @@ -159,6 +153,7 @@ if [ ! -z ${payloads} ]; then  	payload_grub_withseabios="n" # seabios chainloaded from grub  	payload_seabios="n"  	payload_seabios_withgrub="n" # i386-coreboot grub accessible from SeaBIOS boot menu +	payload_uboot="n"  	seabios_opromloadonly="0"  	payload_memtest="n" @@ -180,29 +175,42 @@ if [ ! -d "${cbdir}" ]; then  	./download coreboot ${cbtree}  fi +cat version > "${cbdir}/.coreboot-version" +  if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then  	if [ ! -d "${cbdir}/util/crossgcc/xgcc/i386-elf/" ]; then -		( -			cat version > "${cbdir}/.coreboot-version" -			cd "${cbdir}" -			make crossgcc-i386 CPUS=$(nproc) # even for 64-bit machines, coreboot builds -				# 32-bit ROM images, so we only need to worry about i386-elf -		) +		# Even for 64-bit machines, coreboot builds 32-bit ROM +		# images, so we only need to worry about i386-elf +		make -C "${cbdir}" crossgcc-i386 CPUS=$(nproc)  	fi +	case "$(uname -m)" in +		x86*|i*86|amd64) : ;; +		*) export CROSS_COMPILE=i386-elf- ;; +	esac  elif [ "${arch}" = "ARMv7" ]; then -	( -		cat version > "${cbdir}/.coreboot-version" -		cd "${cbdir}" -		make crossgcc-arm CPUS=$(nproc) # This is for armv7, doesn't apply to aarch64 -	) +	if [ ! -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ]; then +		make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) +	fi +	case "$(uname -m)" in +		arm|arm32|armv6*|armv7*) : ;; +		*) export CROSS_COMPILE=arm-eabi- ;; +	esac  elif [ "${arch}" = "AArch64" ]; then -	( -		cat version > "${cbdir}/.coreboot-version" -		cd "${cbdir}" -		make crossgcc-aarch64 CPUS=$(nproc) # This is for aarch64, doesn't apply to armv7 -	) +	if [ ! -d "${cbdir}/util/crossgcc/xgcc/aarch64-elf/" ]; then +		make -C "${cbdir}" crossgcc-aarch64 CPUS=$(nproc) +	fi +	# aarch64 also needs armv7 toolchain for arm-trusted-firmware +	if [ ! -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ]; then +		make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) +	fi +	case "$(uname -m)" in +		arm64|aarch64) : ;; +		*) export CROSS_COMPILE=aarch64-elf- ;; +	esac  fi +export PATH="$(pwd)/${cbdir}/util/crossgcc/xgcc/bin:$PATH" +  if [ ! -f "${cbfstool}" ]; then  	./build module cbutils ${cbtree}  fi @@ -218,6 +226,12 @@ if [ ! -f "${seavgabiosrom}" ] \  	fi  fi +if [ "${payload_memtest}" = "y" ]; then +	if [ ! -f "memtest86plus/memtest" ]; then +		./build module memtest86plus +	fi +fi +  [ -d "${romdir}/" ] || mkdir -p "${romdir}/"  rm -f "${romdir}"/* @@ -254,14 +268,17 @@ if [ "${payload_grub}" = "y" ] || [ "${payload_seabios_withgrub}" = "y" ]; then  fi  if [ "${payload_uboot}" = "y" ]; then -	if [ "${uboot_config}" = "default" ] && \ -		[ -f "payload/u-boot/${board}/u-boot.elf" ]; then -			ubootelf="payload/u-boot/${board}/u-boot.elf" +	if [ "${uboot_config}" = "default" ]; then +		ubdir="payload/u-boot/${board}"  	else -		ubootelf="payload/u-boot/${board}/${uboot_config}/u-boot.elf" +		ubdir="payload/u-boot/${board}/${uboot_config}"  	fi -	if [ ! -f "${ubootelf}" ]; then +	if [ -f "${ubdir}/u-boot.elf" ]; then +		ubootelf="${ubdir}/u-boot.elf" +	elif [ -f "${ubdir}/u-boot" ]; then +		ubootelf="${ubdir}/u-boot" +	else  		printf "Required U-Boot payloads not yet built. Building now:\n"  		rm -Rf "payload/u-boot/${board}" # just in case  		./build payload u-boot "${board}" @@ -383,9 +400,15 @@ make_uboot_payload_rom() {  	cbfstool_path="${4}"  	if [ "${target_uboot_config}" = "default" ]; then -		target_ubootelf="payload/u-boot/${board}/u-boot.elf" +		target_ubdir="payload/u-boot/${board}"  	else -		target_ubootelf="payload/u-boot/${board}/${target_uboot_config}/u-boot.elf" +		target_ubdir="payload/u-boot/${board}/${target_uboot_config}" +	fi + +	if [ -f "${target_ubdir}/u-boot.elf" ]; then +		target_ubootelf="${target_ubdir}/u-boot.elf" +	elif [ -f "${target_ubdir}/u-boot" ]; then +		target_ubootelf="${target_ubdir}/u-boot"  	fi  	tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) diff --git a/resources/scripts/build/clean/u-boot b/resources/scripts/build/clean/u-boot new file mode 100755 index 00000000..d6ae7193 --- /dev/null +++ b/resources/scripts/build/clean/u-boot @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +#  helper script: clean the u-boot builds +# +#       Copyright (C) 2014, 2015, 2016, 2020 Leah Rowe <info@minifree.org> +#       Copyright (C) 2015 Klemens Nanni <contact@autoboot.org> +#       Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com> +# +#    This program is free software: you can redistribute it and/or modify +#    it under the terms of the GNU General Public License as published by +#    the Free Software Foundation, either version 3 of the License, or +#    (at your option) any later version. +# +#    This program is distributed in the hope that it will be useful, +#    but WITHOUT ANY WARRANTY; without even the implied warranty of +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +#    GNU General Public License for more details. +# +#    You should have received a copy of the GNU General Public License +#    along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +# This script assumes that the current working directory is the root + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# clean u-boot builds (dependencies for 'build'): + +printf "Cleaning u-boot builds for all boards\n" + +[ ! -d "coreboot/" ] && exit 0 + +# clean u-boot (source archives preserved) +for board in u-boot/*; do +    if [ "${board##*/}" = "u-boot" ]; then +        continue +    fi +    if [ ! -d "${board}" ]; then +        continue +    fi +    make -C "${board}/" distclean + +    if [ -e "${board}/.git" ]; then +        git -C "${board}" clean -fdx +    fi +done + +printf "\n\n" diff --git a/resources/scripts/build/dependencies/debian b/resources/scripts/build/dependencies/debian index 4cebfe36..e69aa568 100755 --- a/resources/scripts/build/dependencies/debian +++ b/resources/scripts/build/dependencies/debian @@ -88,6 +88,11 @@ apt-get -y install libncurses5-dev doxygen iasl gdb flex bison build-essential g  apt-get -y install fonts-unifont libopts25 libselinux1-dev autogen m4 autoconf help2man libopts25-dev libfont-freetype-perl automake autotools-dev build-essential bison flex libfuse-dev liblzma-dev gawk libdevmapper-dev libtool libfreetype6-dev +# U-Boot build dependencies +# ------------------------- + +apt-get -y install bc bison build-essential device-tree-compiler efitools flex libfdt-dev liblz4-tool libgnutls28-dev libncurses-dev libpython3-dev libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl pkg-config python3 python3-distutils python3-pkg-resources python3-pycryptodome python3-pyelftools swig uuid-dev +  # BucTS build dependencies (external script)  # ------------------------------------------------------------ diff --git a/resources/scripts/build/payload/u-boot b/resources/scripts/build/payload/u-boot index 6c94a441..3ead3a6c 100755 --- a/resources/scripts/build/payload/u-boot +++ b/resources/scripts/build/payload/u-boot @@ -94,14 +94,6 @@ for board in "$@"; do  		continue  	fi -	if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then -		export CROSS_COMPILE=x86_64-linux- -	elif [ "${arch}" = "ARMv7" ]; then -		export CROSS_COMPILE=arm-linux-gnueabi- -	elif [ "${arch}" = "AArch64" ]; then -		export CROSS_COMPILE=aarch64-linux-gnu- -	fi -  	for config in "${board_dir}/config"/*; do  		if [ ! -f "${config}" ]; then  			printf "%s: Target %s has no configs to build for. Skipping build.\n" \ diff --git a/resources/scripts/build/release/src b/resources/scripts/build/release/src index 5f7358f3..8a75160d 100755 --- a/resources/scripts/build/release/src +++ b/resources/scripts/build/release/src @@ -53,7 +53,7 @@ mkdir -p "${srcdir}/"  printf "%s" "${version}" > "${srcdir}"/version -modlist="coreboot flashrom grub memtest86plus seabios ich9utils me_cleaner" +modlist="coreboot flashrom grub memtest86plus seabios ich9utils me_cleaner u-boot"  dirlist="resources" # do not add blobs directory here. it is handled below  filelist="blobutil modify download build README.md COPYING Makefile update version versiondate projectname .gitcheck" @@ -107,6 +107,7 @@ done      rm -Rf coreboot/coreboot/      rm -Rf .git* */.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git*      rm -Rf coreboot/*/util/nvidia/cbootimage/.git* +    rm -Rf u-boot/u-boot/ u-boot/*/.git*  )  ( diff --git a/resources/scripts/download/u-boot b/resources/scripts/download/u-boot index 5b6a160e..1af513a4 100755 --- a/resources/scripts/download/u-boot +++ b/resources/scripts/download/u-boot @@ -181,7 +181,7 @@ downloadfor() {  	# extra.sh on a per-board basis  	# In fact, extra.sh can be used for anything you want.  	if [ -f "resources/u-boot/${board}/extra.sh" ]; then -		"resources/u-boot/${board}/extra.sh" || touch build_error +		( cd "${ubtree}" && "../../resources/u-boot/${board}/extra.sh"; ) || touch build_error  		if [ -f build_error ]; then  			return 1  		fi @@ -207,6 +207,9 @@ usage()  	progname="./download u-boot"  	printf "Usage:\n" +	printf "\t%s                                # %s\n" \ +	       "${progname}" \ +	       "Download u-boot for all boards"  	printf "\t%s [board]                        # %s\n" \  	       "${progname}" \  	       "Download u-boot for the given board" @@ -235,11 +238,6 @@ if [ $# -eq 0 ] ; then  	for board in $(list_supported_boards); do  		download_uboot_board "${board}"  	done - -	if [ "${deletegit}" = "true" ]; then -		rm -rf u-boot/u-boot/ u-boot/.git* -	fi -  	exit 0  elif [ $# -eq 1 -a "$1" == "--help" ] ; then  	usage @@ -255,10 +253,6 @@ elif [ $# -eq 1 ] ; then  		fi  	done -	if [ "${deletegit}" = "true" ]; then -		rm -rf u-boot/u-boot/ u-boot/.git* -	fi -  	printf "Error: Board '${1}' is not supported\n"  	exit 1 | 
