LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   I'm not getting the proper $KERNELRELEASE string after make rpm (https://www.linuxquestions.org/questions/linux-kernel-70/im-not-getting-the-proper-%24kernelrelease-string-after-make-rpm-942500/)

markings 04-30-2012 04:07 AM

I'm not getting the proper $KERNELRELEASE string after make rpm
 
Hello,

I've been at this for the last few hours trying to figure out where in the compilation process where $KERNELRELEASE gets a different value from CONFIG_LOCALVERSION or LOCALVERSION when it reaches "rpmbuild".

Code:

make clean
  CLEAN  .
  CLEAN  .tmp_versions
set -e; cd -P ..; ln -sf /mnt/wsrv/usr/local/src/linux-3.2.16 kernel-3.2.16_grsec.bomb.us
/bin/sh /mnt/wsrv/usr/local/src/linux-3.2.16/scripts/setlocalversion --save-scmversion
set -e; cd -P ..; tar -cz --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git -f kernel-3.2.16_grsec.bomb.us.tar.
gz kernel-3.2.16_grsec.bomb.us/.
set -e; cd -P ..; rm kernel-3.2.16_grsec.bomb.us
rm -f /mnt/wsrv/usr/local/src/linux-3.2.16/.scmversion
set -e; \
/bin/sh /mnt/wsrv/usr/local/src/linux-3.2.16/scripts/mkversion > /mnt/wsrv/usr/local/src/linux-3.2.16/.tmp_version
set -e; \
mv -f /mnt/wsrv/usr/local/src/linux-3.2.16/.tmp_version /mnt/wsrv/usr/local/src/linux-3.2.16/.version
rpmbuild  --target x86_64 -ta ../kernel-3.2.16_grsec.bomb.us.tar.gz
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.2ddOyE
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd /usr/src/packages/BUILD
+ rm -rf kernel-3.2.16_grsecgrsec
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /mnt/wsrv/usr/local/src/kernel-3.2.16_grsecgrsec.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd kernel-3.2.16_grsecgrsec
make clean
  CLEAN  .
  CLEAN  .tmp_versions
set -e; cd -P ..; ln -sf /mnt/wsrv/usr/local/src/linux-3.2.16 kernel-3.2.16_grsec.bomb.us
/bin/sh /mnt/wsrv/usr/local/src/linux-3.2.16/scripts/setlocalversion --save-scmversion
set -e; cd -P ..; tar -cz --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git -f kernel-3.2.16_grsec.bomb.us.tar.
gz kernel-3.2.16_grsec.bomb.us/.
set -e; cd -P ..; rm kernel-3.2.16_grsec.bomb.us
rm -f /mnt/wsrv/usr/local/src/linux-3.2.16/.scmversion
set -e; \
/bin/sh /mnt/wsrv/usr/local/src/linux-3.2.16/scripts/mkversion > /mnt/wsrv/usr/local/src/linux-3.2.16/.tmp_version
set -e; \
mv -f /mnt/wsrv/usr/local/src/linux-3.2.16/.tmp_version /mnt/wsrv/usr/local/src/linux-3.2.16/.version
rpmbuild  --target x86_64 -ta ../kernel-3.2.16_grsec.bomb.us.tar.gz
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.2ddOyE
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd /usr/src/packages/BUILD
+ rm -rf kernel-3.2.16_grsecgrsec
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /mnt/wsrv/usr/local/src/kernel-3.2.16_grsecgrsec.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd kernel-3.2.16_grsecgrsec

When the compiling process is done, I'm looking for a resulting "kernel-3.2.16_grsec.bomb.us.x86_64.rpm", instead the result is "kernel-3.2.16_grsecgrsec". I've been going through the Makefile and I can seem to find the exact location where $KERNELRELEASE get's modified to a different string than expected. Any assistance in this issue would be helpful.

Best Regards

unSpawn 04-30-2012 05:16 AM

Any reason for not posting the .spec file and the command line you build the package with?

markings 04-30-2012 02:03 PM

Hello
 
Hello,

Well, if I had known, I would have included the necessary information in my previous post. There were no particular reason the information was withheld.

Code:

make CC=/usr/bin/gcc-4.6 DISABLE_PAX_PLUGINS=y rpm
Note: The spec file is auto generated during compile time by $root/include/package/mkspec

Code:

Name: kernel
Summary: The Linux Kernel
Version: 3.2.16_grsecgrsec
Release: 2
License: GPL
Group: System Environment/Kernel
Vendor: The Linux Community
URL: http://www.kernel.org
Source: kernel-3.2.16_grsecgrsec.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
Provides:  kernel-3.2.16-grsecgrsec
%define __spec_install_post /usr/lib/rpm/brp-compress || :
%define debug_package %{nil}

%description
The Linux Kernel, the operating system core itself

%package headers
Summary: Header files for the Linux kernel for use by glibc
Group: Development/System
Obsoletes: kernel-headers
Provides: kernel-headers = %{version}
%description headers
Kernel-headers includes the C header files that specify the interface
between the Linux kernel and userspace libraries and programs.  The
header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
glibc package.

%prep
%setup -q

%build
make clean && make %{?_smp_mflags}

%install%ifarch ia64
mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules
mkdir -p $RPM_BUILD_ROOT/lib/firmware
%else
mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules
mkdir -p $RPM_BUILD_ROOT/lib/firmware
%endif
INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install
%ifarch ia64
cp $KBUILD_IMAGE $RPM_BUILD_ROOT/boot/efi/vmlinuz-3.2.16-grsecgrsec
ln -s efi/vmlinuz-3.2.16-grsecgrsec $RPM_BUILD_ROOT/boot/
%else
%ifarch ppc64
cp vmlinux arch/powerpc/boot
cp arch/powerpc/boot/$KBUILD_IMAGE $RPM_BUILD_ROOT/boot/vmlinuz-3.2.16-grsecgrsec
%else
cp $KBUILD_IMAGE $RPM_BUILD_ROOT/boot/vmlinuz-3.2.16-grsecgrsec
%endif%endif                                                                                                                                                          [7/1117]
make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
cp System.map $RPM_BUILD_ROOT/boot/System.map-3.2.16-grsecgrsec
cp .config $RPM_BUILD_ROOT/boot/config-3.2.16-grsecgrsec
%ifnarch ppc64
cp vmlinux vmlinux.orig
bzip2 -9 vmlinux
mv vmlinux.bz2 $RPM_BUILD_ROOT/boot/vmlinux-3.2.16-grsecgrsec.bz2
mv vmlinux.orig vmlinux
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
%dir /lib/modules
/lib/modules/3.2.16-grsecgrsec
/lib/firmware
/boot/*

%files headers
%defattr (-, root, root)
/usr/include

From what I could gather, the $KERNELRELEASE variable is modified somewhere in the compile process. The actual parameters passed to rpmbuild could be found in my previous post.

Best Regards

markings 04-30-2012 03:06 PM

Hello,

YEAH!! After tirelessly spending 24 hours on this issue, I finally figured it out. Apparently $ROOT/include/package/mkspec never is executed while $ROOT/kernel.spec exists. Simply removing it and 'mkspec' will create a new spec with the proper values.

Best Regards

unSpawn 04-30-2012 03:17 PM

Well done figuring it out yourself!

//Please mark thread "solved", TIA.


All times are GMT -5. The time now is 04:27 AM.