[BusyBox] Compiling busybox with uClibc

Matt Kraai kraai at alumni.carnegiemellon.edu
Sat Aug 4 10:54:50 UTC 2001


On Thu, Aug 02, 2001 at 06:14:27PM -0400, David Douthitt wrote:
> Also, insmod.c generated a warning about reaching the end of a void
> function:
> 
> insmod.c: In function `get_kernel_version':
> insmod.c:1321: warning: control reaches end of non-void function

This return value is ignored, so it won't cause any real problems.
To get rid of the warning and simplify things, though, you can
apply the following patch.  I'll commit it to CVS on Monday.

Matt

--- busybox-0.60.0/insmod.c	Tue Jul 31 15:51:49 2001
+++ busybox/insmod.c	Sat Aug  4 08:27:03 2001
@@ -1304,22 +1304,6 @@
 }
 
 #ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
-/* Get the kernel version in the canonical integer form.  */
-
-static int get_kernel_version(char str[STRVERSIONLEN])
-{
-	struct utsname uts_info;
-	int kv;
-
-	if (uname(&uts_info) < 0)
-		return -1;
-	strncpy(str, uts_info.release, STRVERSIONLEN);
-
-	kv = get_kernel_revision();
-	if(kv==0)
-		return -1;
-}
-
 /* String comparison for non-co-versioned kernel and module.  */
 
 static int ncv_strcmp(const char *a, const char *b)
@@ -3239,8 +3223,7 @@
 	int exit_status = EXIT_FAILURE;
 	int m_has_modinfo;
 #ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
-	int k_version;
-	char k_strversion[STRVERSIONLEN];
+	struct utsname uts_info;
 	char m_strversion[STRVERSIONLEN];
 	int m_version;
 	int m_crcs;
@@ -3355,7 +3338,8 @@
 #ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
 	/* Version correspondence?  */
 
-	k_version = get_kernel_version(k_strversion);
+	if (uname(&uts_info) < 0)
+		uts_info.release[0] = '\0';
 	if (m_has_modinfo) {
 		m_version = new_get_module_version(f, m_strversion);
 	} else {
@@ -3367,17 +3351,17 @@
 		}
 	}
 
-	if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
+	if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) {
 		if (flag_force_load) {
 			error_msg("Warning: kernel-module version mismatch\n"
 					"\t%s was compiled for kernel version %s\n"
 					"\twhile this kernel is version %s",
-					m_filename, m_strversion, k_strversion);
+					m_filename, m_strversion, uts_info.release);
 		} else {
 			error_msg("kernel-module version mismatch\n"
 					"\t%s was compiled for kernel version %s\n"
 					"\twhile this kernel is version %s.",
-					m_filename, m_strversion, k_strversion);
+					m_filename, m_strversion, uts_info.release);
 			goto out;
 		}
 	}





More information about the busybox mailing list