mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
scripts: Add prepare_linux function
`prepare_linux` checks if a `--build-guest-kernel` option is present, and build kernel from `cloud-hypervisor/linux.git`. Otherwise, it will invoke `download_linux` to use pre-built kernel. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
c6889388a3
commit
906580ee92
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
hypervisor="kvm"
|
||||
test_filter=""
|
||||
build_kernel=false
|
||||
|
||||
# Checkout source code of a GIT repo with specified branch and commit
|
||||
# Args:
|
||||
@ -75,11 +76,13 @@ cmd_help() {
|
||||
echo ""
|
||||
echo " --hypervisor Underlying hypervisor. Options kvm, mshv"
|
||||
echo " --test-filter Tests to run"
|
||||
echo " --build-guest-kernel Build guest kernel from source instead of downloading pre-built"
|
||||
echo ""
|
||||
echo " --help Display this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
process_common_args() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@ -93,9 +96,11 @@ process_common_args() {
|
||||
;;
|
||||
"--test-filter")
|
||||
shift
|
||||
# shellcheck disable=SC2034
|
||||
test_filter="$1"
|
||||
;;
|
||||
"--build-guest-kernel")
|
||||
build_kernel=true
|
||||
;;
|
||||
"--") {
|
||||
shift
|
||||
break
|
||||
@ -149,6 +154,18 @@ download_linux() {
|
||||
popd || exit
|
||||
}
|
||||
|
||||
prepare_linux() {
|
||||
if [ "$build_kernel" = true ]; then
|
||||
echo "Building kernel from source"
|
||||
build_custom_linux
|
||||
echo "Using kernel built from source"
|
||||
else
|
||||
echo "Downloading pre-built kernel from GitHub"
|
||||
download_linux
|
||||
echo "Using kernel downloaded from GitHub"
|
||||
fi
|
||||
}
|
||||
|
||||
download_ovmf() {
|
||||
OVMF_FW_TAG="ch-6624aa331f"
|
||||
OVMF_FW_URL="https://github.com/cloud-hypervisor/edk2/releases/download/$OVMF_FW_TAG/CLOUDHV.fd"
|
||||
|
Loading…
Reference in New Issue
Block a user