lbmk scripts: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>9020vga
parent
4e06779948
commit
34ded35fa6
|
@ -90,8 +90,7 @@ verify_config()
|
|||
{
|
||||
[ -z "${rev+x}" ] && err 'verify_config: rev not set'
|
||||
[ -z "${loc+x}" ] && err 'verify_config: loc not set'
|
||||
[ -z "${url+x}" ] && err 'verify_config: url not set'
|
||||
return 0
|
||||
[ -z "${url+x}" ] && err 'verify_config: url not set'; return 0
|
||||
}
|
||||
|
||||
clone_project()
|
||||
|
@ -146,6 +145,5 @@ git_am_patches()
|
|||
[ ! -d "${patches}" ] && continue
|
||||
git_am_patches "${sdir}" "${patches}"
|
||||
done
|
||||
[ "${patchfail}" = "y" ] && return 1
|
||||
return 0
|
||||
[ "${patchfail}" = "y" ] && return 1; return 0
|
||||
}
|
||||
|
|
|
@ -165,8 +165,7 @@ build_dependency_grub()
|
|||
rebuild_grub="y"
|
||||
done
|
||||
[ -n "${_keyboard}" ] && keymaps="${kmapdir}/${_keyboard}.gkb"
|
||||
[ "${rebuild_grub}" = "y" ] || return 0
|
||||
x_ ./build grub
|
||||
[ "${rebuild_grub}" = "y" ] && x_ ./build grub; return 0
|
||||
}
|
||||
|
||||
build_dependency_uboot()
|
||||
|
@ -179,7 +178,7 @@ build_dependency_uboot()
|
|||
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \
|
||||
ubootelf="${ubdir}/u-boot"
|
||||
[ -f "${ubootelf}" ] && return 0
|
||||
err "Could not find u-boot build for board, ${board}"
|
||||
err "Can't find u-boot build for board, $board";
|
||||
}
|
||||
|
||||
build_target()
|
||||
|
@ -365,7 +364,6 @@ mkSeabiosGrubonlyRom()
|
|||
x_ rm -f "${tmpbootorder}"
|
||||
|
||||
x_ "${cbfstool}" "${_grubrom}" add-int -i 0 -n etc/show-boot-menu
|
||||
|
||||
x_ moverom "${_grubrom}" "${_newrom%.rom}_grubonly.rom"
|
||||
}
|
||||
|
||||
|
|
|
@ -128,8 +128,7 @@ handle_rom_archive()
|
|||
insert_version_files "${romdir}" || \
|
||||
err "mkrom_tarball ${romdir}: versionfile"
|
||||
|
||||
insert_copying_files "$romdir" || \
|
||||
err "!insert copy, handle 2, $romdir"
|
||||
insert_copying_files "$romdir" || err "!insert copy, handle 2, $romdir"
|
||||
mkrom_tarball
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,7 @@ handle_targets()
|
|||
done
|
||||
|
||||
[ "$target1" = "utils" ] && [ "$project" = "coreboot" ] && return 0
|
||||
[ -z "${mode}" ] || return 0
|
||||
printf "Done! The files are stored under %s/\n\n" "$elfdir"
|
||||
[ -z "${mode}" ] && printf "Done! Check %s/\n\n" "$elfdir"; return 0
|
||||
}
|
||||
|
||||
handle_defconfig()
|
||||
|
@ -149,8 +148,7 @@ handle_src_tree()
|
|||
fi
|
||||
|
||||
[ "$target1" = "utils" ] && [ "$project" = "coreboot" ] && return 0
|
||||
[ -z "$mode" ] || return 0
|
||||
check_cross_compiler
|
||||
[ -z "$mode" ] && check_cross_compiler; return 0
|
||||
}
|
||||
|
||||
check_cross_compiler()
|
||||
|
@ -172,8 +170,7 @@ check_cross_compiler()
|
|||
|
||||
check_config()
|
||||
{
|
||||
[ -f "$config" ] || \
|
||||
err "check_config: ${project}/${target}: configs missing"
|
||||
[ -f "$config" ] || err "check_config: ${project}/${target}: no config"
|
||||
|
||||
dest_dir="${elfdir}/${target}/${config_name}"
|
||||
# TODO: very hacky check. do it properly (based on build.list)
|
||||
|
@ -214,7 +211,6 @@ run_make_command()
|
|||
> "${codedir}/.coreboot-version"
|
||||
|
||||
x_ make $mode -j$(nproc) -C "$codedir"
|
||||
|
||||
[ "$mode" != "clean" ] && return 0
|
||||
make -C "$codedir" distclean 2>/dev/null || :
|
||||
}
|
||||
|
|
|
@ -14,10 +14,7 @@ eval "$(setvars "" archive rom modifygbe nukemode release new_mac)"
|
|||
main()
|
||||
{
|
||||
[ $# -lt 1 ] && err "No options specified."
|
||||
if [ "${1}" = "listboards" ]; then
|
||||
items config/coreboot || :
|
||||
exit 0
|
||||
fi
|
||||
[ "${1}" = "listboards" ] && eval "items config/coreboot || :; exit 0"
|
||||
|
||||
archive="${1}"
|
||||
|
||||
|
@ -45,20 +42,16 @@ check_board()
|
|||
failcheck="n"
|
||||
check_release "${archive}" || failcheck="y"
|
||||
if [ "${failcheck}" = "y" ]; then
|
||||
[ -f "${rom}" ] || \
|
||||
err "check_board: \"${rom}\" is not a valid path"
|
||||
[ -z "${rom+x}" ] && \
|
||||
err "check_board: no rom specified"
|
||||
[ -n "${board+x}" ] || \
|
||||
board=$(detect_board "${rom}")
|
||||
[ -f "$rom" ] || err "check_board \"$rom\": invalid path"
|
||||
[ -z "${rom+x}" ] && err "check_board: no rom specified"
|
||||
[ -n "${board+x}" ] || board=$(detect_board "${rom}")
|
||||
else
|
||||
release="y"
|
||||
board=$(detect_board "${archive}")
|
||||
fi
|
||||
|
||||
boarddir="${cbcfgsdir}/${board}"
|
||||
[ -d "${boarddir}" ] && return 0
|
||||
err "check_board: board ${board} not found"
|
||||
[ -d "$boarddir" ] || err "check_board: board $board missing"; return 0
|
||||
}
|
||||
|
||||
check_release()
|
||||
|
@ -85,8 +78,7 @@ detect_board()
|
|||
*)
|
||||
err "detect_board $filename: could not detect board type"
|
||||
esac
|
||||
[ -d "${boarddir}/" ] || \
|
||||
err "detect_board: dir, ${boarddir}, doesn't exist"
|
||||
[ -d "$boarddir" ] || err "detect_board: dir \"$boarddir\" missing"
|
||||
printf "%s\n" "${board}"
|
||||
}
|
||||
|
||||
|
@ -97,17 +89,12 @@ build_dependencies()
|
|||
x_ ./update trees -b coreboot utils default
|
||||
fi
|
||||
[ -z "$new_mac" ] || [ -f "$nvmutil" ] || x_ make -C util/nvmutil
|
||||
[ "${nukemode}" = "nuke" ] && return 0
|
||||
x_ ./vendor download ${board}
|
||||
[ "$nukemode" = "nuke" ] || x_ ./vendor download $board; return 0
|
||||
}
|
||||
|
||||
inject_vendorfiles()
|
||||
{
|
||||
if [ "${release}" != "y" ]; then
|
||||
patch_rom "${rom}"
|
||||
return 0
|
||||
fi
|
||||
printf "patching release images\n"
|
||||
[ "${release}" != "y" ] && eval "patch_rom \"$rom\"; return 0"
|
||||
patch_release_roms
|
||||
}
|
||||
|
||||
|
@ -134,18 +121,16 @@ patch_release_roms()
|
|||
err "patch_release_roms: ROMs did not match expected hashes"
|
||||
) || err "can't verify vendor hashes"
|
||||
|
||||
if [ "${modifygbe}" = "true" ]; then
|
||||
[ "${modifygbe}" = "true" ] && \
|
||||
for x in "${_tmpdir}"/bin/*/*.rom ; do
|
||||
modify_gbe "${x}"
|
||||
done
|
||||
fi
|
||||
|
||||
[ -d bin/release ] || x_ mkdir -p bin/release
|
||||
x_ mv "${_tmpdir}"/bin/* bin/release/
|
||||
x_ rm -Rf "${_tmpdir}"
|
||||
|
||||
printf "Success! Your ROMs are in bin/release\n"
|
||||
|
||||
x_ rm -Rf "${_tmpdir}"
|
||||
}
|
||||
|
||||
patch_rom()
|
||||
|
@ -195,8 +180,7 @@ inject()
|
|||
err "inject_${dl_type}: file missing, ${_dest}"
|
||||
|
||||
[ "$nukemode" = "nuke" ] || \
|
||||
printf "Inserting %s/%s into file: %s\n" \
|
||||
"${cbfsname}" "${_t}" "$rom"
|
||||
printf "Inserting %s/%s in file: %s\n" "$cbfsname" "$_t" "$rom"
|
||||
|
||||
if [ "${_t}" = "GbE" ]; then
|
||||
x_ mkdir -p tmp
|
||||
|
@ -223,7 +207,6 @@ inject()
|
|||
"$cbfstool" "$rom" remove -n "$cbfsname" || \
|
||||
err "inject $rom: can't remove $cbfsname"
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue