You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							80 lines
						
					
					
						
							1.9 KiB
						
					
					
				
			
		
		
	
	
							80 lines
						
					
					
						
							1.9 KiB
						
					
					
				| # vim: set ft=sh: | |
| # --- SDE-COPYRIGHT-NOTE-BEGIN --- | |
| # This copyright note is auto-generated by ./scripts/Create-CopyPatch. | |
| # | |
| # Filename: package/.../mkinitramfs/install/D%libdir_kernel.in.txt | |
| # Copyright (C) 2007 - 2009 The OpenSDE Project | |
| # | |
| # More information can be found in the files COPYING and README. | |
| # | |
| # This program is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation; version 2 of the License. A copy of the | |
| # GNU General Public License can be found in the file COPYING. | |
| # --- SDE-COPYRIGHT-NOTE-END --- | |
|  | |
| MODINFO=${MODINFO:-/sbin/modinfo} | |
| DEPMOD=${DEPMOD:-/sbin/depmod} | |
|  | |
| if [ -n "$moddir" ]; then | |
| 	# sanity checks | |
| 	for tool in $MODINFO $DEPMOD; do | |
| 		if [ ! -x "$tool" ]; then | |
| 			echo "ERROR: $tool is no available" | |
| 			exit 1 | |
| 		fi | |
| 	done | |
|  | |
| 	modules_missing= | |
|  | |
| 	module_install() { | |
| 		local module= source= target= | |
|  | |
| 		if [ -r "$1" ]; then | |
| 			# absolute path | |
| 			source="$1" | |
| 			module=${source##*/}; module=${module%.ko} | |
| 		else | |
| 			module="$1" | |
| 			source="$( find "$moddir/kernel" -name "$module.ko" | head -n 1 )" | |
| 		fi | |
|  | |
| 		if [ -r "$source" ]; then | |
| 			target="lib/modules/$kernelver/${source#$moddir/}" | |
|  | |
| 			if [ ! -f $target ]; then | |
| 				echo -n " $module" | |
| 				mkdir -p "${target%/*}" | |
| 				cp "$source" "$target" | |
|  | |
| 				for dep in $( $MODINFO "$source" | grep "^depends:" | tr -s ' ' | cut -d' ' -f2 | tr ',' ' ' ); do | |
| 					module_install "$dep" | |
| 				done | |
| 			fi | |
| 		else | |
| 			modules_missing="$modules_missing $module" | |
| 			echo -n " [$module]" | |
| 		fi | |
| 	} | |
|  | |
| 	module_list_available() { | |
| 		find "$moddir" -type f -name '*.ko' | |
| 	} | |
|  | |
| 	module_list_running() { | |
| 		local x= module= | |
| 		cat /proc/modules | cut -d' ' -f1 | while read x; do | |
| 			y=$(echo "$x" | sed -e 's,_,[_-],g') | |
| 			module=$(find "$moddir" -type f -name "$y.ko") | |
| 			if [ -n "$module" ]; then | |
| 				echo "$module" | |
| 			else | |
| 				echo "ERROR: $x.ko not found!" >&2 | |
| 			fi | |
| 		done | |
| 	} | |
|  | |
| 	safe_depmod() { | |
| 		$DEPMOD -ae -b "$tmpdir" -F "$sysmap" "$kernelver" | |
| 	} | |
| fi
 | |
| 
 |