@@ -17,10 +17,18 @@ def is_nuc_whl_clr(names, vmid):
17
17
return False
18
18
19
19
20
- def is_mount_needed (names , vmid ):
21
- uos_type = names ['uos_types' ][vmid ]
22
- if uos_type in ("CLEARLINUX" , "ANDROID" , "ALIOS" ) and not is_nuc_whl_clr (names , vmid ):
23
- return True
20
+ def is_mount_needed (virt_io , vmid ):
21
+ rootfs_img = ''
22
+ blk_dev_list = launch_cfg_lib .get_rootdev_info (launch_cfg_lib .BOARD_INFO_FILE )
23
+ if virt_io ['block' ][vmid ]:
24
+ if ':' in virt_io ['block' ][vmid ]:
25
+ blk_dev = virt_io ['block' ][vmid ].split (':' )[0 ]
26
+ rootfs_img = virt_io ['block' ][vmid ].split (':' )[1 ]
27
+ else :
28
+ blk_dev = virt_io ['block' ][vmid ]
29
+
30
+ if blk_dev in blk_dev_list and rootfs_img :
31
+ return True
24
32
25
33
return False
26
34
@@ -264,7 +272,7 @@ def mem_size_set(args, vmid, config):
264
272
print ("mem_size={}M" .format (mem_size ), file = config )
265
273
266
274
267
- def uos_launch (names , args , vmid , config ):
275
+ def uos_launch (names , args , virt_io , vmid , config ):
268
276
269
277
gvt_args = args ['gvt_args' ][vmid ]
270
278
uos_type = names ['uos_types' ][vmid ]
@@ -294,14 +302,14 @@ def uos_launch(names, args, vmid, config):
294
302
if uos_type in ("CLEARLINUX" , "WINDOWS" ):
295
303
print ('launch_{} 1 "{}"' .format (launch_uos , gvt_args ), file = config )
296
304
297
- if is_mount_needed (names , vmid ):
305
+ if is_mount_needed (virt_io , vmid ):
298
306
print ("" , file = config )
299
307
print ('launch_{} {} "{}" "{}" $debug' .format (launch_uos , vmid , gvt_args , vmid ), file = config )
300
308
print ("" , file = config )
301
309
print ("umount /data" , file = config )
302
310
303
311
304
- def launch_end (names , args , vmid , config ):
312
+ def launch_end (names , args , virt_io , vmid , config ):
305
313
306
314
board_name = names ['board_name' ]
307
315
uos_type = names ['uos_types' ][vmid ]
@@ -327,8 +335,8 @@ def launch_end(names, args, vmid, config):
327
335
print ("done" , file = config )
328
336
print ("" , file = config )
329
337
330
- if is_mount_needed (names , vmid ):
331
- root_fs = args [ 'rootfs_dev ' ][vmid ]
338
+ if is_mount_needed (virt_io , vmid ):
339
+ root_fs = virt_io [ 'block ' ][vmid ]. split ( ':' )[ 0 ]
332
340
333
341
print ('if [ ! -b "{}" ]; then' .format (root_fs ), file = config )
334
342
print (' echo "no {} data partition, exit"' .format (root_fs ), file = config )
@@ -341,7 +349,7 @@ def launch_end(names, args, vmid, config):
341
349
342
350
off_line_cpus (args , vmid , uos_type , config )
343
351
344
- uos_launch (names , args , vmid , config )
352
+ uos_launch (names , args , virt_io , vmid , config )
345
353
346
354
347
355
def set_dm_pt (names , sel , vmid , config ):
@@ -413,23 +421,26 @@ def xhci_args_set(dm, vmid, config):
413
421
launch_cfg_lib .virtual_dev_slot ("xhci" ), dm ['xhci' ][vmid ]), file = config )
414
422
415
423
416
- def vritio_args_set ( virt_io , vmid , config ):
424
+ def virtio_args_set ( dm , virt_io , vmid , config ):
417
425
418
426
# virtio-input set, the value type is a list
419
427
for input_val in virt_io ['input' ][vmid ]:
420
428
if input_val :
421
429
print (" -s {},virtio-input,{} \\ " .format (
422
430
launch_cfg_lib .virtual_dev_slot ("virtio-input{}" .format (input_val )), input_val ), file = config )
423
431
432
+ # virtio-blk set, the value type is a list
433
+ for blk in virt_io ['block' ][vmid ]:
434
+ if blk :
435
+ print (" -s {},virtio-blk,{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("virtio-blk{}" .format (blk )), blk .strip (':' )), file = config )
436
+
424
437
425
438
def dm_arg_set (names , sel , virt_io , dm , vmid , config ):
426
439
427
440
uos_type = names ['uos_types' ][vmid ]
428
441
board_name = names ['board_name' ]
429
442
430
- # vboot loader for vsbl
431
443
boot_image_type (dm , vmid , config )
432
- root_img = dm ['rootfs_img' ][vmid ]
433
444
434
445
# uuid get
435
446
scenario_uuid = launch_cfg_lib .get_scenario_uuid ()
@@ -495,7 +506,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
495
506
xhci_args_set (dm , vmid , config )
496
507
497
508
# VIRTIO args set
498
- vritio_args_set ( virt_io , vmid , config )
509
+ virtio_args_set ( dm , virt_io , vmid , config )
499
510
500
511
# GVT args set
501
512
gvt_arg_set (uos_type , config )
@@ -529,12 +540,6 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
529
540
530
541
if not is_nuc_whl_clr (names , vmid ):
531
542
print (" -s {},wdt-i6300esb \\ " .format (launch_cfg_lib .virtual_dev_slot ("wdt-i6300esb" )), file = config )
532
- #print(" -s {},xhci,1-1:1-2:1-3:2-1:2-2:2-3:cap=apl \\".format(launch_cfg_lib.virtual_dev_slot("xhci")), file=config)
533
-
534
- if dm ['vbootloader' ][vmid ] and dm ['vbootloader' ][vmid ] == "vsbl" :
535
- print (" -s {},virtio-blk$boot_dev_flag,/data/{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("virtio-blk" ), root_img ), file = config )
536
- elif dm ['vbootloader' ][vmid ] and dm ['vbootloader' ][vmid ] == "ovmf" :
537
- print (" -s {},virtio-blk,{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("virtio-blk" ), root_img ), file = config )
538
543
539
544
if uos_type in ("ANDROID" , "ALIOS" ):
540
545
print (" --enable_trusty \\ " , file = config )
@@ -568,4 +573,4 @@ def gen(names, pt_sel, virt_io, dm, vmid, config):
568
573
dm_arg_set (names , pt_sel , virt_io , dm , vmid , config )
569
574
570
575
# gen launch end
571
- launch_end (names , dm , vmid , config )
576
+ launch_end (names , dm , virt_io , vmid , config )
0 commit comments