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