error in cross-compiling for armv7

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

error in cross-compiling for armv7

eaton.chiou
Hi, there,
  Now I am working on cross-compiling v5.9 for armv7. What I have done is as following.
  1. download source code of v5.9
      # cvs -qd anoncvs@anoncvs4.usa.openbsd.org:/cvs checkout -rOPENBSD_5_9 -P /usr/src
  2. make cross-compiling tool-chain
      # cd /usr/src
      # make KERBEROS=no TARGET=armv7 cross-tools
    after it's done, a new folder is created under /usr/cross
      # cd /usr/cross
      # ls -al
      total 12
      drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 .
      drwxr-xr-x  17 root  wheel  512 Jul 26 01:06 ..
      drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 armv7
      # ls -al armv7
      total 64
      drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 .
      drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 ..
      -rw-r--r--   1 root  wheel    0 Jul 26 01:08 .binutils_done
      -rw-r--r--   1 root  wheel    0 Jul 26 01:06 .dirs_done
      -rw-r--r--   1 root  wheel    0 Jul 26 01:13 .gcc_done
      -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .includes_done
      -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .obj_done
      -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_ARCH
      -rw-r--r--   1 root  wheel   23 Jul 26 01:06 TARGET_CANON
      -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_CPU
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 altroot
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 bin
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 dev
      drwxr-xr-x  20 root  wheel  512 Jul 26 01:06 etc
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 home
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 mnt
      drwx------   2 root  wheel  512 Jul 26 01:06 root
      drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 sbin
      lrwxr-xr-x   1 root  wheel   11 Jul 26 01:06 sys -> usr/src/sys
      drwxrwxrwt   2 root  wheel  512 Jul 26 01:06 tmp
      drwxr-xr-x  16 root  wheel  512 Jul 26 01:06 usr
      drwxr-xr-x  21 root  wheel  512 Jul 26 01:06 var  
  3. compile kernel for armv7
      # cd /usr/src/sys/arch/armv7/config
      # cd config RAMDISK
      # cd ../compile/RAMDISK
      # make clean; make
      cat ../../../../arch/arm/arm/genassym.cf ../../../../arch/armv7/armv7/genassym.cf |  sh ../../../../kern/genassym.sh cc  -Werror -Wall -Wimplicit-function-declaration  -Wno-main -Wno-uninitialized  -Wframe-larger-than=2047 -ffreestanding -msoft-float -march=armv6 -Wa,-march=armv7a -fno-builtin-printf -fno-builtin-snprintf  -fno-builtin-vsnprintf -fno-builtin-log  -fno-builtin-log2 -fno-builtin-malloc -fno-pie -fno-stack-protector -O2 -pipe -nostdinc -I../../../.. -I. -I../../../../arch -DCPU_ARMv7 -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DMINIROOTSIZE="0x2800" -DRAMDISK_HOOKS -DFFS -DMSDOSFS -DINET6 -DEXT2FS -DUSBVERBOSE -DMAXUSERS=4 -D_KERNEL -D__armv7__ -MD -MP -MF assym.P > assym.h.tmp
      /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -march= switch
      /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -mtune= switch
      *** Error 1 in /usr/src/sys/arch/armv7/compile/RAMDISK (Makefile:439 'assym.h')
 
  I don't really know what's going on. Is there a step-by-step procedure of how to make a kernel for armv7 or give me a hand upon this error?

  Thx.

Regards,
Eaton

Reply | Threaded
Open this post in threaded view
|

Re: error in cross-compiling for armv7

Patrick Wildt-3
On Mon, Jul 25, 2016 at 10:52:46PM -0700, eaton.chiou wrote:

> Hi, there,
>   Now I am working on cross-compiling v5.9 for armv7. What I have done is as
> following.
>   1. download source code of v5.9
>       # cvs -qd [hidden email]:/cvs checkout -rOPENBSD_5_9
> -P /usr/src
>   2. make cross-compiling tool-chain
>       # cd /usr/src
>       # make KERBEROS=no TARGET=armv7 cross-tools
>     after it's done, a new folder is created under /usr/cross
>       # cd /usr/cross
>       # ls -al
>       total 12
>       drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 .
>       drwxr-xr-x  17 root  wheel  512 Jul 26 01:06 ..
>       drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 armv7
>       # ls -al armv7
>       total 64
>       drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 .
>       drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 ..
>       -rw-r--r--   1 root  wheel    0 Jul 26 01:08 .binutils_done
>       -rw-r--r--   1 root  wheel    0 Jul 26 01:06 .dirs_done
>       -rw-r--r--   1 root  wheel    0 Jul 26 01:13 .gcc_done
>       -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .includes_done
>       -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .obj_done
>       -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_ARCH
>       -rw-r--r--   1 root  wheel   23 Jul 26 01:06 TARGET_CANON
>       -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_CPU
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 altroot
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 bin
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 dev
>       drwxr-xr-x  20 root  wheel  512 Jul 26 01:06 etc
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 home
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 mnt
>       drwx------   2 root  wheel  512 Jul 26 01:06 root
>       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 sbin
>       lrwxr-xr-x   1 root  wheel   11 Jul 26 01:06 sys -> usr/src/sys
>       drwxrwxrwt   2 root  wheel  512 Jul 26 01:06 tmp
>       drwxr-xr-x  16 root  wheel  512 Jul 26 01:06 usr
>       drwxr-xr-x  21 root  wheel  512 Jul 26 01:06 var  
>   3. compile kernel for armv7
>       # cd /usr/src/sys/arch/armv7/config
>       # cd config RAMDISK
>       # cd ../compile/RAMDISK
>       # make clean; make
>       cat ../../../../arch/arm/arm/genassym.cf
> ../../../../arch/armv7/armv7/genassym.cf |  sh ../../../../kern/genassym.sh
> cc  -Werror -Wall -Wimplicit-function-declaration  -Wno-main
> -Wno-uninitialized  -Wframe-larger-than=2047 -ffreestanding -msoft-float
> -march=armv6 -Wa,-march=armv7a -fno-builtin-printf -fno-builtin-snprintf
> -fno-builtin-vsnprintf -fno-builtin-log  -fno-builtin-log2
> -fno-builtin-malloc -fno-pie -fno-stack-protector -O2 -pipe -nostdinc
> -I../../../.. -I. -I../../../../arch -DCPU_ARMv7 -DTIMEZONE="0" -DDST="0"
> -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DMINIROOTSIZE="0x2800"
> -DRAMDISK_HOOKS -DFFS -DMSDOSFS -DINET6 -DEXT2FS -DUSBVERBOSE -DMAXUSERS=4
> -D_KERNEL -D__armv7__ -MD -MP -MF assym.P > assym.h.tmp
>       /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -march=
> switch
>       /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -mtune=
> switch
>       *** Error 1 in /usr/src/sys/arch/armv7/compile/RAMDISK (Makefile:439
> 'assym.h')
>  
>   I don't really know what's going on. Is there a step-by-step procedure of
> how to make a kernel for armv7 or give me a hand upon this error?
>
>   Thx.
>
> Regards,
> Eaton
>
>
>
>
>
> --
> View this message in context: http://openbsd-archive.7691.n7.nabble.com/error-in-cross-compiling-for-armv7-tp300810.html
> Sent from the openbsd port - arm mailing list archive at Nabble.com.
>

That is because make config and make will not cross compile without
further options.  Instead it will try to compile armv7 with the amd64
compiler.

To cross-compile, I have a simple make wrapper.  Then you can run
"armmake config" and "armmake bsd" for the kernel: http://ix.io/17Aq

Reply | Threaded
Open this post in threaded view
|

Re: error in cross-compiling for armv7

Artturi Alm
On Tue, Jul 26, 2016 at 02:53:17PM +0200, Patrick Wildt wrote:

> On Mon, Jul 25, 2016 at 10:52:46PM -0700, eaton.chiou wrote:
> > Hi, there,
> >   Now I am working on cross-compiling v5.9 for armv7. What I have done is as
> > following.
> >   1. download source code of v5.9
> >       # cvs -qd [hidden email]:/cvs checkout -rOPENBSD_5_9
> > -P /usr/src
> >   2. make cross-compiling tool-chain
> >       # cd /usr/src
> >       # make KERBEROS=no TARGET=armv7 cross-tools
> >     after it's done, a new folder is created under /usr/cross
> >       # cd /usr/cross
> >       # ls -al
> >       total 12
> >       drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 .
> >       drwxr-xr-x  17 root  wheel  512 Jul 26 01:06 ..
> >       drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 armv7
> >       # ls -al armv7
> >       total 64
> >       drwxr-xr-x  13 root  wheel  512 Jul 26 01:13 .
> >       drwxr-xr-x   3 root  wheel  512 Jul 26 01:06 ..
> >       -rw-r--r--   1 root  wheel    0 Jul 26 01:08 .binutils_done
> >       -rw-r--r--   1 root  wheel    0 Jul 26 01:06 .dirs_done
> >       -rw-r--r--   1 root  wheel    0 Jul 26 01:13 .gcc_done
> >       -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .includes_done
> >       -rw-r--r--   1 root  wheel    0 Jul 26 01:07 .obj_done
> >       -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_ARCH
> >       -rw-r--r--   1 root  wheel   23 Jul 26 01:06 TARGET_CANON
> >       -rw-r--r--   1 root  wheel    4 Jul 26 01:06 TARGET_CPU
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 altroot
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 bin
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 dev
> >       drwxr-xr-x  20 root  wheel  512 Jul 26 01:06 etc
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 home
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 mnt
> >       drwx------   2 root  wheel  512 Jul 26 01:06 root
> >       drwxr-xr-x   2 root  wheel  512 Jul 26 01:06 sbin
> >       lrwxr-xr-x   1 root  wheel   11 Jul 26 01:06 sys -> usr/src/sys
> >       drwxrwxrwt   2 root  wheel  512 Jul 26 01:06 tmp
> >       drwxr-xr-x  16 root  wheel  512 Jul 26 01:06 usr
> >       drwxr-xr-x  21 root  wheel  512 Jul 26 01:06 var  
> >   3. compile kernel for armv7
> >       # cd /usr/src/sys/arch/armv7/config
> >       # cd config RAMDISK
> >       # cd ../compile/RAMDISK
> >       # make clean; make
> >       cat ../../../../arch/arm/arm/genassym.cf
> > ../../../../arch/armv7/armv7/genassym.cf |  sh ../../../../kern/genassym.sh
> > cc  -Werror -Wall -Wimplicit-function-declaration  -Wno-main
> > -Wno-uninitialized  -Wframe-larger-than=2047 -ffreestanding -msoft-float
> > -march=armv6 -Wa,-march=armv7a -fno-builtin-printf -fno-builtin-snprintf
> > -fno-builtin-vsnprintf -fno-builtin-log  -fno-builtin-log2
> > -fno-builtin-malloc -fno-pie -fno-stack-protector -O2 -pipe -nostdinc
> > -I../../../.. -I. -I../../../../arch -DCPU_ARMv7 -DTIMEZONE="0" -DDST="0"
> > -DSMALL_KERNEL -DNO_PROPOLICE -DBOOT_CONFIG -DMINIROOTSIZE="0x2800"
> > -DRAMDISK_HOOKS -DFFS -DMSDOSFS -DINET6 -DEXT2FS -DUSBVERBOSE -DMAXUSERS=4
> > -D_KERNEL -D__armv7__ -MD -MP -MF assym.P > assym.h.tmp
> >       /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -march=
> > switch
> >       /tmp/genassym_c.R4x0nKBJBy:1: error: bad value (armv6) for -mtune=
> > switch
> >       *** Error 1 in /usr/src/sys/arch/armv7/compile/RAMDISK (Makefile:439
> > 'assym.h')
> >  
> >   I don't really know what's going on. Is there a step-by-step procedure of
> > how to make a kernel for armv7 or give me a hand upon this error?
> >
> >   Thx.
> >
> > Regards,
> > Eaton
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://openbsd-archive.7691.n7.nabble.com/error-in-cross-compiling-for-armv7-tp300810.html
> > Sent from the openbsd port - arm mailing list archive at Nabble.com.
> >
>
> That is because make config and make will not cross compile without
> further options.  Instead it will try to compile armv7 with the amd64
> compiler.
>
> To cross-compile, I have a simple make wrapper.  Then you can run
> "armmake config" and "armmake bsd" for the kernel: http://ix.io/17Aq
>

There's also cross-env target, that might be of use.

-Artturi

Reply | Threaded
Open this post in threaded view
|

Re: error in cross-compiling for armv7

eaton.chiou
In reply to this post by Patrick Wildt-3
Yap, you are right. And thanks for the wrapper.