minor code cleanup in the build system

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-05-19 06:30:32 +01:00
parent 998f30ad4d
commit b40118ae59
3 changed files with 10 additions and 25 deletions

2
build
View File

@ -151,12 +151,10 @@ fetch_trees()
for x in $(items config/git); do for x in $(items config/git); do
./update trees -f "$x" || $err "$_xm: fetch $x" ./update trees -f "$x" || $err "$_xm: fetch $x"
done done
for x in config/*/build.list; do for x in config/*/build.list; do
[ -f "$x" ] && xp="${x#*/}" && xp="${xp%/*}" [ -f "$x" ] && xp="${x#*/}" && xp="${xp%/*}"
[ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp" [ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp"
done done
rmgit . rmgit .
rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm" rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
} }

View File

@ -148,10 +148,8 @@ handle_coreboot_target()
[ -d "bin/${board}" ] || return 0 [ -d "bin/${board}" ] || return 0
[ "$xbmk_release" = "y" ] || targets="* bin/${board}\n${targets}" [ "$xbmk_release" = "y" ] || targets="* bin/${board}\n${targets}"
[ "$xbmk_release" = "y" ] || return 0 [ "$xbmk_release" = "y" ] && mktar_release "bin/$board" && \
targets="* bin/${relname}_$board.tar.xz\n$targets"; return 0
targets="* bin/${relname}_$board.tar.xz\n$targets"
mktar_release "bin/$board"
} }
configure_target() configure_target()
@ -179,8 +177,7 @@ configure_target()
[ "$payload_seabios_grubonly" = "y" ] && payload_seabios_withgrub="y" [ "$payload_seabios_grubonly" = "y" ] && payload_seabios_withgrub="y"
# The reverse logic must not be applied. If SeaBIOS-with-GRUB works, # The reverse logic must not be applied. If SeaBIOS-with-GRUB works,
# that doesn't mean GRUB-withSeaBIOS will. For example, the board # that doesn't mean GRUB-with-SeaBIOS will, e.g. VGA ROM execution
# might have a graphics card whose vga rom coreboot doesn't execute
[ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \ [ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \
[ "${payload_uboot}" != "y" ] && ! check_defconfig "$targetdir" \ [ "${payload_uboot}" != "y" ] && ! check_defconfig "$targetdir" \
&& $err "target '$board' defines no payload" && $err "target '$board' defines no payload"
@ -192,7 +189,6 @@ configure_target()
# Override all payload directives with cmdline args # Override all payload directives with cmdline args
[ -z "${_payload}" ] && return 0 [ -z "${_payload}" ] && return 0
printf "setting payload to: %s\n" "${_payload}"
eval "$(setvars "n" payload_grub payload_memtest payload_seabios \ eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
payload_seabios_withgrub payload_uboot payload_grub_withseabios \ payload_seabios_withgrub payload_uboot payload_grub_withseabios \
payload_seabios_grubonly)" payload_seabios_grubonly)"
@ -235,13 +231,9 @@ build_grub_payload()
[ -f "$grubelf" ] && return 0 [ -f "$grubelf" ] && return 0
[ -f "src/grub/grub-mkstandalone" ] || x_ ./update trees -b grub [ -f "src/grub/grub-mkstandalone" ] || x_ ./update trees -b grub
./src/grub/grub-mkstandalone \ ./src/grub/grub-mkstandalone --grub-mkimage="src/grub/grub-mkimage" \
--grub-mkimage="src/grub/grub-mkimage" \ -O i386-coreboot -o "elf/grub/grub.elf" -d "src/grub/grub-core/" \
-O i386-coreboot \ --fonts= --themes= --locales= --modules="${grub_modules}" \
-o "elf/grub/grub.elf" \
-d "src/grub/grub-core/" \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \ --install-modules="${grub_install_modules}" \
"/boot/grub/grub.cfg=${grubcfgsdir}/config/grub_memdisk.cfg" \ "/boot/grub/grub.cfg=${grubcfgsdir}/config/grub_memdisk.cfg" \
"/boot/grub/grub_default.cfg=${grubcfgsdir}/config/grub.cfg" || \ "/boot/grub/grub_default.cfg=${grubcfgsdir}/config/grub.cfg" || \
@ -255,8 +247,7 @@ build_uboot_payload()
ubootelf="${ubdir}/u-boot.elf" ubootelf="${ubdir}/u-boot.elf"
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \ [ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \
ubootelf="${ubdir}/u-boot" ubootelf="${ubdir}/u-boot"
[ -f "${ubootelf}" ] && return 0 [ -f "${ubootelf}" ] || $err "$board: Can't find u-boot"; return 0
$err "Can't find u-boot build for board, $board";
} }
build_target_mainboard() build_target_mainboard()
@ -281,7 +272,6 @@ build_target_mainboard()
done done
} }
# Main ROM building function. This calls all other functions below
build_roms() build_roms()
{ {
cbcfg="${1}" cbcfg="${1}"
@ -457,10 +447,8 @@ moverom()
x_ mkdir -p "${2%/*}" x_ mkdir -p "${2%/*}"
x_ cp "$1" "$2" x_ cp "$1" "$2"
[ "$xbmk_release" = "y" ] || return 0 [ "$xbmk_release" = "y" ] && mksha512sum "${2}" "vendorhashes" && \
x_ ./vendor inject -r "${2}" -b "$board" -n nuke; return 0
mksha512sum "${2}" "vendorhashes"
x_ ./vendor inject -r "${2}" -b "$board" -n nuke
} }
main $@ main $@

View File

@ -230,8 +230,7 @@ check_cmake()
check_makefile "${1}" || \ check_makefile "${1}" || \
$err "check_cmake ${1}: can't cmake ${cmakedir}" $err "check_cmake ${1}: can't cmake ${cmakedir}"
[ -z "${cmakedir}" ] || check_makefile "${1}" || \ [ -z "${cmakedir}" ] || check_makefile "${1}" || \
$err "check_cmake ${1}: could not generate Makefile" $err "check_cmake ${1}: can't generate Makefile"; return 0
return 0
} }
check_autoconf() check_autoconf()