build/payload/u-boot: 79 chars or less per line
Signed-off-by: Leah Rowe <leah@libreboot.org>fsdg20230625
parent
89ac1ea5a9
commit
a8f0721a6f
|
@ -28,17 +28,19 @@ RET=0
|
||||||
|
|
||||||
printf "Building U-Boot payloads\n"
|
printf "Building U-Boot payloads\n"
|
||||||
|
|
||||||
|
pdir="payload/u-boot"
|
||||||
|
|
||||||
# Build for all boards if no argument is given
|
# Build for all boards if no argument is given
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
for board_dir in resources/u-boot/*; do
|
for board_dir in resources/u-boot/*; do
|
||||||
if [ -d "${board_dir}/config/" ]; then
|
[ ! -d "${board_dir}/config/" ] && \
|
||||||
|
continue
|
||||||
set -- "$@" "${board_dir#resources/u-boot/}"
|
set -- "$@" "${board_dir#resources/u-boot/}"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -d "payload/" ] && mkdir -p payload/
|
[ ! -d "payload/" ] && mkdir -p payload/
|
||||||
[ ! -d "payload/u-boot" ] && mkdir -p payload/u-boot/
|
[ ! -d "${pdir}" ] && mkdir -p ${pdir}/
|
||||||
|
|
||||||
# Appends additional version info to U-Boot
|
# Appends additional version info to U-Boot
|
||||||
our_version="$(cat version)"
|
our_version="$(cat version)"
|
||||||
|
@ -47,15 +49,15 @@ export LOCALVERSION="-${projectname}-${our_version}"
|
||||||
|
|
||||||
for board in "$@"; do
|
for board in "$@"; do
|
||||||
board_dir="resources/u-boot/${board}"
|
board_dir="resources/u-boot/${board}"
|
||||||
rm -rf "payload/u-boot/${board}"
|
rm -rf "${pdir}/${board}"
|
||||||
mkdir -p "payload/u-boot/${board}"
|
mkdir -p "${pdir}/${board}"
|
||||||
|
|
||||||
ubtree="undefined"
|
ubtree="undefined"
|
||||||
arch="undefined"
|
arch="undefined"
|
||||||
|
|
||||||
if [ ! -f "${board_dir}/board.cfg" ]; then
|
if [ ! -f "${board_dir}/board.cfg" ]; then
|
||||||
printf "%s: Target %s does not have a board.cfg. Skipping build.\n" \
|
printf "build/u-boot %s: Missing board.cfg.\n" \
|
||||||
"build/payload/u-boot" "${board}"
|
"${board}"
|
||||||
RET=1
|
RET=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -64,14 +66,14 @@ for board in "$@"; do
|
||||||
. "${board_dir}/board.cfg" # source
|
. "${board_dir}/board.cfg" # source
|
||||||
|
|
||||||
if [ "${ubtree}" = "undefined" ]; then
|
if [ "${ubtree}" = "undefined" ]; then
|
||||||
printf "%s: Target %s does not define a U-Boot tree. Skipping build.\n" \
|
printf "build/u-boot %s: ubtree undefined\n" \
|
||||||
"build/payload/u-boot" "${board}"
|
"${board}"
|
||||||
RET=1
|
RET=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ "${arch}" = "undefined" ]; then
|
if [ "${arch}" = "undefined" ]; then
|
||||||
printf "%s: Target %s does not define a CPU type. Skipping build.\n" \
|
printf "build/u-boot %s: undefined cpu type\n" \
|
||||||
"build/payload/u-boot" "${board}"
|
"${board}"
|
||||||
RET=1
|
RET=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -86,30 +88,30 @@ for board in "$@"; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "${ubdir}" ]; then
|
if [ ! -d "${ubdir}" ]; then
|
||||||
printf "%s: Failed to download U-Boot for target %s. Skipping build.\n" \
|
printf "build/u-boot %s: uboot download failed\n" \
|
||||||
"build/payload/u-boot" "${board}"
|
"${board}"
|
||||||
RET=1
|
RET=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for config in "${board_dir}/config"/*; do
|
for config in "${board_dir}/config"/*; do
|
||||||
if [ ! -f "${config}" ]; then
|
if [ ! -f "${config}" ]; then
|
||||||
printf "%s: Target %s has no configs to build for. Skipping build.\n" \
|
printf "build/u-boot %s: configs missing\n" \
|
||||||
"build/payload/u-boot" "${board}"
|
${board}
|
||||||
RET=1
|
RET=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_name="${config#$board_dir/config/}"
|
config_name="${config#$board_dir/config/}"
|
||||||
if [ "$config_name" = "default" ]; then
|
if [ "$config_name" = "default" ]; then
|
||||||
dest_dir="payload/u-boot/${board}"
|
dest_dir="${pdir}/${board}"
|
||||||
else
|
else
|
||||||
dest_dir="payload/u-boot/${board}/${config_name}"
|
dest_dir="${pdir}/${board}/${config_name}"
|
||||||
fi
|
fi
|
||||||
mkdir -p "${dest_dir}"
|
mkdir -p "${dest_dir}"
|
||||||
|
|
||||||
printf "%s: Building for target %s (config %s).\n" \
|
printf "build/u-boot %s: building config %s).\n" \
|
||||||
"build/payload/u-boot" "${board}" "${config_name}"
|
${board} ${config_name}
|
||||||
|
|
||||||
make -C "${ubdir}" distclean
|
make -C "${ubdir}" distclean
|
||||||
|
|
||||||
|
@ -117,8 +119,11 @@ for board in "$@"; do
|
||||||
make -C "${ubdir}" olddefconfig
|
make -C "${ubdir}" olddefconfig
|
||||||
make -C "${ubdir}" -j"$(nproc)" all
|
make -C "${ubdir}" -j"$(nproc)" all
|
||||||
|
|
||||||
for f in "${ubdir}"/u-boot "${ubdir}"/u-boot.bin "${ubdir}"/u-boot.dtb \
|
for f in "${ubdir}"/u-boot "${ubdir}"/u-boot.bin \
|
||||||
"${ubdir}"/u-boot.img "${ubdir}"/u-boot.itb "${ubdir}"/u-boot.elf; do
|
"${ubdir}"/u-boot.dtb \
|
||||||
|
"${ubdir}"/u-boot.img \
|
||||||
|
"${ubdir}"/u-boot.itb \
|
||||||
|
"${ubdir}"/u-boot.elf; do
|
||||||
if [ -f "$f" ]; then
|
if [ -f "$f" ]; then
|
||||||
mv "$f" "${dest_dir}/"
|
mv "$f" "${dest_dir}/"
|
||||||
fi
|
fi
|
||||||
|
@ -126,12 +131,10 @@ for board in "$@"; do
|
||||||
|
|
||||||
make -C "${ubdir}" distclean
|
make -C "${ubdir}" distclean
|
||||||
|
|
||||||
printf "%s: Built for target %s (config %s).\n" \
|
printf "build/u-boot %s: build config %s\n" \
|
||||||
"build/payload/u-boot" "${board}" "${config_name}"
|
"${board}" "${config_name}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Done! U-Boot files are in payload/u-boot/\n\n"
|
printf "Done! U-Boot files are in %s/\n\n" ${pdir}
|
||||||
exit $RET
|
exit $RET
|
||||||
|
|
||||||
# ------------------- DONE ----------------------
|
|
||||||
|
|
Loading…
Reference in New Issue