Fixes OBS build for ARM N900. This will not affect existing
x86 or x86_64 builds.
v2:
- ensures 'make nonint_oldconfig' is run for all variants during build.
Signed-off-by: Roger Quadros <[email protected]>
---
kernel.spec.in | 79 ++++++++++++++++++++++++++++++++------------------------
makespec.pl | 2 +-
2 files changed, 46 insertions(+), 35 deletions(-)
diff --git a/kernel.spec.in b/kernel.spec.in
index 9bdfc7f..bef1c60 100644
--- a/kernel.spec.in
+++ b/kernel.spec.in
@@ -60,31 +60,25 @@ Summary: The Linux kernel (the core of the Linux operating
system)
%define all_x86 i386 i586 i686 %{ix86}
-%define all_arm arm armv5el
-
-# Overrides for generic default options
-%define all_arch_configs kernel-*.config
+%define all_arm %{arm}
# Per-arch tweaks
%ifarch %{all_x86}
-%define all_arch_configs kernel-*.config
%define image_install_path boot
%define hdrarch i386
%define kernel_image arch/x86/boot/bzImage
%endif
%ifarch x86_64
-%define all_arch_configs kernel-%{version}-x86_64*.config
%define image_install_path boot
%define kernel_image arch/x86/boot/bzImage
%endif
%ifarch %{all_arm}
-%define all_arch_configs kernel-*.config
%define image_install_path boot
-%define kernel_image vmlinux
-%define make_target vmlinux
+%define kernel_image arch/arm/boot/zImage
+%define make_target zImage
%endif
%define oldconfig_target nonint_oldconfig
@@ -246,11 +240,18 @@ This package contains the kernel optimized for the Menlow
platform
%description ivi
This package contains the kernel optimized for In Vehicle Infotainment segments
-%else
-%define variant_summary Kernel for the Nokia N900
-%kernel_variant_package n900
-%description n900
-This package contains the kernel optimized for the Nokia N900 device
+%endif
+
+%ifarch %{all_arm}
+
+@@N900 #N900 ARM variant
+@@N900 %define variant_summary Kernel for the Nokia N900
+@@N900 %kernel_variant_package n900
+@@N900 %description n900
+@@N900 This package contains the kernel optimized for the Nokia N900 device
+
+#Put other ARM variants here
+
%endif
@@ -328,21 +329,17 @@ cp %{SOURCE10} Documentation/
mkdir configs
-# Remove configs not for the buildarch
-for cfg in kernel-*.config; do
- if [ `echo %{all_arch_configs} | grep -c $cfg` -eq 0 ]; then
- rm -f $cfg
- fi
-done
-
# now run oldconfig over all the config files
-for i in *.config
+for i in kernel-*.config
do
mv $i .config
Arch="x86"
- if [ `echo $i | grep -c n900` -eq 1 ]; then
- Arch="arm"
+
+ #get ARCH from .config file for other platforms
+ if [ `cat .config | grep -c CONFIG_ARM=y` -eq 1 ]; then
+ Arch="arm"
fi
+
# make oldconfig > /dev/null
echo Doing $i
make ARCH=$Arch %{oldconfig_target} > /dev/null
@@ -399,9 +396,6 @@ BuildKernel() {
cp configs/$Config .config
Arch="x86"
- if [ `echo $Config | grep -c n900` -eq 1 ]; then
- Arch="arm"
- fi
%ifarch %{all_arm}
Arch="arm"
%endif
@@ -426,7 +420,9 @@ BuildKernel() {
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install
KERNELRELEASE=$KernelVer
+%ifnarch %{all_arm}
make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install
KERNELRELEASE=$KernelVer
+%endif
# And save the headers/makefiles etc for building modules against
#
@@ -461,7 +457,12 @@ BuildKernel() {
fi
rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
+%ifarch %{all_x86}
cp -a --parents arch/x86/include
$RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+%endif
+%ifarch %{all_arm}
+ cp -a --parents arch/arm/include
$RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+%endif
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
cd include
cp -a acpi asm-generic config crypto drm generated keys linux math-emu
media mtd net pcmcia rdma rxrpc scsi sound video trace
$RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
@@ -538,8 +539,10 @@ cd linux-%{kversion}
@@N BuildKernel %make_target %kernel_image netbook
@@W BuildKernel %make_target %kernel_image menlow
@@I BuildKernel %make_target %kernel_image ivi
-%else
-@@A BuildKernel %make_target %kernel_image n900
+%endif
+
+%ifarch %all_arm
+@@N900 BuildKernel %make_target %kernel_image n900
%endif
cd tools/perf
@@ -657,17 +660,21 @@ fi}\
@@I %kernel_variant_preun ivi
@@I %kernel_variant_post -v ivi
-%else
+%endif
-@@A %kernel_variant_preun n900
-@@A %kernel_variant_post -v n900
+%ifarch %{all_arm}
+
+@@N900 %kernel_variant_preun n900
+@@N900 %kernel_variant_post -v n900
%endif
+%ifnarch %{all_arm}
if [ -x /sbin/ldconfig ]
then
/sbin/ldconfig -X || exit $?
fi
+%endif
###
### file lists
@@ -697,7 +704,9 @@ fi
/lib/modules/%{KVERREL}%{?2:-%{2}}/kernel\
/lib/modules/%{KVERREL}%{?2:-%{2}}/build\
/lib/modules/%{KVERREL}%{?2:-%{2}}/source\
+%ifnarch %{all_arm}\
/lib/modules/%{KVERREL}%{?2:-%{2}}/vdso\
+%endif\
/lib/modules/%{KVERREL}%{?2:-%{2}}/modules.block\
/lib/modules/%{KVERREL}%{?2:-%{2}}/modules.dep.bin\
/lib/modules/%{KVERREL}%{?2:-%{2}}/modules.alias.bin\
@@ -725,8 +734,10 @@ fi
@@M %kernel_variant_files 1 shcdk
@@M %kernel_variant_files 1 aava
@@I %kernel_variant_files 1 ivi
-%else
-@@A %kernel_variant_files 1 n900
+%endif
+
+%ifarch %{all_arm}
+@@N900 %kernel_variant_files 1 n900
%endif
diff --git a/makespec.pl b/makespec.pl
index 79cb8d6..5c432fb 100644
--- a/makespec.pl
+++ b/makespec.pl
@@ -107,7 +107,7 @@ while (<>) {
print "$1\n";
next;
}
- if ($want_n900 > 0 && $line =~ /\...@\@A (.*)/) {
+ if ($want_n900 > 0 && $line =~ /\...@\@N900 (.*)/) {
print "$1\n";
next;
}