linux-rpm-build.mk, rules.mk, generate-boot-medium.sh: Cleanup commit

This commit is contained in:
Jan Lindemann 2007-02-16 20:12:31 +00:00 committed by Jan Lindemann
commit 3f0b65cb96
3 changed files with 67 additions and 21 deletions

View file

@ -3,21 +3,25 @@
myname=`basename $0`
cwd=`pwd`
make_initrd()
make_initrd_from_template()
{
template=$1
modules_dir=$2
uname_r=$3
target=$4
uname_r=$1
target=$2
modules_dir=$3
template=$4
shift 4
mod_names="$*"
# set up work space
dir=`mktemp -d "/tmp/$myname""_XXXXXX"`
mkdir $dir/source
cat $1 | (cd $dir/source; gunzip | cpio -i)
# unpack template and copy it
cat $template | (cd $dir/source; gunzip | cpio -i)
cp -rp $dir/source $dir/target
rm -rf $dir/target/lib/modules/*
# copy all modules both in template and kernel
(
cd $dir/source
find . -name '*.ko'
@ -39,13 +43,42 @@ make_initrd()
fi
done
/sbin/depmod -a -b $dir/target -v $uname_r
# copy all explicitly specified modules
for mod_name in $mod_names; do
echo "processing explicitly requested module $mod_name"
mod_source_path=`find $modules_dir -name $mod_name.ko`
if [ -z "$mod_source_path" ]; then
echo "warning: explicitly specified module $mod_name not found in $uname_r" >&2
continue
fi
mod_relpath=`echo $mod_source_path | sed "s%$modules_dir%%g; s/$mod_name.ko$//"`
target_path=$dir/target/lib/modules/$uname_r/$mod_relpath
echo "copying $mod_name from $mod_relpath to $target_path"
mkdir -p $target_path
cp -p $mod_source_path $target_path
done
# linuxrc
if [ "$linux_rc" ]; then
echo "copying $linux_rc to linuxrc"
cp $linux_rc $dir/target/init
fi
# depmod
/sbin/depmod -a -b $dir/target -v $uname_r > /dev/null
# pack stuff up
(cd $dir/target; find . | cpio -co) | gzip -9 > $target
rm -rf $dir
}
unquote()
{
cat | sed 's/^[ ]*|//'
}
config_section()
{
output_file=
@ -64,12 +97,14 @@ boot_sections()
name_filter()
{
echo $1 | tr [A-Z] [a-z] | sed 's/\.tar\.gz/.tgz/; s/-/_/g; s/\([^.]*\)\.\([^.]*\)$$/\1@\2/; s/\./_/g; s/@/./'
echo $1 | \
tr [A-Z] [a-z] | \
sed 's/\.tar\.gz/.tgz/; s/-/_/g; s/\([^.]*\)\.\([^.]*\)$$/\1@\2/; s/\./_/g; s/@/./'
}
#make_initrd $template $modules_dir
set -- `getopt 'f:o:d:' $*`
set -- `getopt 'i:f:o:d:' $*`
while [ "$1" != -- ]; do
case $1 in
@ -86,8 +121,13 @@ while [ "$1" != -- ]; do
boot_dir="$2"
shift
;;
-i)
linux_rc="$2"
shift
;;
*)
usage;
usage
;;
esac
shift
done
@ -105,6 +145,7 @@ echo PROMPT 0 >> $boot_dir/isolinux.cfg
for sec in `boot_sections $opt_config_file`; do
echo "+ processing section boot.$sec"
config_section $opt_config_file boot.$sec
eval `config_section $opt_config_file boot.$sec`
if [ "$add_boot_dir" ]; then
@ -128,17 +169,21 @@ for sec in `boot_sections $opt_config_file`; do
# create initrd
if [ "$initrd_template" ]; then
echo "+ creating initial ram disk from template $initrd_template"
make_initrd \
$initrd_template \
$add_modules_basedir/$kernel_version \
make_initrd_from_template \
$kernel_version \
$boot_dir/initrd_$kernel_version_iso
$boot_dir/initrd_$kernel_version_iso \
$add_modules_basedir/$kernel_version \
$initrd_template \
$included_modules
fi
# create isolinux.cfg
echo "LABEL $kernel_version" >> $boot_dir/isolinux.cfg
echo "KERNEL vmlinuz_$kernel_version_iso" >> $boot_dir/isolinux.cfg
echo "APPEND initrd=initrd_$kernel_version_iso root=$root_dev" >> $boot_dir/isolinux.cfg
cat << EOT | unquote >> $boot_dir/isolinux.cfg
|
|LABEL $kernel_version
|KERNEL vmlinuz_$kernel_version_iso
|APPEND initrd=initrd_$kernel_version_iso root=$root_dev
EOT
done
fi
done