From d1f408f3725aa02bc1d76c4c6aadb4697bd073c0 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Sat, 02 Jan 2016 17:10:32 -0500 Subject: Use different coreboot revisions and patches per board The release archives will be bigger, but this is a necessary change that makes libreboot development easier. At present, there are boards maintained in libreboot by different people. By doing it this way, that becomes much easier. This is in contrast to the present situation, where a change to one board potentially affects all other boards, especially when updating to a new version of coreboot. Coreboot-libre scripts, download scripts, build scripts - everything. The entire build system has been modified to reflect this change of development. For reasons of consistency, cbfstool and nvramtool are no longer included in the util archives. --- (limited to 'resources/scripts/helpers/build/roms/withdepthcharge') diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge index 1c37102..32e5623 100755 --- a/resources/scripts/helpers/build/roms/withdepthcharge +++ b/resources/scripts/helpers/build/roms/withdepthcharge @@ -2,7 +2,7 @@ # helper script: build ROM images with depthcharge and put them in ./bin/ # -# Copyright (C) 2014, 2015 Francis Rowe +# Copyright (C) 2014, 2015, 2016 Francis Rowe # Copyright (C) 2015 Paul Kocialkowski # # This program is free software: you can redistribute it and/or modify @@ -32,13 +32,23 @@ then mkdir "bin/" fi +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat "version")" +else + # git repo is being used + version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git +fi + # Build libpayload # ------------------------------------------------------------------------------ buildlibpayload() { - family="$1" + family="${1}" + board="${2}" - cd "coreboot/payloads/libpayload" + ( + cd "coreboot/depthcharge/${board}/payloads/libpayload/" make distclean rm -Rf "install/" @@ -46,95 +56,92 @@ buildlibpayload() { make KBUILD_DEFCONFIG="configs/config.$family" defconfig make -j"$(nproc)" make DESTDIR="install" install - - cd "../../../" + ) } # Build depthcharge # ------------------------------------------------------------------------------ builddepthcharge() { - board="$1" + board="${1}" + ( cd "depthcharge/" make distclean - rm -f "../coreboot/depthcharge.elf" + rm -f "../coreboot/depthcharge/${board:?}/depthcharge.elf" - make BOARD="$board" defconfig - make BOARD="$board" LIBPAYLOAD_DIR="$(pwd)/../coreboot/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/3rdparty/vboot" -j"$(nproc)" depthcharge_unified + make BOARD="${board}" defconfig + make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/depthcharge/${board}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/depthcharge/${board}/3rdparty/vboot" -j"$(nproc)" depthcharge_unified - cp "build/depthcharge.elf" "../coreboot/" - - cd "../" + cp "build/depthcharge.elf" "../coreboot/depthcharge/${board}/" + ) } # Build coreboot # ------------------------------------------------------------------------------ buildcoreboot() { - board="$1" + board="${1}" - cd "coreboot/" + ( + cd "coreboot/depthcharge/${board}/" make distclean rm -f ".coreboot-version" rm -f *.img - if [ -f "../version" ]; then - # _src release archive is being used - version="$(cat ../version)" - else - # git repo is being used - version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git - fi printf 'libreboot-%s' "${version}" > "ro-frid" printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot - make KBUILD_DEFCONFIG="$(pwd)/../resources/libreboot/config/depthcharge/${board}/config" defconfig + make KBUILD_DEFCONFIG="$(pwd)/../../../resources/libreboot/config/depthcharge/${board}/config" defconfig make -j"$(nproc)" cbfs_size=$( grep CONFIG_CBFS_SIZE ".config" | sed "s/.*[[:space:]]*=[[:space:]]*//g" ) - cbfs_size=$( printf "%d\n" "$cbfs_size" ) + cbfs_size=$( printf "%d\n" "${cbfs_size}" ) cbfs_size=$(( $cbfs_size / 1024 )) - dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="$cbfs_size" + dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="${cbfs_size}" objcopy -I binary -O binary --pad-to=0x100 --gap-fill=0x00 "ro-frid" "ro-frid.img" # prepare directory for new images rm -Rf "${board:?}/" - mkdir "$board/" + mkdir "${board}/" # move the images into the newly created directory - mv "coreboot.img" "$board/" - mv "ro-frid.img" "$board/" + mv "coreboot.img" "${board}/" + mv "ro-frid.img" "${board}/" # copy the scripts too - cp "../resources/libreboot/install/depthcharge/cros-flash-replace" "$board/" - cp "../resources/libreboot/install/depthcharge/${board}/layout.txt" "$board/" + cp "../../../resources/libreboot/install/depthcharge/cros-flash-replace" "${board}/" + cp "../../../resources/libreboot/install/depthcharge/${board}/layout.txt" "${board}/" # delete the old images from ../bin - rm -Rf "../bin/depthcharge/${board}/" + rm -Rf "../../../bin/depthcharge/${board}/" # now put the new images in ./bin/depthcharge/ - [ ! -d "../bin/depthcharge/" ] && mkdir -p "../bin/depthcharge/" - mv "$board/" "../bin/depthcharge/" + [ ! -d "../../../bin/depthcharge/" ] && mkdir -p "../../../bin/depthcharge/" + mv "${board}/" "../../../bin/depthcharge/" - cd "../" + # clean this up + rm -f "depthcharge.elf" + rm -f *.img + ) } # Build ROM images for supported boards buildrom() { - board="$1" + board="${1}" + if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then family=$( echo ${board} |sed "s/_.*//g" ) - buildlibpayload "$family" - builddepthcharge "$board" - buildcoreboot "$board" + buildlibpayload "${family}" "${board}" + builddepthcharge "${board}" + buildcoreboot "${board}" fi } if [ $# -gt 0 ]; then for board in "${@}"; do - buildrom "$board" + buildrom "${board}" done else for board in resources/libreboot/config/depthcharge/*; do -- cgit v0.9.1