Browse Source

mkinitramfs: split kernel plugin into plugin and library (kernel.in)

early
Alejandro Mery 16 years ago
parent
commit
c3a316e9ec
2 changed files with 65 additions and 43 deletions
  1. +2
    -43
      base/mkinitramfs/install/D%libdir_50-kernel.sh.txt
  2. +63
    -0
      base/mkinitramfs/install/D%libdir_kernel.in.txt

+ 2
- 43
base/mkinitramfs/install/D%libdir_50-kernel.sh.txt

@ -13,58 +13,17 @@
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
MODINFO=${MODINFO:-/sbin/modinfo}
DEPMOD=${DEPMOD:-/sbin/depmod}
. "$libdir/kernel.in"
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
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
}
echo -n "Installing modules:"
modules_missing=
if [ -n "$MKINITRD_MODULES" ]; then
for module in $MKINITRD_MODULES; do
@ -80,7 +39,7 @@ if [ -n "$moddir" ]; then
done
echo
$DEPMOD -ae -b "$tmpdir" -F "$sysmap" "$kernelver"
safe_depmod
[ -z "$modules_missing" ] || echo "Failed to find:$modules_missing"
fi

+ 63
- 0
base/mkinitramfs/install/D%libdir_kernel.in.txt

@ -0,0 +1,63 @@
# 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 - 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}
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
}
safe_depmod() {
$DEPMOD -ae -b "$tmpdir" -F "$sysmap" "$kernelver"
}
fi

Loading…
Cancel
Save