Subject: Re: config & endianness
To: Garrett D'Amore <>
From: Simon Burge <>
List: tech-kern
Date: 03/07/2006 13:05:46
Hi Garrett,

"Garrett D'Amore" wrote:

> Hmm.... we now have some kernel configs in evbmips that do not make
> sense for either big or little endian.
>     * OMSAL and MTX-1 are always little endian
>     * forthcoming ATHEROS AR531x based systems will always be big endian
>     * DBAU1XXX can be either endian (jumper selectable)
>     * Malta/PB1XXX?  probably also jumper selectable
> Is there a way to establish stuff in config so that:
>     1) an attempt to build a kernel with endianness that doesn't make
> sense fails in config(8), AND
>     2) the master releng Makefiles/scripts only bother to build the
> kernels that make sense for a particular endianness

etc.evbarm/ uses $MACHINE_ARCH to build two different kernel
lists.  I can't think of a cleaner way of doing this off-hand.

> I also have another question relating to the atheros HAL and endianness
> in Makefiles.  Is there a way to detect in the kernel Makefiles what
> endianness is being used and use different dependencies based on that? 
> (I.e. pick either the big or the little endian HAL properly.)

You can use ${MACHINE_ARCH} and/or <>.  For example,
if I put the following in sys/arch/mips/conf/Makefile.mips somewhere:

	.include <>

		@ls $S/contrib/arch/mips/dev/athhal-mips-${MACHINE_ARCH:C/^mipse//}e-elf.hal.o.uue


I can then do:

	bigkev 58> nbmake-evbmips-eb ls-ath
	bigkev 59> nbmake-evbmips-eb endian
	bigkev 60> nbmake-evbmips-el ls-ath
	bigkev 61> nbmake-evbmips-el endian

Is this what you mean?  Note that for the ath example, $MACHINE_ARCH
ends in "eb" or "el", but the ath files want to use "be" or "le" so we
delete the 'e' as well and tack it on the end.

Simon Burge                            <>
NetBSD Support and Service: