Linaro 4.7 build fixes and optimisation