Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Oct 2008 20:12:09 +0700
From:      "Outback Dingo" <outbackdingo@gmail.com>
To:        "Bruce M. Simpson" <bms@incunabulum.net>
Cc:        freebsd-embedded@freebsd.org
Subject:   Re: HOWTO: Build NSLU2 U-Boot on FreeBSD
Message-ID:  <5635aa0d0810110612l4a5abf79ic2394885d865c888@mail.gmail.com>
In-Reply-To: <48F099D4.2050302@incunabulum.net>
References:  <48F099D4.2050302@incunabulum.net>

next in thread | previous in thread | raw e-mail | index | archive | help
I know its a bit off topic but it would be nice to see FreeBSD running on
some other pieces of equiptment like a Ubiquiti NS2 or PS2

On Sat, Oct 11, 2008 at 7:19 PM, Bruce M. Simpson <bms@incunabulum.net>wrot=
e:

> Thanks to Rink Springer and Rafal Jaworowski.
>
> ----------------------
>
> Building NSLU2 U-boot firmware on FreeBSD hosts
>
> Quick start
>
> Make sure you have a JTAG adapter as a get-out-of-jail-free card in case
> you trash the flash, "portinstall devel/urjtag" to get a driver for it.
> Recommend getting one like the Olimex OCD as it has heaps more useful
> functionality than just rewriting the flash, and should also work with
> OpenOCD.
>
> Toolchain setup
>
> cd /usr/ports/devel/cross-binutils
> env TGTARCH=3Darm TGTABI=3Drtems make install
>
> cd /usr/ports/devel/cross-gcc
> env TGTARCH=3Darm TGTABI=3Drtems make install
>
> Get stas@FreeBSD.org's updated u-boot tarball:
> uboot-atamantb.tar.bz2
> Untar it
>
> Fetch NSLU2 patch set from NSLU2-Linux:
>
> http://trac.nslu2-linux.org/kernel/browser/trunk/patches/u-boot/0001-ixp-=
Support-for-NSLU2.patch
>
> Apply (patch -p1) inside uboot-atamantb.
>
> Apply Ix*.diff (provided) inside cpu/ixp/npe.
> U-Boot doesn't grok being built for an RTEMS target,
> so it needs some sweet lovin'.
>
> Fetch encumbered NPE microcode from Intel:
> http://downloadcenter.intel.com/
> Search for IPL_IXP400NPELIBRARY-2_1.ZIP
> (Yes yes, I know, we can't redistribute it, for now anyway...there will
> be a workaround)
>
> Unzip...
> Copy ./cpu/ixp/npe/IxNpeMicrocode.c.orig into uboot-atamantb/cpu/ixp/npe=
=B7
>
> Remove mkimage from tools/Makefile (it needs rentokil to build on FreeBSD=
;
> and besides, you can use "portinstall devel/u-boot" to get mkimage)
>
> Now:
>
> env CROSS_COMPILE=3Darm-rtems- gmake distclean
> env CROSS_COMPILE=3Darm-rtems- gmake nslu2_config
> env CROSS_COMPILE=3Darm-rtems- gmake
>
> Voila, you should have u-boot firmware images, which you can now use to
> reflash an NSLU2.
>
>
>
> --- ./cpu/ixp/npe/include/IxOsalEndianess.h.orig        2008-10-03
> 12:11:18.000000000 +0100
> +++ ./cpu/ixp/npe/include/IxOsalEndianess.h     2008-10-03
> 13:11:48.000000000 +0100
> @@ -59,6 +59,32 @@
>  /* get ntohl/ntohs/htohl/htons macros definitions for WinCE */
>  #include <Winsock2.h>
>
> +#elif defined (__rtems__)
> +
> +# ifdef htonl
> +#  undef htonl
> +# endif
> +# ifdef ntohl
> +#  undef ntohl
> +# endif
> +
> +# if BYTE_ORDER =3D=3D BIG_ENDIAN
> +
> +#  define     ntohl(a) (a)
> +#  define     htonl(a) (a)
> +# elif BYTE_ORDER =3D=3D LITTLE_ENDIAN
> +#  define SWAP_LONG(x) \
> +       ((__u32)( \
> +               (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
> +               (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) | \
> +               (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) | \
> +               (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
> +#  define     ntohl(a) SWAP_LONG(a)
> +#  define     htonl(a) SWAP_LONG(a)
> +# else
> +#  error meep
> +# endif
> +
>  #else
>
>  #error Unknown OS, please add a section with the include file for
> htonl/htons/ntohl/ntohs
> @@ -123,6 +149,14 @@
>
>  #define IX_OSAL_WINCE_LE
>
> +#elif defined (__rtems__) && defined (__BIG_ENDIAN)
> +
> +#define IX_OSAL_LINUX_BE /* XXX */
> +
> +#elif defined (__rtems__) && defined (__BIG_ENDIAN)
> +
> +#define IX_OSAL_LINUX_LE /* XXX */
> +
>  #else
>
>  #error Unknown OS/Endianess combination - only vxWorks BE LE, Linux BE L=
E,
> WinCE BE LE are supported
>
> --- ./cpu/ixp/npe/include/IxOsalMemAccess.h.orig        2008-10-03
> 13:24:52.000000000 +0100
> +++ ./cpu/ixp/npe/include/IxOsalMemAccess.h     2008-10-03
> 13:26:07.000000000 +0100
> @@ -324,7 +324,9 @@
>
>  #endif /* wince */
>
> -#if defined (__vxworks) || (defined (__linux) && defined
> (IX_OSAL_STATIC_MEMORY_MAP)) || \
> +#if defined (__vxworks) || \
> +    defined (__rtems__) || \
> +                           (defined (__linux) && defined
> (IX_OSAL_STATIC_MEMORY_MAP)) || \
>                            (defined (__wince) && defined
> (IX_OSAL_STATIC_MEMORY_MAP))
>
>  #define IX_OSAL_READ_LONG_IO(wAddr)
>  IX_OSAL_READ_LONG_RAW(wAddr)
>
> _______________________________________________
> freebsd-embedded@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-embedded
> To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.or=
g
> "
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5635aa0d0810110612l4a5abf79ic2394885d865c888>