On Tue, Jan 19, 2021 at 01:42:15PM +0800, Liu Yinsi wrote:
On Tue, Jan 19, 2021 at 11:34:40AM +0800, Cao Xueliang wrote:
On Tue, Jan 19, 2021 at 10:09:04AM +0800, Liu Yinsi wrote:
[Error Msg] ++ set_initrd ++ initrd=initrd ++ cat <<< hang here
[Root Cause] Function set_initrd() have follow line: cat $initrds > $initrd
when $initrds is null, the script will hang when execute cat command.
In after still execute "cat $initrds > initrd" why not hang again?
[how] before: [ -n "$initrds" ] || exit after: [ -n "$initrds" ] && cat $initrds > initrd || exit
if $initrds is null, will exit, not execute "cat $initrds"
It will exit too in before, pls make it clear.
Thanks, Xueliang
Thanks, Yinsi
[why]
- before execute cat command, check wether initrds is null.
- initrd is a brief file name, it can be used directly, so remove $initrd, just us initrd.
- set_initrd() is unnecessary, so remove.
Signed-off-by: Liu Yinsi liuyinsi@163.com
providers/qemu/kvm.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 854e913..52b10f2 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -60,13 +60,7 @@ check_option_value() # debian has both qemu-system-x86_64 and qemu-system-riscv64 command [[ $kernel =~ 'riscv64' ]] && qemu=qemu-system-riscv64
- [ -n "$initrds" ] || exit
-}
-set_initrd() -{
- initrd=initrd
- cat $initrds > $initrd
- [ -n "$initrds" ] && cat $initrds > initrd || exit
}
set_bios() @@ -125,7 +119,7 @@ public_option() kvm=( $qemu -kernel $kernel
-initrd $initrd
-smp $nr_cpu -m $memory -rtc base=localtime-initrd initrd
@@ -183,7 +177,6 @@ run_qemu()
set_options() {
- set_initrd set_bios set_helper set_nic
-- 2.23.0
Thanks, Xueliang