build-u_boot: Add support for building from a tarball

This commit is contained in:
Johan Gunnarsson 2019-05-04 19:55:51 +02:00
parent 8a966a24fe
commit 6ede5b847b
9 changed files with 41 additions and 20 deletions

View File

@ -13,6 +13,7 @@ RUN apt-get update && \
make \
git \
bc \
bzip2 \
bison \
flex \
python-dev \

View File

@ -12,7 +12,7 @@ TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
build-image tmp.img
build-u_boot u-boot "${DEFCONFIG}" "${TUPLE}"
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Write Raspberry Pi boot config
cat << EOF > config.txt

View File

@ -12,7 +12,7 @@ TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
build-image tmp.img
build-u_boot u-boot "${DEFCONFIG}" "${TUPLE}"
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Copy U-Boot to 8192 bytes from start
dd if=u-boot/u-boot-sunxi-with-spl.bin of=tmp.img bs=1K seek=8

View File

@ -1,27 +1,42 @@
#!/bin/sh
# Download and build latest version of U-Boot
UBOOTDIR="${1}" # For example "u-boot"
DEFCONFIG="${2}" # For example "rpi_3_defconfig"
TUPLE="${3}" # For example "aarch64-linux-gnu"
DEFCONFIG="${1}" # For example "rpi_3_defconfig"
TUPLE="${2}" # For example "aarch64-linux-gnu"
TARBALL="${U_BOOT_TARBALL}"
GIT_REV="${U_BOOT_GIT_REV}"
GIT_URL="${U_BOOT_GIT_URL:-git://git.denx.de/u-boot.git}"
set -e
# U-Boot version to build
VERSION=$(git ls-remote --tags --refs "git://git.denx.de/u-boot.git" "v????.??" | \
cut -f 2 | \
grep -o "v....\..." | \
tail -n 1)
if [ ! -s "${TARBALL}" ]
then
if [ -z "${GIT_REV}" ]
then
# U-Boot version to build
GIT_REV=$(git ls-remote --tags \
--refs \
"${GIT_URL}" \
"v????.??" | \
cut -f 2 | \
grep -o "v....\..." | \
tail -n 1)
fi
# Download U-Boot
git clone --branch "$VERSION" \
--depth 1 \
--reference-if-able "/mnt/git-cache/u-boot.git" \
--dissociate \
"git://git.denx.de/u-boot.git" "${UBOOTDIR}"
# Download U-Boot
git clone --branch "${GIT_REV}" \
--depth 1 \
"${GIT_URL}" u-boot
else
# Extract U-Boot
tar -xf "${TARBALL}"
mv u-boot-????.?? u-boot
fi
# Step into U-Boot directory
cd "${UBOOTDIR}"
cd u-boot
# Setup ARCH
case "${TUPLE}" in

View File

@ -12,6 +12,7 @@ RUN apt-get update && \
make \
git \
bc \
bzip2 \
bison \
flex \
python-dev \

View File

@ -22,6 +22,7 @@ RUN apt-get update && \
make \
git \
bc \
bzip2 \
bison \
flex \
python-dev \

View File

@ -12,6 +12,7 @@ RUN apt-get update && \
make \
git \
bc \
bzip2 \
bison \
flex \
python-dev \

View File

@ -22,6 +22,7 @@ RUN apt-get update && \
make \
git \
bc \
bzip2 \
bison \
flex \
python-dev \

View File

@ -2,19 +2,20 @@
# Rebuilds boot images
ARTIFACTS_DIR=${DEBIMG_ARTIFACTS_DIR:-/tmp/debimg/artifacts}
GIT_CACHE_DIR=${DEBIMG_GIT_CACHE_DIR:-/tmp/debimg/git-cache}
CACHE_DIR=${DEBIMG_CACHE_DIR:-/tmp/debimg/cache}
docker build -t debimg .
mkdir -p /tmp/debimg/artifacts || exit
mkdir -p /tmp/debimg/git-cache || exit
mkdir -p /tmp/debimg/cache || exit
IFS=,
grep -vE "^#|^\s*$" boards.csv | while read BOARD_ID MODEL MAKE CHIP DEFCONFIG TUPLE TYPE DTB _
do
docker run --rm \
-v "${ARTIFACTS_DIR}":/artifacts \
-v "${GIT_CACHE_DIR}":/mnt/git-cache \
-v "${CACHE_DIR}":/mnt/cache:ro \
-e U_BOOT_TARBALL=/mnt/cache/u-boot-latest.tar.bz2 \
debimg \
build-boot-"${TYPE}" /artifacts/boot-"${BOARD_ID}" "${DEFCONFIG}" "${TUPLE}"
done