@@ -50,6 +50,7 @@ def machine_is(self, needle):
5050 def configure_from_env (self ):
5151 self .expected_release = get_expected_release ()
5252 self .vmlinux = get_vmlinux ()
53+ self .modules_tarball = get_modules_tarball ()
5354 self .cpuinfo = None
5455
5556 def configure_from_args (self , orig_args ):
@@ -74,6 +75,7 @@ def configure_from_args(self, orig_args):
7475 parser .add_argument ('--cmdline' , type = str , help = 'Kernel command line arguments' )
7576 parser .add_argument ('--release-path' , type = str , help = 'Path to kernel.release' )
7677 parser .add_argument ('--kernel-path' , type = str , help = 'Path to kernel (vmlinux)' )
78+ parser .add_argument ('--modules-path' , type = str , help = 'Path to modules tarball' )
7779 parser .add_argument ('--cap' , dest = 'machine_caps' , type = str , default = [], action = 'append' , help = 'Machine caps' )
7880 args = parser .parse_args (orig_args )
7981
@@ -120,6 +122,9 @@ def configure_from_args(self, orig_args):
120122 if args .kernel_path :
121123 self .vmlinux = args .kernel_path
122124
125+ if args .modules_path :
126+ self .modules_tarball = args .modules_path
127+
123128 self .compat_rootfs = args .compat_rootfs
124129 self .use_vof = args .use_vof
125130 self .quiet = args .quiet
@@ -271,6 +276,9 @@ def boot(p, timeout, qconf):
271276
272277 self .boot_func = boot
273278
279+ if self .modules_tarball :
280+ self .modules_drive = self .add_drive (f'file={ self .modules_tarball } ,format=raw,readonly=on' )
281+
274282 def add_drive (self , args ):
275283 drive_id = self .next_drive
276284 self .next_drive += 1
@@ -514,6 +522,11 @@ def qemu_main(qconf):
514522 p .expect (s )
515523 p .expect_prompt ()
516524
525+ if qconf .modules_tarball :
526+ p .cmd ('mkdir -p /lib/modules' )
527+ p .send (f'cd /lib/modules; cat /dev/vd{ qconf .modules_drive } | zcat | tar --strip-components=2 -xf -; cd -' )
528+ p .expect_prompt (timeout = boot_timeout )
529+
517530 if qconf .net_tests :
518531 qemu_net_setup (p )
519532 ping_test (p )
0 commit comments