Browse Source

Added to mkinitramfs greedy plugin to install available modules into the image

git-svn-id: svn://svn.opensde.net/opensde/package/branches/udev@21295 10447126-35f2-4685-b0cf-6dd780d3921f
early
Alejandro Mery 17 years ago
parent
commit
80023c9f38
1 changed files with 71 additions and 0 deletions
  1. +71
    -0
      base/mkinitramfs/files/50-kernel.sh

+ 71
- 0
base/mkinitramfs/files/50-kernel.sh

@ -0,0 +1,71 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../mkinitramfs/files/50-kernel.sh
# Copyright (C) 2007 - 2008 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}
set -e
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
if [ "$running" ]; then
echo "TODO: building on a running system, we can take the list of active modules."
fi
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
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
}
echo -n "Installing modules:"
# greedy^3
find $moddir/kernel/drivers/{block,ide,ieee1394,md,scsi,cdrom,usb,message} \
$moddir/kernel/{lib,fs} \
-type f | while read file; do
module_install "$file"
done
echo
$DEPMOD -ae -b "$tmpdir" -F "$sysmap" "$kernelver"
fi

Loading…
Cancel
Save