개발

jackryu 2011. 5. 31. 22:39


EABI 관련 error 로 u-boot 가 compile 되지 않을 시..




NOTE: This page is kept only for historical purposes. 2007.2 already uses EABI by default.


This is an experiment on compiling the OpenMoko distribution for ARM EABI instaed of the old ABI.

Most of it is easy; you just have to change TARGET_OS from linux to linux-gnueabi. However, there's a small problem.

Contents

 [hide]

The problem: u-boot

u-boot does not compile with the EABI; in fact, it explicitly overrides the ABI. Simply disabling the override is not a good idea; it's there for a reason (probably because some functions are implemented directly in assembly, and need to explicitly be coded to correctly follow the chosen ABI).

The way I worked around this is by creating two cross-compilation toolchains; one for uboot, and one for everything else.

How to do it

I used a local overlay to do the compilation. This way, my changes do not get mixed with the upstream changes.

Configuration changes

The main configuration change is on distro/include/openmoko.inc, where you should change TARGET_OS from "linux" to "linux-gnueabi".

I also removed the three PREFERRED_PROVIDER for libc-for-gcc (under the comment # EABI stuff) and added a new one:

PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}libc-for-gcc:glibc-intermediate"

This one matches better the way the recipes are coded.

Bugfix

The uboot-gta01_svn.bb recipe hardcodes the name of the objcopy binary; the fix is on bug 647.

New packages

The alternate ABI cross compiler needs seven new packages, and a modified uboot-gta01 package.

These new packages are actually nothing more than small patches over the original packages; I symlinked the original packages from the original trees (with one special case: uboot-gta01_svn.bb was symlinked as uboot-gta01_svn.bb.inc so the new package would override the original one).

  • binutils/binutils-cross-uboot_2.17.50.0.5.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require binutils-cross_${PV}.bb
  • gcc/gcc-cross-initial-uboot_4.1.1.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require gcc-cross-initial_${PV}.bb
  • gcc/gcc-cross-uboot_4.1.1.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require gcc-cross_${PV}.bb
PACKAGES = ""

# Override the method from gcc-cross so we don't try to install libgcc
do_install () {
	oe_runmake 'DESTDIR=${D}' install
}
  • glibc/glibc-initial-uboot_2.5.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require glibc-initial_${PV}.bb
DEPENDS = "linux-libc-headers-uboot"
RDEPENDS_${PN}-dev = "linux-libc-headers-uboot-dev"
  • glibc/glibc-intermediate-uboot_2.5.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require glibc-intermediate_${PV}.bb
DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers-uboot"
RDEPENDS_${PN}-dev = "linux-libc-headers-uboot-dev"
  • glibc/glibc-uboot_2.5.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

require glibc_${PV}.bb
PACKAGES = ""
PROVIDES = "virtual/${TARGET_PREFIX}libc"
DEPENDS = "${@['virtual/${TARGET_PREFIX}gcc-initial', 'virtual/${TARGET_PREFIX}gcc']['nptl' in '${GLIBC_ADDONS}']} linux-libc-headers-uboot"
RDEPENDS_${PN}-dev = "linux-libc-headers-uboot-dev"
  • linux-libc-headers/linux-libc-headers-uboot_2.6.18.bb
# Override ABI
TARGET_OS = "linux"
HOST_OS = "linux"

FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/linux-libc-headers-${PV}"
require linux-libc-headers_${PV}.bb
  • uboot/uboot-gta01_svn.bb
# Do not use EABI
TARGET_OS = "linux"
HOST_OS = "linux"

require uboot-gta01_${PV}.bb.inc
INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}libc"

Other changes

At the same time, I also changed TARGET_ARCH to armv4t instead of arm, and TARGET_VENDOR to -openmoko. This requires several other patches (some recipes and packages do not know that armv4t implies arm), and is not needed to build with EABI.

Bulding with dash

Some other patches are needed to make the build work with dash. bug 646 is one of them; the other one (a similar problem on linux-libc-headers_2.6.18.bb) will be submitted to MokoMakefile later.

Does it work?

It seems to work correctly.

More information