#@TYPE: Distribution
#@NAME: Unslung 
#@DESCRIPTION: Unslung Linux Distribution for the NSLU2

DISTRO_NAME = "Unslung"
DISTRO_VERSION = "6.11-beta"
DISTRO_TYPE = "beta"

FEED_URIS  = "cross##http://ipkg.nslu2-linux.org/feeds/optware/nslu2/cross/stable"
FEED_URIS += "native##http://ipkg.nslu2-linux.org/feeds/optware/nslu2/native/stable"
FEED_URIS += "oe##http://ipkg.nslu2-linux.org/feeds/unslung/modules/cross/stable"

TARGET_FPU = "soft"
TARGET_OS = "linux"

# select distro specific options to match that of the original LinkSys build
ARM_INSTRUCTION_SET = "arm"
THUMB_INTERWORK = "no"

# for compatibility PACKAGE_ARCH stays as TARGET_ARCH and TARGET_ARCH is hard-wired
# to armeb - this makes this stuff independent of changes in machine/nslu2.conf
TARGET_ARCH = "armeb"
PACKAGE_ARCH = "${TARGET_ARCH}"
# PACKAGE_EXTRA_ARCHS has the full list of supported architectures (from nslu2be.conf).
# We need "nslu2" added for backwards compatibility.
PACKAGE_EXTRA_ARCHS += "nslu2"

# match the optimisation settings to that which has traditionally been used
# in unslung
FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2"

INHERIT += " package_ipk"

IMAGE_FSTYPES = "jffs2"
UNSLUNG_DEVICE_TABLE = "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-unslung.txt')}"
EXTRA_IMAGECMD_jffs2 = "-n --pad --big-endian --eraseblock=0x20000 -D ${UNSLUNG_DEVICE_TABLE}"

UNSLUNG_EXTRA_DEPENDS  ?= ""
UNSLUNG_EXTRA_RDEPENDS ?= ""

UNSLUNG_EXTRA_INSTALL ?= "${UNSLUNG_EXTRA_RDEPENDS}"

# Select between multiple alternative providers, if more than one is eligible.
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-intermediate:gcc-cross-intermediate"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}libc-initial:glibc-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}libc-for-gcc:glibc"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}binutils:binutils-cross"
PREFERRED_PROVIDERS += " virtual/libc:glibc"
PREFERRED_PROVIDERS += " linux-libc-headers:linux-libc-headers"

PREFERRED_PROVIDER_libc6-unslung = "glibc"

PREFERRED_VERSION_binutils ?= "2.15.94.0.1"
PREFERRED_VERSION_binutils-cross ?= "2.15.94.0.1"
PREFERRED_VERSION_gcc-cross-initial ?= "3.4.4"
PREFERRED_VERSION_gcc-cross-intermediate ?= "3.4.4"
PREFERRED_VERSION_gcc-cross ?= "3.4.4"
PREFERRED_VERSION_gcc ?= "3.4.4"
PREFERRED_VERSION_glibc ?= "2.2.5"
PREFERRED_VERSION_glibc-initial ?= "2.2.5"

# Whilst gcc 3.4.4 sypports sysroot, binutils 2.15.94.0.1 does not
# so we need the linkage helpers to help binutils find staging.
DEPENDS_append_pn-linux-libc-headers = "cross-linkage staging-linkage"

PREFERRED_PROVIDER_virtual/kernel = "unslung-kernel"
PREFERRED_VERSION_unslung-kernel ?= "2.4.22.l2.3r63"
PREFERRED_VERSION_unslung-rootfs         ?= "2.3r63"
PREFERRED_VERSION_nslu2-linksys-firmware ?= "2.3r63"
PREFERRED_VERSION_nslu2-linksys-libs     ?= "2.3r63"
PREFERRED_VERSION_nslu2-linksys-ramdisk  ?= "2.3r63"

CVS_TARBALL_STASH = "http://sources.nslu2-linux.org/sources/"
INHERIT += "nslu2-mirrors"

#-------------------------------------------------------------------
#                           FIXME!
# This is clearly wrong, the headers should match the 2.4.22 kernel,
# but locking this to 2.6.11.1 at least gets Unslung building again.
# - mwester 16 Dec 2006
#
PREFERRED_VERSION_linux-libc-headers ?= "2.6.11.1"

require conf/distro/include/sane-srcdates.inc
require conf/distro/include/sane-srcrevs.inc
