build-boot: Refactor build boot scripts

This commit is contained in:
Johan Gunnarsson 2019-06-02 10:59:22 +02:00
parent 7b80d8415a
commit a6384b77f5
4 changed files with 54 additions and 32 deletions

View File

@ -14,14 +14,14 @@ mkdir -p /tmp/debimg/log || exit
D=$(mktemp -d -p "${LOG_DIR}" rebuild-boots-XXXXXX)
IFS=,
grep -vE "^#|^\s*$" boards.csv | tail -n +2 | while read BOARD_ID MODEL MAKE CHIP DEFCONFIG TUPLE TYPE DTB _
grep -vE "^#|^\s*$" boards.csv | tail -n +2 | while read BOARD_ID MODEL MAKE CHIP_ID DEFCONFIG TUPLE TYPE DTB _
do
docker run --rm \
-v "${ARTIFACTS_DIR}":/artifacts \
-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}" \
build-boot "${BOARD_ID}" "${CHIP_ID}" "${DEFCONFIG}" "${TUPLE}" \
>"${D}"/"log-${BOARD_ID}.txt" 2>&1 &&
rm "${D}"/"log-${BOARD_ID}.txt"
done

32
scripts/build-boot Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# Build SD card image
BOARD_ID="${1}" # For example "bananapi"
CHIP_ID="${2}" # For example "allwinner-a10"
DEFCONFIG="${3}" # For example "Bananapi_defconfig"
TUPLE="${4}" # For example "arm-linux-gnueabihf"
set -e
# Create fresh empty directory
TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
build-image tmp.img
case "${CHIP_ID}" in
allwinner*)
build-boot-sunxi "${BOARD_ID}" "${CHIP_ID}" "${DEFCONFIG}" "${TUPLE}"
;;
bcm2836|bcm2837)
build-boot-rpi "${BOARD_ID}" "${CHIP_ID}" "${DEFCONFIG}" "${TUPLE}"
;;
*)
echo Unknown CHIP_ID
exit 1
;;
esac
truncate -s 32M tmp.img
gzip tmp.img
cp tmp.img.gz "/artifacts/boot-${BOARD_ID}.bin.gz"

View File

@ -1,17 +1,13 @@
#!/bin/sh
# Build SD card image
IMAGE="${1}" # For example "boot-bananapi.bin"
DEFCONFIG="${2}" # For example "Bananapi_defconfig"
TUPLE="${3}" # For example "arm-linux-gnueabihf"
BOARD_ID="${1}" # For example "bananapi"
CHIP_ID="${2}" # For example "allwinner-a10"
DEFCONFIG="${3}" # For example "Bananapi_defconfig"
TUPLE="${4}" # For example "arm-linux-gnueabihf"
set -e
# Create fresh empty directory
TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
build-image tmp.img
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Write Raspberry Pi boot config
@ -56,7 +52,3 @@ mcopy -v -i vfat.img u-boot/u-boot.bin config.txt fixup*.dat start*.elf bootcode
# Copy FAT partition to image
dd if=vfat.img of=tmp.img bs=1K seek=1K
truncate -s 32M tmp.img
gzip tmp.img
cp tmp.img.gz "${IMAGE}.bin.gz"

View File

@ -1,29 +1,27 @@
#!/bin/sh
# Build SD card image
IMAGE="${1}" # For example "boot-bananapi.bin"
DEFCONFIG="${2}" # For example "Bananapi_defconfig"
TUPLE="${3}" # For example "arm-linux-gnueabihf"
PLAT="${4}" # For example "sun50i_a64"
BOARD_ID="${1}" # For example "bananapi"
CHIP_ID="${2}" # For example "allwinner-a10"
DEFCONFIG="${3}" # For example "Bananapi_defconfig"
TUPLE="${4}" # For example "arm-linux-gnueabihf"
set -e
# Create fresh empty directory
TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
case "${CHIP_ID}" in
*a64|*h5)
build-atf sun50i_a64 "${TUPLE}"
export BL31="$(pwd)/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin"
;;
*h6)
build-atf sun50i_h6 "${TUPLE}"
export BL31="$(pwd)/arm-trusted-firmware/build/sun50i_h6/debug/bl31.bin"
;;
*)
;;
esac
if [ "${TUPLE}" = "aarch64-linux-gnu" ]
then
build-atf "${PLAT}" "${TUPLE}"
export BL31="$(pwd)/arm-trusted-firmware/build/${PLAT}/debug/bl31.bin"
fi
build-image tmp.img
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
truncate -s 32M tmp.img
gzip tmp.img
cp tmp.img.gz "${IMAGE}.bin.gz"