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 \ make \
git \ git \
bc \ bc \
bzip2 \
bison \ bison \
flex \ flex \
python-dev \ python-dev \

View File

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

View File

@ -12,7 +12,7 @@ TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}" cd "${TMP}"
build-image tmp.img build-image tmp.img
build-u_boot u-boot "${DEFCONFIG}" "${TUPLE}" build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Copy U-Boot to 8192 bytes from start # 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 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 #!/bin/sh
# Download and build latest version of U-Boot # Download and build latest version of U-Boot
UBOOTDIR="${1}" # For example "u-boot" DEFCONFIG="${1}" # For example "rpi_3_defconfig"
DEFCONFIG="${2}" # For example "rpi_3_defconfig" TUPLE="${2}" # For example "aarch64-linux-gnu"
TUPLE="${3}" # 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 set -e
# U-Boot version to build if [ ! -s "${TARBALL}" ]
VERSION=$(git ls-remote --tags --refs "git://git.denx.de/u-boot.git" "v????.??" | \ then
cut -f 2 | \ if [ -z "${GIT_REV}" ]
grep -o "v....\..." | \ then
tail -n 1) # 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 # Download U-Boot
git clone --branch "$VERSION" \ git clone --branch "${GIT_REV}" \
--depth 1 \ --depth 1 \
--reference-if-able "/mnt/git-cache/u-boot.git" \ "${GIT_URL}" u-boot
--dissociate \ else
"git://git.denx.de/u-boot.git" "${UBOOTDIR}" # Extract U-Boot
tar -xf "${TARBALL}"
mv u-boot-????.?? u-boot
fi
# Step into U-Boot directory # Step into U-Boot directory
cd "${UBOOTDIR}" cd u-boot
# Setup ARCH # Setup ARCH
case "${TUPLE}" in case "${TUPLE}" in

View File

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

View File

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

View File

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

View File

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

View File

@ -2,19 +2,20 @@
# Rebuilds boot images # Rebuilds boot images
ARTIFACTS_DIR=${DEBIMG_ARTIFACTS_DIR:-/tmp/debimg/artifacts} 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 . docker build -t debimg .
mkdir -p /tmp/debimg/artifacts || exit mkdir -p /tmp/debimg/artifacts || exit
mkdir -p /tmp/debimg/git-cache || exit mkdir -p /tmp/debimg/cache || exit
IFS=, IFS=,
grep -vE "^#|^\s*$" boards.csv | while read BOARD_ID MODEL MAKE CHIP DEFCONFIG TUPLE TYPE DTB _ grep -vE "^#|^\s*$" boards.csv | while read BOARD_ID MODEL MAKE CHIP DEFCONFIG TUPLE TYPE DTB _
do do
docker run --rm \ docker run --rm \
-v "${ARTIFACTS_DIR}":/artifacts \ -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 \ debimg \
build-boot-"${TYPE}" /artifacts/boot-"${BOARD_ID}" "${DEFCONFIG}" "${TUPLE}" build-boot-"${TYPE}" /artifacts/boot-"${BOARD_ID}" "${DEFCONFIG}" "${TUPLE}"
done done