diff --git a/package/base/linux24-src/linux24-src.conf b/package/base/linux24-src/linux24-src.conf index a5b8a769c..c0fccf869 100644 --- a/package/base/linux24-src/linux24-src.conf +++ b/package/base/linux24-src/linux24-src.conf @@ -27,24 +27,20 @@ main_lx_src() { cd $root/usr/src echo "Extracting the Linux Kernel Sources [$vanilla_ver] ... " - rm -rf linux-$ver-rock ; mkdir -p linux-$ver-rock + lx_tempdir=`mktemp -d tmp.XXXXXXXXXX` # hack to extract the files into our usr/src dir ... - ln -sf $PWD/linux-$ver-rock $builddir/linux-${vanilla_ver} + # this part is continued inside lx_injectextraversion + ln -sf $PWD/${lx_tempdir} $builddir/linux-${vanilla_ver} tar -k $taropt $archdir/$srctar -C $builddir/ - chown -R 0:0 linux-$ver-rock ; chmod go=u,go-w linux-$ver-rock - - if [ "${pkg%-src}" = "$ROCKCFG_DEFAULT_KERNEL" ] ; then - rm -f linux - ln -svf linux-$ver-rock linux - fi + chown -R 0:0 ${lx_tempdir} ; chmod go=u,go-w ${lx_tempdir} echo "Copying kernel patches ... " rm -rf linux$treever-patches ; mkdir -p linux$treever-patches cp -v $base/package/$repository/linux$treever/README linux$treever-patches/ cp -v $patchfiles linux$treever-patches/ - cd linux-$ver-rock + cd ${lx_tempdir} lx_config # remove debug configs diff --git a/package/base/linux24/linux24.conf b/package/base/linux24/linux24.conf index 9febf5c72..81530e12a 100644 --- a/package/base/linux24/linux24.conf +++ b/package/base/linux24/linux24.conf @@ -45,19 +45,19 @@ main_lx() { case "$lx_cpu" in i386) eval $MAKE bzImage - cp -vf arch/i386/boot/bzImage $root/boot/vmlinuz_$ver-rock + cp -vf arch/i386/boot/bzImage $root/boot/vmlinuz_${lx_kernelrelease} [ "$default" ] && \ cp -vf arch/i386/boot/bzImage $root/boot/vmlinuz ;; x86_64) eval $MAKE bzImage - cp -vf arch/x86_64/boot/bzImage $root/boot/vmlinuz_$ver-rock + cp -vf arch/x86_64/boot/bzImage $root/boot/vmlinuz_${lx_kernelrelease} [ "$default" ] && \ cp -vf arch/x86_64/boot/bzImage $root/boot/vmlinuz ;; alpha) eval $MAKE vmlinux - gzip < vmlinux > $root/boot/vmlinux_$ver-rock.gz + gzip < vmlinux > $root/boot/vmlinux_${lx_kernelrelease}.gz [ "$default" ] && \ cp -vf $root/boot/vmlinux_$ver-rock.gz $root/boot/vmlinux.gz ;; @@ -65,13 +65,13 @@ main_lx() { eval $MAKE vmlinux $BUILDCC arch/mips/boot/elf2ecoff.c -o elf2ecoff ./elf2ecoff vmlinux vmlinux.ecoff - cp -vf vmlinux.ecoff $root/boot/vmlinux_$ver-rock.ecoff + cp -vf vmlinux.ecoff $root/boot/vmlinux_${lx_kernelrelease}.ecoff [ "$default" ] && \ cp -vf vmlinux.ecoff $root/boot/ ;; ppc) eval $MAKE vmlinux - cp -vf vmlinux $root/boot/vmlinux_$ver-rock + cp -vf vmlinux $root/boot/vmlinux_${lx_kernelrelease} [ "$default" ] && \ cp -vf vmlinux $root/boot/vmlinux eval $MAKE zImage @@ -101,13 +101,13 @@ main_lx() { ;; *) eval $MAKE vmlinux - cp -vf vmlinux $root/boot/vmlinux_$ver-rock + cp -vf vmlinux $root/boot/vmlinux_${lx_kernelrelease} [ "$default" ] && \ cp -vf vmlinux $root/boot/vmlinux ;; esac - cp -vf .config $root/boot/kconfig_$ver-rock - cp -vf System.map $root/boot/System.map_$ver-rock + cp -vf .config $root/boot/kconfig_${lx_kernelrelease} + cp -vf System.map $root/boot/System.map_${lx_kernelrelease} [ "$default" ] && cp -vf System.map $root/boot/System.map echo "Building the modules ..." @@ -118,25 +118,25 @@ main_lx() { INSTALL_MOD_PATH=$root DEPMOD=/bin/true else eval $MAKE modules_install DEPMOD=/bin/true - echo "Running 'depmod -a -q -F /boot/System.map $ver-rock' .." - depmod -a -q -F /boot/System.map_$ver-rock $ver-rock - for x in /lib/modules/$ver-rock/modules.* + echo "Running 'depmod -a -q -F /boot/System.map ${lx_kernelrelease}' .." + depmod -a -q -F /boot/System.map_${lx_kernelrelease} ${lx_kernelrelease} + for x in /lib/modules/${lx_kernelrelease}/modules.* do [ -f $x ] && add_flist $x; done fi # fix /lib/modules/${ver}/build symlink - rm -f $root/lib/modules/${ver}-rock/build - ln -sf ../../../usr/src/linux-${ver}-rock \ - $root/lib/modules/${ver}-rock/build + rm -f $root/lib/modules/${lx_kernelrelease}/build + ln -sf ../../../usr/src/linux-${lx_kernelrelease} \ + $root/lib/modules/${lx_kernelrelease}/build if [ "$default" ] ; then cp $base/package/base/linux24/mkinitrd.sh $root/sbin/mkinitrd chmod +x $root/sbin/mkinitrd if [ -z "$root" ]; then - mkinitrd empty ${ver}-rock + mkinitrd empty ${lx_kernelrelease} rm -f /boot/initrd.img - ln -s initrd-${ver}-rock.img /boot/initrd.img + ln -s initrd-${lx_kernelrelease}.img /boot/initrd.img fi fi } diff --git a/package/base/linux24/lx_config.sh b/package/base/linux24/lx_config.sh index ba27c5fc4..8ca8cae11 100644 --- a/package/base/linux24/lx_config.sh +++ b/package/base/linux24/lx_config.sh @@ -28,6 +28,9 @@ srctar="linux-${vanilla_ver}.tar.bz2" lx_cpu=`echo "$arch_machine" | sed -e s/x86$/i386/ \ -e s/i.86/i386/ -e s/powerpc/ppc/ -e s/hppa/parisc/` +lx_extraversion="" +lx_kernelrelease="" +lx_tempdir="" [ $arch = sparc -a "$ROCKCFG_SPARC_64BIT_KERNEL" = 1 ] && \ lx_cpu=sparc64 @@ -146,25 +149,69 @@ auto_config () fi } +lx_grabextraversion () { + local ev + ev=$( sed -n -e 's,^[ \t]*EXTRAVERSION[ \t]*=[ \t]*\([^ \t]*\),\1,p' Makefile | tail -1 ) + if [ "$ev" ]; then + lx_extraversion="${lx_extraversion}$ev" + # keep intact but commented since the second EXTRAVERSION + # definition, and clean the first. + sed -e 's,^\([ \t]*EXTRAVERSION[ \t]*=.*\),#\1,g' \ + -e 's,^#\(EXTRAVERSION =\).*,\1,' \ + Makefile > Makefile.new + mv Makefile.new Makefile + fi +} +lx_injectextraversion () { + lx_extraversion="${lx_extraversion}-rock" + + # inject final EXTRAVERSION into Makefile + sed -e "s,^\([ \t]*EXTRAVERSION[ \t]*\)=.*,\1= ${lx_extraversion},g" Makefile > Makefile.new + mv Makefile.new Makefile + + # update version.h + eval $MAKE include/linux/version.h + + # get kernel_release + lx_kernelrelease="$( echo -e "#include \nUTS_RELEASE" \ + > conftest.c && \ + gcc -E -I./include conftest.c | tail -1 \ + | cut -d '"' -f 2 && rm -f conftest.c )" + + # rename temp directory + if [ "${lx_tempdir}" ]; then + cd .. + rm -rf linux-${lx_kernelrelease} ; mv ${lx_tempdir} linux-${lx_kernelrelease} + ln -sf $PWD/linux-${lx_kernelrelease} $builddir/linux-${vanilla_ver} + + if [ "${pkg%-src}" = "$ROCKCFG_DEFAULT_KERNEL" ] ; then + rm -f linux + ln -svf linux-${lx_kernelrelease} linux + fi + cd linux-${lx_kernelrelease} + fi +} + lx_config () { echo "Generic linux source patching and configuration ..." + # grab extraversion from vanilla + lx_grabextraversion + hook_eval prepatch - apply_patchfiles + apply_patchfiles "lx_grabextraversion" hook_eval postpatch echo "Redefining some VERSION flags ..." - x="-`echo $ver-rock | cut -d - -f 2-`" - sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $x/" Makefile > Makefile.new - mv Makefile.new Makefile + lx_injectextraversion echo "Correcting user and permissions ..." chown -R root:root . * ; chmod -R u=rwX,go=rX . if [[ $treever = 24* ]] ; then echo "Create symlinks and a few headers for <$lx_cpu> ... " - eval $MAKE include/linux/version.h symlinks + eval $MAKE symlinks cp $base/package/base/linux24/autoconf.h include/linux/ touch include/linux/modversions.h fi @@ -182,7 +229,7 @@ lx_config () if [[ $treever != 24* ]] ; then echo "Create symlinks and a few headers for <$lx_cpu> ... " - eval $MAKE include/linux/version.h include/asm + eval $MAKE include/asm eval $MAKE oldconfig > /dev/null fi diff --git a/scripts/functions b/scripts/functions index 19a67b441..dd6250e46 100644 --- a/scripts/functions +++ b/scripts/functions @@ -496,6 +496,7 @@ apply_patchfiles() { else patch $patchopt < $x fi + eval "$@" done }