Browse code

Package kernel modules with initrd

Anish Swaminathan authored on 2015/07/28 05:09:41
Showing 2 changed files
... ...
@@ -276,8 +276,16 @@ class Installer(object):
276 276
             process = subprocess.Popen(['rm', '-rf', os.path.join(self.photon_root, "installer")], stdout=self.output)
277 277
             retval = process.wait()
278 278
         else:
279
-            #Build the initramfs
280
-            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, './mkinitramfs', '-n', '/boot/initrd.img-no-kmods'],  stdout=self.output)
279
+            #Build the initramfs by passing in the kernel version
280
+            version_string = ''	
281
+            for root, dirs, files in os.walk(self.rpm_path):
282
+                for name in files:
283
+                    if fnmatch.fnmatch(name, 'linux-[0-9]*.rpm'):
284
+                        version_array = name.split('-')
285
+                        if len(version_array) > 2:
286
+                            version_string = version_array[1]
287
+
288
+            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, './mkinitramfs', '-n', '/boot/initrd.img-no-kmods', '-k', version_string],  stdout=self.output)
281 289
             retval = process.wait()
282 290
 
283 291
 
... ...
@@ -181,11 +181,11 @@ fi
181 181
 
182 182
 # Install the kernel modules if requested
183 183
 if [ -n "$KERNEL_VERSION" ]; then
184
-  find                                                                        \
185
-     /lib/modules/$KERNEL_VERSION/kernel/{crypto,fs,lib}                      \
186
-     /lib/modules/$KERNEL_VERSION/kernel/drivers/{block,ata,md,firewire}      \
187
-     /lib/modules/$KERNEL_VERSION/kernel/drivers/{scsi,message,pcmcia,virtio} \
188
-     /lib/modules/$KERNEL_VERSION/kernel/drivers/usb/{host,storage}           \
184
+  find                                                                                     \
185
+     /lib/modules/$KERNEL_VERSION/kernel/{crypto,fs,lib}                                   \
186
+     /lib/modules/$KERNEL_VERSION/kernel/drivers/{block,ata,md,firewire,net,xen}           \
187
+     /lib/modules/$KERNEL_VERSION/kernel/drivers/{scsi,message,pcmcia,virtio,hv,connector} \
188
+     /lib/modules/$KERNEL_VERSION/kernel/drivers/usb/{host,storage}                        \
189 189
      -type f 2> /dev/null | cpio --make-directories -p --quiet $WDIR
190 190
 
191 191
   cp /lib/modules/$KERNEL_VERSION/modules.{builtin,order}                     \