mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-15 08:20:59 +02:00
pragmatic system distribution guideline compliance
osboot is now part of libreboot, and will soon shut down. libreboot now conforms to osboot policy.
This commit is contained in:
@@ -62,19 +62,6 @@ elif [ $# -eq 1 ] && [ "$1" == "--list-boards" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# set this when you want to modify each coreboot tree
|
||||
# for example, you want to test custom patches
|
||||
# NODELETE= ./download coreboot
|
||||
deletegit="true"
|
||||
deleteblobs="true"
|
||||
if [ "x${NODELETE+set}" = 'xset' ]; then
|
||||
[ "x${NODELETE:-all}" = "xgit" ] && deletegit="false"
|
||||
[ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false"
|
||||
fi
|
||||
|
||||
# Error handling is extreme in this script.
|
||||
# This script handles the internet, and Git. Both are inherently unreliable.
|
||||
|
||||
[[ -f build_error ]] && rm -f build_error
|
||||
|
||||
rm -f resources/coreboot/*/seen
|
||||
@@ -152,25 +139,25 @@ downloadfor() {
|
||||
|
||||
if [ ! -d coreboot ]; then
|
||||
printf "Download coreboot from upstream:\n"
|
||||
git clone --depth=1 https://review.coreboot.org/coreboot || rm -Rf coreboot
|
||||
git clone https://review.coreboot.org/coreboot || rm -Rf coreboot
|
||||
if [ ! -d coreboot ]; then
|
||||
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
||||
git clone --depth=1 https://github.com/coreboot/coreboot.git || rm -Rf coreboot
|
||||
git clone https://github.com/coreboot/coreboot.git || rm -Rf coreboot
|
||||
fi
|
||||
if [ ! -d coreboot ]; then
|
||||
printf "ERROR: download/coreboot: Problem with git-clone. Network issue?\n"
|
||||
cd ../; return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
( cd coreboot/; git fetch --depth=1 origin "${cbrevision}" || touch ../build_error )
|
||||
if [ -f ../build_error ]; then
|
||||
printf "ERROR: download/coreboot: Problem with git-fetch. Network issue?\n"
|
||||
cd ../; return 1
|
||||
else
|
||||
( cd coreboot/; git pull || touch ../build_error )
|
||||
if [ -f ../build_error ]; then
|
||||
printf "ERROR: download/coreboot: Problem with git-pull. Network issue?\n"
|
||||
cd ../; return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cp -R coreboot "${cbtree}" || touch ../build_error
|
||||
if [ -f ../build_error ]; then
|
||||
if [ -d ../build_error ]; then
|
||||
printf "ERROR: download/coreboot: Unable to copy directory. Check file system permissions or free space.\n"
|
||||
rm -Rf "${cbtree}/"
|
||||
cd ../; return 1
|
||||
@@ -184,7 +171,7 @@ downloadfor() {
|
||||
cd ../../; return 1
|
||||
fi
|
||||
|
||||
git submodule update --init --depth=1 || touch ../../build_error
|
||||
git submodule update --init --checkout || touch ../../build_error
|
||||
if [ -f ../../build_error ]; then
|
||||
printf "ERROR: download/coreboot: Unable to update submodules for tree '%s'\n" "${cbtree}"
|
||||
cd ../../; return 1
|
||||
@@ -243,31 +230,4 @@ rm -f resources/coreboot/*/seen
|
||||
|
||||
rm -f "build_error"
|
||||
printf "\n\n"
|
||||
if [ "${deleteblobs}" = "true" ]; then
|
||||
if [ "${deletegit}" = "true" ]; then
|
||||
rm -Rf coreboot/coreboot/
|
||||
rm -Rf coreboot/.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git*
|
||||
rm -Rf coreboot/*/util/nvidia/cbootimage/.git*
|
||||
fi
|
||||
for cbdir in coreboot/*; do
|
||||
if [ ! -d "${cbdir}" ]; then continue; fi
|
||||
cbtree="${cbdir##coreboot/}"
|
||||
cbtree="${cbtree%/}"
|
||||
if [ ! -d "coreboot/${cbtree}" ]; then continue; fi
|
||||
bloblist="resources/coreboot/${cbtree}/blobs.list"
|
||||
if [ -f "${bloblist}" ]; then
|
||||
for blobfile in $(cat "${bloblist}"); do
|
||||
printf "Deleting blob: 'coreboot/%s/%s'\n" "${cbtree}" "${blobfile}"
|
||||
rm -f "coreboot/${cbtree}/${blobfile}"
|
||||
done
|
||||
fi
|
||||
rmlist="resources/coreboot/${cbtree}/rm.list"
|
||||
if [ -f "${rmlist}" ]; then
|
||||
for rmentry in $(cat "${rmlist}"); do
|
||||
printf "Deleting directory to save space: 'coreboot/%s/%s'\n" "${cbtree}" "${rmentry}"
|
||||
rm -Rf "coreboot/${cbtree}/${rmentry}"
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 0
|
||||
|
||||
@@ -18,51 +18,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
. .revisions
|
||||
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download flashrom"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download flashrom"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ $# -ne 0 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get flashrom at the last previously tested revision
|
||||
|
||||
# Remove the old version that may still exist:
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
printf "Downloading flashrom\n"
|
||||
|
||||
rm -Rf "flashrom/"
|
||||
|
||||
# Get flashrom
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# download it using git
|
||||
git clone https://review.coreboot.org/flashrom.git
|
||||
|
||||
if [ ! -d "flashrom" ]; then
|
||||
printf "flashrom not downloaded; check network connection?\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
cd "flashrom/"
|
||||
|
||||
# reset to known revision
|
||||
git reset --hard 11680db4e1251eb842bee11e53b6d1f0ae67767b
|
||||
)
|
||||
|
||||
printf "\n\n"
|
||||
./download gitmodule flashrom
|
||||
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
Print_help(){
|
||||
cat <<- EOF
|
||||
Usage: ./download gitmodule [name]
|
||||
|
||||
Options:
|
||||
name: The name of the module as specified in resources/git/revisions file
|
||||
EOF
|
||||
}
|
||||
|
||||
Fail(){
|
||||
printf "${@}\n"
|
||||
Print_help
|
||||
exit 1
|
||||
}
|
||||
|
||||
Check_vars(){
|
||||
if [ -z "${revision+x}" ]; then
|
||||
Fail 'Error: revision not set'
|
||||
fi
|
||||
if [ -z "${location+x}" ]; then
|
||||
Fail 'Error: location not set'
|
||||
fi
|
||||
if [ -z "${url+x}" ]; then
|
||||
Fail 'Error: url not set'
|
||||
fi
|
||||
}
|
||||
|
||||
Patch(){
|
||||
for patchfile in ${PWD}/${patchdir}/*.patch ; do
|
||||
( cd ${tmp_dir}
|
||||
git am ${patchfile} || return 1
|
||||
)
|
||||
done
|
||||
}
|
||||
|
||||
Run(){
|
||||
git clone ${url} ${tmp_dir} || git clone ${bkup_url} ${tmp_dir} || Fail "ERROR: couldn't download ${name}\n Check Network connection"
|
||||
( cd ${tmp_dir} && git reset --hard ${revision} )
|
||||
patchdir="resources/${name}/patches"
|
||||
|
||||
if [ -d "${patchdir}" ]; then
|
||||
Patch || Fail "ERROR: Faild to patch ${name}"
|
||||
fi
|
||||
|
||||
mv ${tmp_dir} ${location} || Fail "ERROR: couldn't copy temp to destination\n ${tmp_dir} > ${location} check permissions"
|
||||
}
|
||||
|
||||
if [ -z "${1+x}" ]; then
|
||||
Fail 'Error: name not set'
|
||||
else
|
||||
name=${1}
|
||||
fi
|
||||
|
||||
while read -r line ; do
|
||||
set ${line} >/dev/null 2>&1
|
||||
case ${line} in
|
||||
rev:*)
|
||||
revision=${2}
|
||||
;;
|
||||
loc:*)
|
||||
location=${2}
|
||||
;;
|
||||
url:*)
|
||||
url=${2}
|
||||
;;
|
||||
bkup_url:*)
|
||||
bkup_url=${2}
|
||||
;;
|
||||
esac
|
||||
done <<< $(eval "awk ' /\{.*${name}.*}{/ {flag=1;next} /\}/{flag=0} flag { print }' resources/git/revisions")
|
||||
|
||||
Check_vars
|
||||
tmp_dir=$(mktemp -dt "${name}_XXXXX")
|
||||
|
||||
# clean out old version just in case
|
||||
if [ -d "${location}" ]; then
|
||||
rm -rf ${location}
|
||||
fi
|
||||
|
||||
Run
|
||||
|
||||
# clean in case of failure
|
||||
rm -rf ${tmp_dir} >/dev/null 2>&1
|
||||
@@ -21,57 +21,5 @@
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download grub"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download GRUB"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ $# -ne 0 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Remove the old version that may still exist
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
printf "Downloading GRUB\n"
|
||||
|
||||
rm -Rf "grub/"
|
||||
|
||||
# Get latest GRUB
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# download it using git
|
||||
git clone git://git.savannah.gnu.org/grub.git || git clone http://git.savannah.gnu.org/r/grub.git
|
||||
|
||||
if [ ! -d "grub" ]; then
|
||||
printf "grub not downloaded; check network connection?\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
# modifications are required
|
||||
cd "grub/"
|
||||
# reset to known revision
|
||||
git reset --hard 50aace6bdb918150ba47e3c16146dcca271c134a
|
||||
for grubpatch in ../resources/grub/patches/*; do
|
||||
git am "${grubpatch}"
|
||||
done
|
||||
|
||||
git clone git://git.sv.gnu.org/gnulib gnulib
|
||||
cd gnulib/
|
||||
|
||||
# NOTE: when updating this, make sure it's the version specified
|
||||
# in bootstrap.conf on that version of GRUB, as specified above
|
||||
git reset --hard d271f868a8df9bbec29049d01e056481b7a1a263
|
||||
rm -Rf .git*
|
||||
)
|
||||
|
||||
printf "\n\n"
|
||||
./download gitmodule grub
|
||||
./download gitmodule gnulib
|
||||
|
||||
@@ -21,46 +21,5 @@
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download ich9utils"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download ich9utils"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ $# -ne 0 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "Downloading ich9utils\n"
|
||||
|
||||
if [ -d ich9utils ]; then
|
||||
printf "ich9utils already downloaded. skipping\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get flashrom
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# download it using git
|
||||
git clone https://notabug.org/libreboot/ich9utils.git
|
||||
|
||||
if [ ! -d "ich9utils" ]; then
|
||||
printf "ich9utils not downloaded; check network connection?\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
cd "ich9utils/"
|
||||
|
||||
# reset to known revision
|
||||
git reset --hard 53749b0c6f7c5778bdd1ec2b91cd230626752579
|
||||
)
|
||||
|
||||
printf "\n\n"
|
||||
./download gitmodule ich9utils
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2020 Leah Rowe <info@minifree.org>
|
||||
#
|
||||
# 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 working directory is the
|
||||
# root of retroboot_src or retroboot git.
|
||||
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
./download gitmodule me_cleaner
|
||||
@@ -23,46 +23,10 @@
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download memtest86plus"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download MemTest86+"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ $# -ne 0 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get the last version of MemTest86+ used, apply patches, build it.
|
||||
|
||||
# Remove the old version that may exist
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
printf "Downloading MemTest86+\n"
|
||||
|
||||
rm -Rf "memtest86plus/"
|
||||
|
||||
git clone https://review.coreboot.org/memtest86plus.git
|
||||
|
||||
(
|
||||
cd "memtest86plus/"
|
||||
git reset --hard a78401b9704cfdd49c89bfb31d2df08f60521d0b
|
||||
|
||||
for patchfile in ../resources/memtest86plus/patch/*; do
|
||||
if [ ! -f "${patchfile}" ]; then
|
||||
continue
|
||||
fi
|
||||
git am "${patchfile}"
|
||||
done
|
||||
|
||||
rm -Rf .git*
|
||||
)
|
||||
|
||||
printf "\n\n"
|
||||
./download gitmodule memtest86plus
|
||||
|
||||
Executable
+169
@@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Download Intel MRC images
|
||||
#
|
||||
# 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, version 2 of the License.
|
||||
#
|
||||
# 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 working directory is the
|
||||
# root of osboot_src or osboot git.
|
||||
|
||||
# This file is forked from util/chromeos/crosfirmware.sh in coreboot cfc26ce278
|
||||
# Changes to it in osboot are copyright 2021 Leah Rowe
|
||||
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
# On some systems, `parted` and `debugfs` are located in /sbin.
|
||||
export PATH="${PATH}:/sbin"
|
||||
|
||||
download_image()
|
||||
{
|
||||
_url=${1}
|
||||
_file=${2}
|
||||
_sha1sum=${3}
|
||||
|
||||
echo "Downloading recovery image"
|
||||
curl "$_url" > "$_file.zip"
|
||||
if [ "$(sha1sum ${_file}.zip)" = "${_sha1sum} ${_file}.zip" ]; then
|
||||
unzip -q "${_file}.zip"
|
||||
rm "${_file}.zip"
|
||||
echo "Checksum verification passed for recovery image."
|
||||
return 0
|
||||
else
|
||||
rm "${_file}.zip"
|
||||
echo "Bad checksum. Recovery image deleted."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
extract_partition()
|
||||
{
|
||||
NAME=${1}
|
||||
FILE=${2}
|
||||
ROOTFS=${3}
|
||||
_bs=1024
|
||||
|
||||
echo "Extracting ROOT-A partition"
|
||||
ROOTP=$( printf "unit\nB\nprint\nquit\n" | \
|
||||
parted ${FILE} 2>/dev/null | grep ${NAME} )
|
||||
|
||||
START=$(( $( echo ${ROOTP} | cut -f2 -d\ | tr -d "B" ) ))
|
||||
SIZE=$(( $( echo ${ROOTP} | cut -f4 -d\ | tr -d "B" ) ))
|
||||
|
||||
dd if=${FILE} of=${ROOTFS} bs=${_bs} skip=$(( ${START} / ${_bs} )) \
|
||||
count=$(( ${SIZE} / ${_bs} )) > /dev/null
|
||||
}
|
||||
|
||||
extract_shellball()
|
||||
{
|
||||
ROOTFS=${1}
|
||||
SHELLBALL=${2}
|
||||
|
||||
echo "Extracting chromeos-firmwareupdate"
|
||||
printf "cd /usr/sbin\ndump chromeos-firmwareupdate ${SHELLBALL}\nquit" | \
|
||||
debugfs ${ROOTFS} > /dev/null 2>&1
|
||||
}
|
||||
|
||||
extract_coreboot()
|
||||
{
|
||||
_shellball=${1}
|
||||
_unpacked=$( mktemp -d )
|
||||
|
||||
echo "Extracting coreboot image"
|
||||
sh ${_shellball} --unpack ${_unpacked} > /dev/null
|
||||
|
||||
_version=$( cat ${_unpacked}/VERSION | grep BIOS\ version: | \
|
||||
cut -f2 -d: | tr -d \ )
|
||||
|
||||
cp ${_unpacked}/bios.bin coreboot-${_version}.bin
|
||||
rm -r "${_unpacked}"
|
||||
}
|
||||
|
||||
check_existing()
|
||||
{
|
||||
_mrc_complete_hash="d18de1e3d52c0815b82ea406ca07897c56c65696"
|
||||
if [ -f mrc/haswell/mrc.bin ]; then
|
||||
printf 'found existing mrc.bin, checking its hash\n'
|
||||
if [ "$(sha1sum mrc/haswell/mrc.bin)" = "${_mrc_complete_hash} mrc/haswell/mrc.bin" ]; then
|
||||
printf 'checksums matched, skipping redownloading image\n'
|
||||
return 0
|
||||
else
|
||||
printf 'hashes did not match, starting over\n'
|
||||
return 1
|
||||
fi
|
||||
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Skips redownloading every time the script runs
|
||||
check_existing && exit 0
|
||||
|
||||
if [ ! -d "coreboot/default/" ]; then
|
||||
./download coreboot default
|
||||
fi
|
||||
|
||||
if [ ! -f "coreboot/default/util/cbfstool/cbfstool" ]; then
|
||||
./build module cbutils default
|
||||
fi
|
||||
|
||||
# Remove the old version that may still exist
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
printf "Downloading Intel MRC blobs\n"
|
||||
|
||||
|
||||
#rm -Rf "mrc/"
|
||||
|
||||
mkdir -p mrc/haswell/
|
||||
|
||||
(
|
||||
|
||||
cd mrc/haswell/
|
||||
|
||||
# https://web.archive.org/web/20210211071412/https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf
|
||||
# peppy image used as defined here, mrc.bin extracted from that.
|
||||
# when wanting to use an updated version later on, just change the url and
|
||||
# sha1sums and such, in this script, based on a newer version on archive.org.
|
||||
|
||||
# For haswell mrc.bin, used on ThinkPad T440p and W541
|
||||
_board="peppy"
|
||||
_file="chromeos_12239.92.0_peppy_recovery_stable-channel_mp-v3.bin"
|
||||
_url="https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_12239.92.0_peppy_recovery_stable-channel_mp-v3.bin.zip"
|
||||
_url2="https://web.archive.org/web/20200516070928/https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_12239.92.0_peppy_recovery_stable-channel_mp-v3.bin.zip"
|
||||
_sha1sum="cd5917cbe7f821ad769bf0fd87046898f9e175c8"
|
||||
|
||||
download_image ${_url} ${_file} ${_sha1sum}
|
||||
if [ ! -f ${_file} ]; then
|
||||
download_image ${_url2} ${_file} ${_sha1sum}
|
||||
fi
|
||||
if [ ! -f $_file ]; then
|
||||
echo "${_file} was not downloaded, or verification failed. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract_partition ROOT-A ${_file} root-a.ext2
|
||||
extract_shellball root-a.ext2 chromeos-firmwareupdate-${_board}
|
||||
|
||||
extract_coreboot chromeos-firmwareupdate-${_board}
|
||||
|
||||
../../coreboot/default/util/cbfstool/cbfstool coreboot-*.bin extract -f mrc.bin -n mrc.bin -r RO_SECTION
|
||||
rm -f "chromeos-firmwareupdate-${_board}" coreboot-*.bin "${_file}" "root-a.ext2"
|
||||
|
||||
printf "\n\nHaswell mrc.bin file (for T440p and W541) downloaded to mrc/haswell/mrc.bin\n\n"
|
||||
|
||||
)
|
||||
|
||||
exit 0
|
||||
@@ -19,23 +19,6 @@
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download seabios"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download SeaBIOS"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ $# -ne 0 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get SeaBIOS, revert to commit last used and apply patches.
|
||||
|
||||
# Remove the old version that may still exist
|
||||
@@ -43,43 +26,4 @@ fi
|
||||
|
||||
printf "Downloading SeaBIOS\n"
|
||||
|
||||
rm -f build_error
|
||||
|
||||
rm -rf "seabios/"
|
||||
|
||||
# Get latest SeaBIOS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# download it using git
|
||||
git clone https://review.coreboot.org/seabios || git clone https://github.com/coreboot/seabios
|
||||
|
||||
if [ ! -d "seabios" ]; then
|
||||
printf "seabios not downloaded; check network connection?\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
# modifications are required
|
||||
cd "seabios/"
|
||||
|
||||
# Reset to the last commit that was tested (we use stable releases for seabios)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
git reset --hard 64f37cc530f144e53c190c9e8209a51b58fd5c43
|
||||
|
||||
for patchfile in ../resources/seabios/patches/*.patch; do
|
||||
if [ ! -f "${patchfile}" ]; then continue; fi
|
||||
git am "${patchfile}" || touch ../build_error
|
||||
if [ -f ../build_error ]; then
|
||||
git am --abort
|
||||
break
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
if [ -f build_error ]; then
|
||||
rm -f build_error
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
./download gitmodule seabios
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
# helper script: download u-boot
|
||||
#
|
||||
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
|
||||
# Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
# Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||
#
|
||||
@@ -23,18 +22,6 @@
|
||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||
set -u -e
|
||||
|
||||
# set this when you want to modify each u-boot tree
|
||||
# for example, you want to test custom patches
|
||||
# NODELETE= ./download u-boot
|
||||
deletegit="true"
|
||||
deleteblobs="true"
|
||||
if [ "x${NODELETE+set}" = 'xset' ]; then
|
||||
[ "x${NODELETE:-all}" = "xgit" ] && deletegit="false"
|
||||
[ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false"
|
||||
fi
|
||||
|
||||
# Error handling is extreme in this script.
|
||||
# This script handles the internet, and Git. Both are inherently unreliable.
|
||||
[[ -f build_error ]] && rm -f build_error
|
||||
|
||||
list_supported_boards() {
|
||||
@@ -125,12 +112,12 @@ downloadfor() {
|
||||
|
||||
if [ ! -d "${uboot_dir}" ]; then
|
||||
printf "Download u-boot from upstream:\n"
|
||||
git clone --depth=1 https://source.denx.de/u-boot/u-boot.git \
|
||||
git clone https://source.denx.de/u-boot/u-boot.git \
|
||||
"${uboot_dir}" || \
|
||||
rm -Rf "${uboot_dir}"
|
||||
if [ ! -d "${uboot_dir}" ]; then
|
||||
printf "WARNING: Upstream failed. Trying backup github repository:\n"
|
||||
git clone --depth=1 https://github.com/u-boot/u-boot.git \
|
||||
git clone https://github.com/u-boot/u-boot.git \
|
||||
"${uboot_dir}" || \
|
||||
rm -Rf coreboot
|
||||
fi
|
||||
@@ -142,7 +129,7 @@ downloadfor() {
|
||||
fi
|
||||
fi
|
||||
|
||||
git -C "${uboot_dir}" fetch --depth=1 origin "${ubrevision}" || touch build_error
|
||||
git -C "${uboot_dir}" fetch origin "${ubrevision}" || touch build_error
|
||||
if [ -f build_error ]; then
|
||||
printf \
|
||||
"ERROR: %s: Problem with git-fetch. Network issue?\n" \
|
||||
@@ -167,7 +154,7 @@ downloadfor() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
git -C "${ubtree}" submodule update --init --depth=1 || touch build_error
|
||||
git -C "${ubtree}" submodule update --init || touch build_error
|
||||
if [ -f build_error ]; then
|
||||
printf "ERROR: %s: Unable to update submodules for tree '%s'\n" \
|
||||
"${ubtree}"
|
||||
@@ -215,79 +202,14 @@ strip_comments()
|
||||
sed '/^$/d'
|
||||
}
|
||||
|
||||
generate_deblob_script()
|
||||
{
|
||||
blob_list_file="$1"
|
||||
output="$2"
|
||||
|
||||
# Add sheebang and copyright headers from this file
|
||||
awk '{
|
||||
if ($0 !~ /^#/ && NF > 0) {
|
||||
stop=1;
|
||||
}
|
||||
if (stop !=1) {
|
||||
printf("%s\n", $0);
|
||||
}
|
||||
}' $0 >> ${output}
|
||||
|
||||
# Add rm -rf before directories and rm -f before files
|
||||
awk \
|
||||
'{
|
||||
}{
|
||||
if (NF == 0) {
|
||||
printf("\n");
|
||||
} else {
|
||||
if ($0 !~ /#/ && $NF ~ /\/$/) {
|
||||
printf("rm -rf %s\n", $0);
|
||||
} else if ($0 !~ /#/) {
|
||||
printf("rm -f %s\n", $0);
|
||||
} else {
|
||||
# We have comments, try to see if they are
|
||||
# still valid paths before the comments
|
||||
comments_found=0
|
||||
last_field=0
|
||||
for(i=1; i<=NF; i++) {
|
||||
if($i ~ /#/) {
|
||||
comments_found=1;
|
||||
} else if(comments_found != 1) {
|
||||
last_field=i;
|
||||
}
|
||||
}
|
||||
if (last_field == 0) {
|
||||
printf("%s\n", $0);
|
||||
} else if ($last_field ~ /\/$/) {
|
||||
printf("rm -rf %s\n", $0);
|
||||
} else {
|
||||
printf("rm -f %s\n", $0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}' "${blob_list_file}" >> "${output}"
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
progname="./download u-boot"
|
||||
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download and deblob u-boot for all boards"
|
||||
printf "\t%s [board] # %s\n" \
|
||||
"${progname}" \
|
||||
"Download and deblob u-boot for the given board"
|
||||
printf "\t%s --blobs-list # %s\n" \
|
||||
"${progname}" \
|
||||
"Print the path of the generic blobs.list file"
|
||||
printf "\t%s --blobs-list [board] # %s\n" \
|
||||
"${progname}" \
|
||||
"Print the path of the blobs.list file for the given board"
|
||||
printf "\t%s --gen-deblob-script # %s\n" \
|
||||
"${progname}" \
|
||||
"Print the path of a generated generic deblob script"
|
||||
printf "\t%s --gen-deblob-script [board] # %s\n" \
|
||||
"${progname}" \
|
||||
"Print the path of a generated deblob script for the given board"
|
||||
"Download u-boot for the given board"
|
||||
printf "\t%s --list-boards # %s\n" \
|
||||
"${progname}" \
|
||||
"List supported boards"
|
||||
@@ -307,45 +229,6 @@ download_uboot_board()
|
||||
|
||||
rm -f "build_error"
|
||||
printf "\n\n"
|
||||
|
||||
if [ "${deleteblobs}" = "true" ]; then
|
||||
if [ "${deletegit}" = "true" ]; then
|
||||
rm -rf "${ubtree}"/.git* "${ubtree}"/*/.git*
|
||||
fi
|
||||
blobslist="$(print_blobs_list_path "${board}")"
|
||||
for blob_path in $(strip_comments "${blobslist}"); do
|
||||
if echo "${blob_path}" | \
|
||||
grep '/$' 2>&1 >/dev/null ; then
|
||||
printf "Deleting blob directory: '%s/%s'\n" \
|
||||
"${ubtree}" "${blob_path}"
|
||||
rm -rf "${ubtree}/${blob_path}"
|
||||
else
|
||||
printf "Deleting blob file: '%s/%s'\n" \
|
||||
"${ubtree}" "${blob_path}"
|
||||
rm -f "${ubtree}/${blob_path}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
print_blobs_list_path()
|
||||
{
|
||||
board="$1"
|
||||
|
||||
if [ -f "resources/u-boot/${board}/blobs.list" ]; then
|
||||
printf "resources/u-boot/${board}/blobs.list\n"
|
||||
else
|
||||
printf "resources/u-boot/default/blobs.list\n"
|
||||
fi
|
||||
}
|
||||
|
||||
print_deblob_script_path()
|
||||
{
|
||||
board="$1"
|
||||
path="$(mktemp)"
|
||||
|
||||
generate_deblob_script "$(print_blobs_list_path ${board})" "${path}"
|
||||
printf "%s\n" ${path}
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
@@ -364,36 +247,6 @@ elif [ $# -eq 1 -a "$1" == "--help" ] ; then
|
||||
elif [ $# -eq 1 -a "$1" == "--list-boards" ] ; then
|
||||
list_supported_boards
|
||||
exit 0
|
||||
elif [ $# -eq 1 -a "$1" == "--blobs-list" ] ; then
|
||||
print_blobs_list_path "default"
|
||||
exit 0
|
||||
elif [ $# -eq 2 -a "$1" == "--blobs-list" ] ; then
|
||||
found=0
|
||||
for board in $(list_supported_boards) ; do
|
||||
if [ "${board}" = "$2" ] ; then
|
||||
print_blobs_list_path "$2"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Error: Board '${2}' is not supported\n"
|
||||
|
||||
exit 1
|
||||
elif [ $# -eq 1 -a "$1" == "--gen-deblob-script" ] ; then
|
||||
print_deblob_script_path "default"
|
||||
exit 0
|
||||
elif [ $# -eq 2 -a "$1" == "--gen-deblob-script" ] ; then
|
||||
found=0
|
||||
for board in $(list_supported_boards) ; do
|
||||
if [ "$board" = "$2" ] ; then
|
||||
print_deblob_script_path "$2"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Error: Board '${2}' is not supported\n"
|
||||
|
||||
exit 1
|
||||
elif [ $# -eq 1 ] ; then
|
||||
for board in $(list_supported_boards) ; do
|
||||
if [ "$board" = "$1" ] ; then
|
||||
|
||||
Reference in New Issue
Block a user