[MeeGo-dev] [PATCH] Fix ARM N900 build

Roger Quadros roger.quadros at nokia.com
Tue Apr 20 05:57:13 CDT 2010


Hi,

It seems all_arch_configs is not set correctly for x86 builds.

in current kernel.spec, for x86,

	all_arch_configs is kernel-*.config

This is wrong as it will include non x86 configs too thus resulting in build 
failure.

One way to solve this is to rename all x86 based kernel configs to 
kernel-x86-*.config and use

	#define all_arch_configs kernel-x86-*.config

the other way is to remove non x86 configs when build is not x86. but this is a 
hack.

any better suggestions how to fix this?

cheers,
-roger

Quadros Roger (Nokia-D/Helsinki) wrote:
> Fixes OBS build for ARM N900. This will not affect existing
> x86 or x86_64 builds.
> 
> Signed-off-by: Roger Quadros <roger.quadros at nokia.com>
> ---
>  Makefile        |    5 ++++
>  Makefile.config |    9 ++-----
>  kernel.spec     |   63 ++++++++++++++++++++++++++++++++++-----------------
>  kernel.spec.in  |   67 ++++++++++++++++++++++++++++++++++++-------------------
>  makespec.pl     |    2 +-
>  5 files changed, 95 insertions(+), 51 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index ba92df0..d8deed5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -26,3 +26,8 @@ menlow: kernel.spec.in series makespec.pl
>         @touch MENLOW;
>         @perl makespec.pl < kernel.spec.in > kernel-menlow.spec ;
>         @rm MENLOW;
> +
> +n900: kernel.spec.in series makespec.pl
> +       @touch N900;
> +       @perl makespec.pl < kernel.spec.in > kernel-n900.spec ;
> +       @rm N900;
> diff --git a/Makefile.config b/Makefile.config
> index 27f8071..3cabb6a 100644
> --- a/Makefile.config
> +++ b/Makefile.config
> @@ -10,7 +10,7 @@ CONFIGFILES   = \
>         $(CFG)-shcdk.config \
>         $(CFG)-aava.config \
>         $(CFG)-ivi.config \
> -       $(CFG)-n900.config
> +       $(CFG)-arm-n900.config
> 
>  PLATFORMS      = x86
>  TEMPFILES      = $(addprefix temp-, $(addsuffix -generic, $(PLATFORMS)))
> @@ -39,8 +39,5 @@ kernel-shcdk.config: config-shcdk config-generic
>  kernel-aava.config: config-aava kernel-shcdk.config
>         perl merge.pl $^  > $@
> 
> -tmp-arm-config: config-arm-generic config-generic
> -       perl merge.pl $^  > $@
> -
> -kernel-n900.config: config-arm-n900 tmp-arm-config
> -       perl merge.pl $^  > $@
> +kernel-arm-n900.config: config-arm-n900
> +       cp $^ $@
> diff --git a/kernel.spec b/kernel.spec
> index a1dfb3b..a5c62fe 100644
> --- a/kernel.spec
> +++ b/kernel.spec
> @@ -60,7 +60,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
> 
>  %define all_x86 i386 i586 i686 %{ix86}
> 
> -%define all_arm arm armv5el
> +%define all_arm %{arm}
> 
>  # Overrides for generic default options
>  %define all_arch_configs kernel-*.config
> @@ -81,10 +81,10 @@ Summary: The Linux kernel (the core of the Linux operating system)
>  %endif
> 
>  %ifarch %{all_arm}
> -%define all_arch_configs kernel-*.config
> +%define all_arch_configs kernel-arm-*.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
> @@ -384,11 +384,18 @@ This package contains the kernel optimized for the Moorsetown platform for Aava
>  %description ivi
>  This package contains the kernel optimized for In Vehicle Infotainment segments
> 
> -%else
> +%endif
> +
> +%ifarch %{all_arm}
> +
> +#N900 ARM variant
>  %define variant_summary Kernel for the Nokia N900
> -%kernel_variant_package n900
> -%description n900
> +%kernel_variant_package arm-n900
> +%description arm-n900
>  This package contains the kernel optimized for the Nokia N900 device
> +
> +#Put other ARM variants here
> +
>  %endif
> 
> 
> @@ -676,13 +683,13 @@ for cfg in kernel-*.config; do
>  done
> 
>  # now run oldconfig over all the config files
> -for i in *.config
> +for i in %{all_arch_configs}
>  do
>    mv $i .config
>    Arch="x86"
> -  if [ `echo $i | grep -c n900` -eq 1 ]; then
> -       Arch="arm"
> -  fi
> +%ifarch %{all_arm}
> +    Arch="arm"
> +%endif
>    # make oldconfig > /dev/null
>    echo Doing $i
>    make ARCH=$Arch %{oldconfig_target} > /dev/null
> @@ -739,9 +746,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
> @@ -766,7 +770,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
>      #
> @@ -801,7 +807,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
> @@ -877,8 +888,10 @@ BuildKernel %make_target %kernel_image shcdk
>  BuildKernel %make_target %kernel_image aava
>  BuildKernel %make_target %kernel_image netbook
>  BuildKernel %make_target %kernel_image ivi
> -%else
> -BuildKernel %make_target %kernel_image n900
> +%endif
> +
> +%ifarch %all_arm
> +BuildKernel %make_target %kernel_image arm-n900
>  %endif
> 
>  cd tools/perf
> @@ -994,17 +1007,21 @@ fi}\
>  %kernel_variant_preun ivi
>  %kernel_variant_post -v ivi
> 
> -%else
> +%endif
> 
> -%kernel_variant_preun n900
> -%kernel_variant_post -v n900
> +%ifarch %{all_arm}
> +
> +%kernel_variant_preun arm-n900
> +%kernel_variant_post -v arm-n900
> 
>  %endif
> 
> +%ifnarch %{all_arm}
>  if [ -x /sbin/ldconfig ]
>  then
>      /sbin/ldconfig -X || exit $?
>  fi
> +%endif
> 
>  ###
>  ### file lists
> @@ -1034,7 +1051,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\
> @@ -1061,8 +1080,10 @@ fi
>  %kernel_variant_files 1 shcdk
>  %kernel_variant_files 1 aava
>  %kernel_variant_files 1 ivi
> -%else
> -%kernel_variant_files 1 n900
> +%endif
> +
> +%ifarch %{all_arm}
> +%kernel_variant_files 1 arm-n900
>  %endif
> 
> 
> diff --git a/kernel.spec.in b/kernel.spec.in
> index 9bdfc7f..daaea1b 100644
> --- a/kernel.spec.in
> +++ b/kernel.spec.in
> @@ -60,7 +60,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
> 
>  %define all_x86 i386 i586 i686 %{ix86}
> 
> -%define all_arm arm armv5el
> +%define all_arm %{arm}
> 
>  # Overrides for generic default options
>  %define all_arch_configs kernel-*.config
> @@ -81,10 +81,10 @@ Summary: The Linux kernel (the core of the Linux operating system)
>  %endif
> 
>  %ifarch %{all_arm}
> -%define all_arch_configs kernel-*.config
> +%define all_arch_configs kernel-arm-*.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 +246,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 arm-n900
> +@@N900 %description arm-n900
> +@@N900 This package contains the kernel optimized for the Nokia N900 device
> +
> +#Put other ARM variants here
> +
>  %endif
> 
> 
> @@ -336,13 +343,13 @@ for cfg in kernel-*.config; do
>  done
> 
>  # now run oldconfig over all the config files
> -for i in *.config
> +for i in %{all_arch_configs}
>  do
>    mv $i .config
>    Arch="x86"
> -  if [ `echo $i | grep -c n900` -eq 1 ]; then
> -       Arch="arm"
> -  fi
> +%ifarch %{all_arm}
> +    Arch="arm"
> +%endif
>    # make oldconfig > /dev/null
>    echo Doing $i
>    make ARCH=$Arch %{oldconfig_target} > /dev/null
> @@ -399,9 +406,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 +430,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 +467,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 +549,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 arm-n900
>  %endif
> 
>  cd tools/perf
> @@ -657,17 +670,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 arm-n900
> +@@N900 %kernel_variant_post -v arm-n900
> 
>  %endif
> 
> +%ifnarch %{all_arm}
>  if [ -x /sbin/ldconfig ]
>  then
>      /sbin/ldconfig -X || exit $?
>  fi
> +%endif
> 
>  ###
>  ### file lists
> @@ -697,7 +714,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 +744,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 arm-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;
>      }
> --
> 1.6.0.4
> 
> _______________________________________________
> MeeGo-dev mailing list
> MeeGo-dev at meego.com
> http://lists.meego.com/listinfo/meego-dev
> 



More information about the MeeGo-dev mailing list