ar71xx: image: add a few helper functions