+write_logfile() +{
- ipxe_script=ipxe_script
- curl http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/boot.ipxe/mac/$... > $ipxe_script
- cat $ipxe_script >> ${log_file}
+}
+get_rootfs()
not rootfs
how about parse_parameter_from_ipxe_script
+{
- append=
- initrds=
- while read a b c
- do
case "$a" in
initrd)
file=$(basename "$b")
wget --timestamping -a ${log_file} --progress=bar:force $b
initrds+="$file "
;;
kernel)
kernel=$(basename "$b")
wget --timestamping -a ${log_file} --progress=bar:force $b
append=$(echo "$c" | sed -r "s/ initrd=[^ ]+//g")
;;
esac
- done < $ipxe_script
+}
+check_rootfs()
ditto
+{
- [ -s "$kernel" ] || {
echo "can't get kernel or kernel size is 0"
exit
- }
- [ -n "$initrds" ] || {
exit
- }
- initrd=initrd
- cat $initrds > $initrd
+}
+print_message()
echo_message
+{
- echo $SCHED_PORT
- echo kernel: $kernel
- echo initrds: $initrds
- echo append: $append
- echo less $log_file
i think change less to tail -f may be better
- sleep 5
+}
+kvm_command()
qemu_command
+{
- kvm=(
$qemu
-machine virt-4.0,accel=kvm,gic-version=3
-kernel $kernel
-initrd $initrd
-smp $nr_cpu
-m $memory
-cpu Kunpeng-920
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd
-nic tap,model=virtio-net-pci,helper=/usr/libexec/qemu-bridge-helper,br=br0,mac=${mac}
-k en-us
-no-reboot
-nographic
-serial file:${log_file}
-monitor null
- )
+}
+run_qemu() +{
- "${kvm[@]}" --append "${append}"
+}
run_qemu can merge with qemu_command?
Thanks, Shenwei
+check_logfile +write_logfile
+get_rootfs +check_rootfs
+qemu_command
+print_message
+kvm_command
+run_qemu
2.23.0