LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-17-2014, 01:30 PM   #1
CWood
Member
 
Registered: Oct 2011
Distribution: Slackware
Posts: 45

Rep: Reputation: Disabled
Compiling Linux for ARM Embedded


Hi all,

First things first, sorry if this is in the wrong place. I couldn't find a forum on here that this question fits neatly into, so if the mods think it's in the wrong place, I apologize, and invite you to move it if you see fit.

With that out of the way, here's the problem: I'm trying to cross compile Linux 3.15.1 for ARM, as I am developing a new board. So far so good. I've built a cross-compiler, and associated toolchain, and I've installed U-boot mkimage. Great. I've configured the kernel, but when I try to build it, the compiler complains:

Code:
bash-4.2$ make bzImage
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
arm-none-eabi-gcc: error: unrecognized command line option '-m64'
arm-none-eabi-gcc: error: unrecognized command line option '-mno-mmx'
arm-none-eabi-gcc: error: unrecognized command line option '-mno-sse'
arm-none-eabi-gcc: error: unrecognized command line option '-mno-red-zone'
arm-none-eabi-gcc: error: unrecognized command line option '-mcmodel=kernel'
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
Clearly, this is due to the fact that the kernel makefile is trying to build for the x86 architecture, however, I am unaware of how to change the target to 32 bit ARM. Several hours of Googling seems to indicate that I need a patch for the kernel when cross-compiling. As to the accuracy and releventness of this I'm not too sure, as the only instructions I could find were pertaining to the 2.6 line of kernels.

As such, my question is this: Do I need to find an ARM patch, and if so, where can I find one for 3.15.1? If not, how do I retarget the compilation scripts to ARM 32-bit, to kill these errors so I can get an image booting?

Thanks in advance, and let me know if there's any more information I've left out
Connor
 
Old 06-17-2014, 09:40 PM   #2
purevw
Member
 
Registered: Jan 2007
Location: Texas
Distribution: OpenSuSE Tumbleweed, Kernel 4.14*
Posts: 137

Rep: Reputation: 52
Here is the Repo for openSUSE's kernel-source-3.15 for ARM architecture. Remember that ARM has different structures. I believe this repo is for ARM7. I mostly mess with Raspberry Pi. I've got openSUSE 13.1 working with desktop, but it's sure not fast. Anyway, here's the URL: openSUSE ARM kernel-source
 
Old 06-18-2014, 03:59 AM   #3
lazac
LQ Newbie
 
Registered: Mar 2010
Location: Budapest
Distribution: Debian
Posts: 8

Rep: Reputation: 0
Maybe some further parameters have to be added to the 'make' command. Check 'Makefile' in the kernel source root directory, it should give some instructions for the required extra parameters. For example (at least for 2.6.xxx kernels), "ARCH=xxx" parameter has to be supplied, unless ARCH is not set in the environment.
 
Old 06-18-2014, 05:42 AM   #4
bdd
LQ Newbie
 
Registered: Dec 2010
Posts: 5

Rep: Reputation: 0
This is a snippet of my Makefile

make -j5 \
CONFIG_DEBUG_SECTION_MISMATCH=y \
CROSS_COMPILE=$(TARGET)- ARCH=$(ARCH) \
KALLSYMS_EXTRA_PASS=1 \
LOADADDR=0x80008000 \
$(KERNEL_IMAGE) modules && \
make $(VERBOSITY) INSTALL_MOD_PATH=$(TARGETFS) \
CONFIG_DEBUG_SECTION_MISMATCH=y \
CROSS_COMPILE=$(TARGET)- ARCH=$(ARCH) \
DEPMOD=$(TARGET)/sbin/$(TARGET)-depmod \
modules_install

where
TARGET=arm-cortex_a8-linux-gnueabi
ARCH=arm
KERNEL_IMAGE=zImage
TARGETGS is where you are building your root file system
 
Old 06-22-2014, 03:57 AM   #5
su_seven
LQ Newbie
 
Registered: Jun 2014
Posts: 4

Rep: Reputation: Disabled
Do you have change the Makefile ?


this is my Makefile:

export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
 
Old 06-22-2014, 03:59 AM   #6
su_seven
LQ Newbie
 
Registered: Jun 2014
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by lazac View Post
Maybe some further parameters have to be added to the 'make' command. Check 'Makefile' in the kernel source root directory, it should give some instructions for the required extra parameters. For example (at least for 2.6.xxx kernels), "ARCH=xxx" parameter has to be supplied, unless ARCH is not set in the environment.
do you have success in compiling Linux for ARM Embedded (2.6.xxx kernels)???
 
Old 06-23-2014, 05:08 AM   #7
bdd
LQ Newbie
 
Registered: Dec 2010
Posts: 5

Rep: Reputation: 0
At the top of my Makefile is
include config.mk
That file specifies the details:
export SHELL=/bin/bash
export ARCH=arm
export BUILDARCH:=$(shell uname -m)
export TARGET=arm-cortex_a8-linux-gnueabi
export CROSS_COMPILE=$(TARGET)-

export KERNEL_VERSION=3.13.2

The only other piece is TARGETFS which contains the root of your target file system. Mine is similar to
~/$(TARGET)/$(TARGET)/sysroot
as I am using crosstool-ng
 
Old 06-23-2014, 10:57 AM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Also make sure that the .config has the arch set to arm. Should be within the first ten-ish lines of the .config file. With make menuconfig to change it. Or xconfig, and many other variants.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling hello world C program for arm ARM926EJ-S rev 5 (v5l) with arm-linux-gnueabi golden_boy615 Linux - Embedded & Single-board computer 2 04-23-2013 10:30 AM
Embedded arm compiling troubles mikymisho Linux - Embedded & Single-board computer 2 05-28-2011 05:08 PM
Compiling debian arm for NSLU2 - arm-linux-gnueabi-objdump not found ergosteur Linux - Kernel 3 10-30-2010 11:24 AM
Compiling for embedded arm linux mvhurlburt Linux - Embedded & Single-board computer 1 06-16-2009 09:06 AM
embedded linux on ARM audiogreenie Linux - Embedded & Single-board computer 1 02-02-2009 11:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration