From e75a06dd435fbf5348314997988b96b4f1cb2e4f Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Tue, 19 Jun 2018 16:39:29 +0800 Subject: [PATCH] lkp qemu: use local modules.cgz for lkp qemu if needed if "-m /path/to/modules.cgz" is specified, use this modules.cgz directly instead of downloading from web Signed-off-by: Li Zhijian Signed-off-by: Philip Li --- lib/kexec.sh | 18 ++++++++++++++++++ lkp-exec/qemu | 1 + 2 files changed, 19 insertions(+) diff --git a/lib/kexec.sh b/lib/kexec.sh index ae15a93e6..ee34468d8 100755 --- a/lib/kexec.sh +++ b/lib/kexec.sh @@ -51,6 +51,21 @@ initrd_is_correct() gzip -dc $file | cpio -t >/dev/null } +# for lkp qemu, it will set LKP_LOCAL_RUN=1 +use_local_modules_initrds() +{ + [ "$LKP_LOCAL_RUN" = "1" ] && [ "$modules_initrd" ] && { + # lkp qemu will create a link to modules.cgz under $CACHE_DIR + # ls -al /root/.lkp/cache/modules.cgz + # lrwxrwxrwx 1 root root 21 Jun 19 08:13 /root/.lkp/cache/modules.cgz -> /lkp-qemu/modules.cgz + local local_modules=$CACHE_DIR/$(basename $modules_initrd) + [ -e $local_modules ] || return + initrds="$local_modules " + echo "use local modules: $local_modules" + unset modules_initrd + } +} + download_initrd() { local _initrd @@ -58,6 +73,9 @@ download_initrd() echo "downloading initrds ..." set_job_state "wget_initrd" + + use_local_modules_initrds + for _initrd in $(echo $initrd $tbox_initrd $job_initrd $lkp_initrd $bm_initrd $modules_initrd $linux_headers_initrd $audio_sof_initrd $syzkaller_initrd $linux_selftests_initrd $linux_perf_initrd | tr , ' ') do _initrd=$(echo $_initrd | sed 's/^\///') diff --git a/lkp-exec/qemu b/lkp-exec/qemu index 855cbd138..dec35267f 100755 --- a/lkp-exec/qemu +++ b/lkp-exec/qemu @@ -48,6 +48,7 @@ validate_options() need_module="$(get_job_env $job_script 'need_modules')" || return [[ "$need_module" = "true" ]] && { [[ ! $opt_modules ]] && echo "kernel module is required, please specify it with '-m'" && return 1 + [[ ! -e $opt_modules ]] && echo "$opt_modules is not existed" && return 1 } return 0