Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2015-05-01 21:33:12
Size: 4449
Editor: YunQiangSu
Comment:
Revision 3 as of 2015-05-01 21:50:42
Size: 4635
Editor: YunQiangSu
Comment:
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
STEP 0 preparation
=
STEP 0 preparation =
Line 16: Line 17:
Line 17: Line 19:
Line 18: Line 21:
Line 19: Line 23:
Line 20: Line 25:
Line 21: Line 27:
Line 25: Line 32:
STEP 1 build gcc stage1 = STEP 1 build gcc stage1 =
Line 28: Line 35:
Line 31: Line 39:
Line 34: Line 43:
if you need gnat support, you'd wish add some other patches from:
BUG:#782257 #783372

  
if you need gnat support, you'd wish add some other patches from:
  BUG:#782257 #783372
Line 38: Line 48:
patch -p1 < /tmp/0001-version.patch
patch -p1 < /tmp/0002-control.patch
patch -p1 < /tmp/0003-patch.patch
Line 42: Line 49:
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0001-gcc_cross_multiarch.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0002-allow-no-biarch.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0003-gxx-crossbase-substvar.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0004-reverted-removal-of-with_deps_on_target_arch_pkgs-in.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0005-Allow-target-selection-via-dpkg-buildpackage-target-.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0006-fix-with_deps_on_target_arch_pkgs-yes-DEB_STAGE-stag.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0007-Skip-libjit-when-we-re-cross-building.patch
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0008-g-include-directories-functional-again.patch
  patch -p1 < /tmp/0001-version.patch

  patch -p1 < /tmp/0002-control.patch

  patch -p1 < /tmp/0003-patch.patch



  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0001-gcc_cross_multiarch.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0002-allow-no-biarch.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0003-gxx-crossbase-substvar.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0004-reverted-removal-of-with_deps_on_target_arch_pkgs-in.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0005-Allow-target-selection-via-dpkg-buildpackage-target-.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0006-fix-with_deps_on_target_arch_pkgs-yes-DEB_STAGE-stag.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0007-Skip-libjit-when-we-re-cross-building.patch

  
patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0008-g-include-directories-functional-again.patch
Line 53: Line 76:
   due to libgnatprj depends on gmp.h, which can only be built when gcc is ready.     due to libgnatprj depends on gmp.h, which can only be built when gcc is ready.

Line 56: Line 81:
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ \
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 \
DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage1 dpkg-buildpackage \
 
--target-arch=mips64el -b -uc -us -d

 
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1
DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage1 dpkg-buildpackage --target-arch=mips64el -b -uc -us -d
Line 63: Line 88:
cpp-5-mips64el-linux-gnuabi64
gcc-5-multilib-mips64el-linux-gnuabi64
libgcc-5-dev
gcc-5-mips64el-linux-gnuabi64
lib32gcc-5-dev
libn32gcc-5-dev
Line 70: Line 89:
dpkg --force-all -i ../*.deb
    --force-all as we have not gcc-5-base:mips64el yet.
    cpp-5-mips64el-linux-gnuabi64
    gcc-5-multilib-mips64el-linux-gnuabi64
    libgcc-5-dev
    gcc-5-mips64el-linux-gnuabi64
    lib32gcc-5-dev
    libn32gcc-5-dev
Line 74: Line 97:
STEP 2 build linux-libc-dev
 dpkg --force-all -i ../*.deb
     -force-all as we have not gcc-5-base:mips64el yet.


= STEP 2 build linux-libc-dev =
Line 77: Line 105:
Line 78: Line 107:
Line 82: Line 112:
= STEP 3 glibc stage1 =
Line 83: Line 114:
STEP 3 glibc stage1
Line 85: Line 115:

patch the source with patch from BUG:#773300
  patch the source with patch from BUG:#773300
Line 89: Line 118:
DEB_STAGE=stage1 DEB_GCC_VERSION=-5 dpkg-buildpackage -B -amips64el -d   DEB_STAGE=stage1 DEB_GCC_VERSION=-5 dpkg-buildpackage -B -amips64el -d
Line 91: Line 121:

--force-all as we have not libgcc1:mips64el yet.
   --force-all as we have not libgcc1:mips64el yet.
Line 95: Line 124:
STEP 4 gcc stage2 = STEP 4 gcc stage2 =
on the same source with stage1 gcc.
  with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1
DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage2 dpkg-buildpackage
--target-arch=mips64el -b -uc -us -d
Line 97: Line 131:
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ \
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 \
DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage2 dpkg-buildpackage \
  --target-arch=mips64el -b -uc -us -d
Line 102: Line 132:
on the same source with stage1 gcc.
Line 105: Line 134:
cpp-5-mips64el-linux-gnuabi64
lib32gcc-4.9-dev
libgcc1-dbg
libn32gcc1
gcc-5-base
lib32gcc1-dbg
libgcc1
gcc-5-mips64el-linux-gnuabi64
lib32gcc1
libn32gcc-4.9-dev
gcc-5-multilib-mips64el-linux-gnuabi64
libgcc-5-dev
libn32gcc1-dbg

  
cpp-5-mips64el-linux-gnuabi64

  
lib32gcc-4.9-dev

  libgcc1-dbg

  libn32gcc1
  
  gcc-5-base
  
  lib32gcc1-dbg

  libgcc1

  
gcc-5-mips64el-linux-gnuabi64

  lib32gcc1
  
  
libn32gcc-4.9-dev
     gcc-5-multilib-mips64el-linux-gnuabi64

  
libgcc-5-dev

  libn32gcc1-dbg
Line 121: Line 163:
dpkg -i ../*.deb   dpkg -i ../*.deb
Line 124: Line 166:
STEP 5 glibc stage2 = STEP 5 glibc stage2 =
Line 126: Line 169:
Line 128: Line 172:
dpkg -i ../libc6_2.19-13_mips64el.deb ../libc6-dev_2.19-13_mips64el.deb dpkg -i ../libc6_*_mips64el.deb ../libc6-dev_*_mips64el.deb
Line 132: Line 176:
STEP 6 gcc stage3 = STEP 6 gcc stage3 =
Line 134: Line 178:
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/  \
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1  \
DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage \
  
--target-arch=mips64el -b -uc -us -d
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1
DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d
Line 139: Line 182:
STEP 7 gmp/selinux = STEP 7 gmp/selinux =
Line 142: Line 186:
STEP 8 gcc with gnat support = STEP 8 gcc with gnat support =
Line 145: Line 189:
with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/  \
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1  \
DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage  \
  
--target-arch=mips64el -b -uc -us -d

with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/
BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1
DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

This page shows how to bootstrap a multiarch cross toolchain.

Multiarch-Cross-Toolchain, aka as known as Wookey's way, just lke cross-gcc does.

It has pacakges like gcc-<VERSION>-<TRIPLET>, it dpends on

  • libc6-dev:<TARGET> libgcc-<VERSION>-dev:<TARGET>

  • etc.

This also shows how to bootstrap for a new architecture.

STEP 0 preparation

sudo debootstrap sid sid-chroot

sudo pbuilder login --no-targz --buildplace sid-chroot

sed -i ’s/^deb http/deb [arch=amd64] http/‘ /etc/apt/sources.list

echo “deb-src http://ftp.us.debian.org/debian sid main” >> /etc/apt/sources.list

dpkg --add-architecture mips64el

apt-get update

apt-get install binutils-mips64el-linux-gnuabi64 devscripts rdfind symlinks

STEP 1 build gcc stage1

apt-get build-dep gcc-5

apt-get purge libx32* libc6-i386 libc6-x32 # they conflicts with mips64el multilib packages

apt-get source gcc-5

apt-get install cross-gcc-dev

  • if you need gnat support, you'd wish add some other patches from:

    BUG:#782257 #783372

cd gcc-5-*;

  • patch -p1 < /tmp/0001-version.patch

    patch -p1 < /tmp/0002-control.patch

    patch -p1 < /tmp/0003-patch.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0001-gcc_cross_multiarch.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0002-allow-no-biarch.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0003-gxx-crossbase-substvar.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0004-reverted-removal-of-with_deps_on_target_arch_pkgs-in.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0005-Allow-target-selection-via-dpkg-buildpackage-target-.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0006-fix-with_deps_on_target_arch_pkgs-yes-DEB_STAGE-stag.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0007-Skip-libjit-when-we-re-cross-building.patch

    patch -p1 < /usr/share/cross-gcc/patches/gcc-5/0008-g-include-directories-functional-again.patch

sed -i '/^ada_no_cross/c ada_no_cross := yes' debian/rules.defs

  • due to libgnatprj depends on gmp.h, which can only be built when gcc is ready.

Then run:

  • with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/

BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage1 dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

We can get these deb files:

  • cpp-5-mips64el-linux-gnuabi64 gcc-5-multilib-mips64el-linux-gnuabi64 libgcc-5-dev gcc-5-mips64el-linux-gnuabi64 lib32gcc-5-dev libn32gcc-5-dev
  • dpkg --force-all -i ../*.deb
    • -force-all as we have not gcc-5-base:mips64el yet.

STEP 2 build linux-libc-dev

apt-get source linux; cd linux-*

make -f debian/rules.gen binary-libc-dev_mips64el

dpkg -i ../linux-libc-dev*.deb

STEP 3 glibc stage1

apt-get source glibc; cd glibc-*

  • patch the source with patch from BUG:#773300

Then run

  • DEB_STAGE=stage1 DEB_GCC_VERSION=-5 dpkg-buildpackage -B -amips64el -d

dpkg --force-all -i ../libc6*.deb

  • --force-all as we have not libgcc1:mips64el yet.

STEP 4 gcc stage2

on the same source with stage1 gcc.

  • with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/

BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage2 dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

We can get these Debs

  • cpp-5-mips64el-linux-gnuabi64 lib32gcc-4.9-dev libgcc1-dbg libn32gcc1 gcc-5-base lib32gcc1-dbg libgcc1 gcc-5-mips64el-linux-gnuabi64 lib32gcc1 libn32gcc-4.9-dev gcc-5-multilib-mips64el-linux-gnuabi64 libgcc-5-dev libn32gcc1-dbg

install them

  • dpkg -i ../*.deb

STEP 5 glibc stage2

DEB_STAGE=stage2 DEB_GCC_VERSION=-5 dpkg-buildpackage -B -amips64el -d

We can get Debs and install them

dpkg -i ../libc6_*_mips64el.deb ../libc6-dev_*_mips64el.deb ../libc6-dev-mips*.deb ../libc6-mips*.deb

STEP 6 gcc stage3

with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

STEP 7 gmp/selinux

  • dpkg-buildpacakge -amips64el

STEP 8 gcc with gnat support

sed -i '/^ada_no_cross/c ada_no_cross := no' debian/rules.defs

with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d