View Single Post
Old 10-26-2012, 07:56 AM   #3
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@twobob: Never had an issue building a K3 TC with ct-ng (hg tip) :?

I do use a slightly more recent glibc version to be able to use a recent GCC version, so that means jumping through a few hoops in regard to CFLAGS/CXXFLAGS later on, but nothing insurmountable...

Code:
KINDLE_TC="K3"

ARCH_FLAGS="-march=armv6j -mtune=arm1136jf-s -mfpu=vfp"
CROSS_TC="arm-kindle-linux-gnueabi"
TC_BUILD_DIR="/home/niluje/Kindle/CrossTool/Build_${KINDLE_TC}"

export CROSS_PREFIX="${CROSS_TC}-"
export PATH="/home/niluje/x-tools/${CROSS_TC}/bin:${PATH}"

## NOTE: See http://gcc.gnu.org/gcc-4.7/changes.html & http://comments.gmane.org/gmane.linux.linaro.devel/12115 & http://comments.gmane.org/gmane.linux.ports.arm.kernel/117863
## But, basically, if you want to build a Kernel, backport https://github.com/mirrors/linux/commit/8428e84d42179c2a00f5f6450866e70d802d1d05 [it's not in FW 2.5.8/3.4/4.1.0/5.1.2],
## or build your Kernel with -mno-unaligned-access
## You might also want to backport https://github.com/mirrors/linux/commit/088c01f1e39dbe93a13e0b00f4532ed8b79d35f4 if you intend to roll your own Kernel.
## For those interested, basically, if your kernel has this: https://github.com/mirrors/linux/commit/baa745a3378046ca1c5477495df6ccbec7690428 then you're safe in userland.
## (That's the commit merged in 2.6.28 that the GCC docs refer to).
## It's in FW 3.x/4.x/5.x, so we're good on *some* Kindles. However, it's *NOT* in FW 2.x, and the trap handler defaults to ignoring unaligned access faults.
## I haven't seen any *actual* issues yet, but the counter does increment...
## So, to be on the safe side, let's use -mno-unaligned-access on the K3 TC, to avoid going kablooey in weird & interesting ways on FW 2.x... ;)
ARM_NO_UNALIGNED_ACCESS="-mno-unaligned-access"

## NOTE: When linking dynamically, disable GCC 4.3/Glibc 2.8 fortify & stack-smashing protection support to avoid pulling symbols requiring GLIBC_2.8 or GCC_4.3
BASE_CFLAGS="-O2 -ffast-math ${ARCH_FLAGS} ${ARM_NO_UNALIGNED_ACCESS} -pipe -fomit-frame-pointer -flto -fuse-linker-plugin -fno-stack-protector -U_FORTIFY_SOURCE"
NOLTO_CFLAGS="-O2 -ffast-math ${ARCH_FLAGS} ${ARM_NO_UNALIGNED_ACCESS} -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE"
## FIXME: Disable LTO for now, it breaks a few key parts of what we build right now (OpenSSH) ;)
BASE_CFLAGS="${NOLTO_CFLAGS}"
export CFLAGS="${BASE_CFLAGS}"
export CXXFLAGS="${BASE_CFLAGS}"
BASE_CPPFLAGS="-I${TC_BUILD_DIR}/include"
export CPPFLAGS="${BASE_CPPFLAGS}"
BASE_LDFLAGS="-L${TC_BUILD_DIR}/lib -Wl,-O1 -Wl,--as-needed"
export LDFLAGS="${BASE_LDFLAGS}"

BASE_HACKDIR="${SVN_ROOT}/Configs/trunk/Kindle/Hacks"

BASE_PKG_CONFIG_PATH="${TC_BUILD_DIR}/lib/pkgconfig"
BASE_PKG_CONFIG_LIBDIR="${TC_BUILD_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH="${BASE_PKG_CONFIG_PATH}"
export PKG_CONFIG_LIBDIR="${BASE_PKG_CONFIG_LIBDIR}"
(For reference, all of this comes from my build script).
Attached Files
File Type: gz ct-ng-k3-config.gz (4.7 KB, 425 views)

Last edited by NiLuJe; 10-26-2012 at 08:15 AM.
NiLuJe is offline   Reply With Quote