Skip to content

Instantly share code, notes, and snippets.

@thatch45
Created March 10, 2011 19:44
Show Gist options
  • Save thatch45/864775 to your computer and use it in GitHub Desktop.
Save thatch45/864775 to your computer and use it in GitHub Desktop.
From 5fa6a519cf924217d90addc12ea79bf79fc612e0 Mon Sep 17 00:00:00 2001
From: Thomas S Hatch <thatch45@gmail.com>
Date: Thu, 10 Mar 2011 12:18:39 -0700
Subject: [PATCH] Add support for gzipped kernel modules
---
helper/appliance.c | 12 ++++++++++--
helper/ext2initrd.c | 28 ++++++++++++++--------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/helper/appliance.c b/helper/appliance.c
index 85efd75..41e4914 100644
--- a/helper/appliance.c
+++ b/helper/appliance.c
@@ -218,10 +218,18 @@ add_kernel_modules (const char *whitelist_file, const char *modpath,
continue;
/* Is it a *.ko file? */
- if (entry->fts_namelen >= 3 &&
+ if ((entry->fts_namelen >= 3 &&
entry->fts_name[entry->fts_namelen-3] == '.' &&
entry->fts_name[entry->fts_namelen-2] == 'k' &&
- entry->fts_name[entry->fts_namelen-1] == 'o') {
+ entry->fts_name[entry->fts_namelen-1] == 'o') ||
+ (entry->fts_namelen >= 3 &&
+ entry->fts_name[entry->fts_namelen-6] == '.' &&
+ entry->fts_name[entry->fts_namelen-5] == 'k' &&
+ entry->fts_name[entry->fts_namelen-4] == 'o' &&
+ entry->fts_name[entry->fts_namelen-3] == '.' &&
+ entry->fts_name[entry->fts_namelen-2] == 'g' &&
+ entry->fts_name[entry->fts_namelen-1] == 'z')
+ ) {
if (whitelist) {
/* Is it a *.ko file which is on the whitelist? */
size_t j;
diff --git a/helper/ext2initrd.c b/helper/ext2initrd.c
index f10aef2..899ef3b 100644
--- a/helper/ext2initrd.c
+++ b/helper/ext2initrd.c
@@ -47,20 +47,20 @@ extern char _binary_init_start, _binary_init_end, _binary_init_size;
* ext2 filesystem on it.
*/
static const char *kmods[] = {
- "ext2.ko",
- "virtio*.ko",
- "ide*.ko",
- "libata*.ko",
- "piix*.ko",
- "scsi_transport_spi.ko",
- "scsi_mod.ko",
- "sd_mod.ko",
- "sym53c8xx.ko",
- "ata_piix.ko",
- "sr_mod.ko",
- "mbcache.ko",
- "crc*.ko",
- "libcrc*.ko",
+ "ext2.ko*",
+ "virtio*.ko*",
+ "ide*.ko*",
+ "libata*.ko*",
+ "piix*.ko*",
+ "scsi_transport_spi.ko*",
+ "scsi_mod.ko*",
+ "sd_mod.ko*",
+ "sym53c8xx.ko*",
+ "ata_piix.ko*",
+ "sr_mod.ko*",
+ "mbcache.ko*",
+ "crc*.ko*",
+ "libcrc*.ko*",
NULL
};
--
1.7.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment