diff --git a/make/linux-rpm-build.mk b/make/linux-rpm-build.mk index aa0fcd9a..e5f1c5ff 100644 --- a/make/linux-rpm-build.mk +++ b/make/linux-rpm-build.mk @@ -206,7 +206,8 @@ dist: clean mv ../kernel.tar.gz . clean: rm -rf $(KERNEL_BASE)-* - rm -rf install/* reiser.patch *~ *.done *.lxdone *.uldone *.patch *.rpm *.tar.gz *.tar $(SCOPE_DRIVER_BASE) + rm -rf install/* reiser.patch *~ *.done *.lxdone *.uldone *.patch *.rpm *.tar.gz *.tar \ + $(SCOPE_DRIVER_BASE) rm -rf linux linux-$(KERNEL_VERSION) CURRENT_* pax_global_header rm -f toplevel-makefile EXTRAVERSION COMPLETE_VERSION diff --git a/make/rules.mk b/make/rules.mk index fddab9f5..ebeb8072 100644 --- a/make/rules.mk +++ b/make/rules.mk @@ -197,10 +197,10 @@ endif # gcc -M $(CPPFLAGS) $(DEPEND_CPPFLAGS) $(filter-out %.h,$(SRC_ALL_CPP)) -o $@; \ # fi -.%.o.dep.mk: %.cpp +.%.o.dep.mk: %.cpp $(BUILD_H) gcc -M $(CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@ -.%.o.dep.mk: %.c +.%.o.dep.mk: %.c $(BUILD_H) gcc -M $(CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@ checkroot: diff --git a/scripts/generate-boot-medium.sh b/scripts/generate-boot-medium.sh index 4cdeb851..385a1d55 100644 --- a/scripts/generate-boot-medium.sh +++ b/scripts/generate-boot-medium.sh @@ -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