6

Trying to compile Linux kernel for arm platform on a Ubuntu virtual machine

$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

It fails as follows

arm-none-linux-gnueabi-gcc: not found

Tried to install

$sudo apt-get install arm-none-linux-gnueabi-gcc

E: unable to locate package arm-none-linux-gnueabi-gcc

Where to find the correct package? how to include it in the system? (I found a couple of links on line that didn't work for me). It would be great if you could provide a correct solution or reference.

codey modey
  • 983
  • 2
  • 10
  • 23

2 Answers2

6

The Ubuntu package names are gcc-arm-linux-gnueabi/gcc-arm-linux-gnueabihf.

For building the kernel, which one you use does not make much difference. For building anything else, "gnueabihf" is the hard-float version. For any modern ARM processor (this statement excludes the Raspberry PI), this is the one you would want.

unixsmurf
  • 5,852
  • 1
  • 33
  • 40
  • Unable to locate the pacakges mentioned above arm-linux-gnuabihf-gcc – codey modey Mar 08 '14 at 21:09
  • Sorry, I keep getting confused by how they reverse the order - it's http://packages.ubuntu.com/search?keywords=gcc-arm-linux-gnueabihf. – unixsmurf Mar 08 '14 at 21:31
  • I need to use following command to cross compile..but this doesn't works yet..make menuconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- – codey modey Mar 09 '14 at 08:16
  • 2
    No, you would of course need to adjust your command line to the binary names installed: arm-linux-gnueabihf- instead of arm-none-linux-gnueabi- – unixsmurf Mar 10 '14 at 21:26
  • gcc-arm-linux-gnueabihf is not enough to compile kernel for aarch64. the process will fail with the error: "linux kernel unknown type name __uint128_t" – Oleg Kokorin Jul 18 '20 at 19:01
  • @OlegKokorin that is correct, aarch64 is compiled using a different toolchain. You'll want gcc-aarch64-linux-gnu. – unixsmurf Jul 20 '20 at 18:04
5
  1. Download arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 from https://sourcery.mentor.com/GNUToolchain/

    or https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?@template=lite

    Get correct version of the arm-none-linux-gnueabi toolchain (i.e. targetting GNU/Linux rather than EABI).

  2. untar it

    tar xvf arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
    
  3. open bashrc

    vi .bashrc
    

    at the end add below comand

    export PATH=$PATH:{path to toolchain}arm-2013.05/bin
    

    e.g export PATH=$PATH:/home/vinay/under_linux/arm-2013.05/bin

    save it and quit the terminal.

then you can cross-compile without everytime export.

Also take of correct toolchain there are two toolchain available choose according to your requirement.

Cross compile error "arm-none-eabi-g++ cannot find entry symbol"

Community
  • 1
  • 1
vinay hunachyal
  • 3,781
  • 2
  • 20
  • 31