MPC8555CDS: U-Boot vs loader compatibility

View: New views
7 Messages — Rating Filter:   Alert me  

MPC8555CDS: U-Boot vs loader compatibility

by Marcel Moolenaar-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All,

I think I recently updated the FreeBSD loader on my CDS
that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
rather fuzzy :-) In any case, the latest PowerPC U-Boot
loader is having a problem with netbooting. I see packets
being transmitted (BOOTP), but none of the responses seem
to arrive at the loader. Then the ARP resolution is
attempted, which fails as well.

I'm assuming there's an incompatibility between my U-Boot
and the loader so I tried building U-Boot on my FreeBSD
box, but that's failing due to FDT fodder in tools/mkimage.
In short: Linuxisms.

So, before I dive into U-Boot build issues and waste my
time on that, can someone tell me if I *do* need to
upgrade and which U-Boot version (at minimum) I need?

Also: did U-Boot grow support to boot from IDE/ATA that's
in the VIA chipset on the mainboard?

Thanks,

--
Marcel Moolenaar
xcllnt@...



_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

Re: MPC8555CDS: U-Boot vs loader compatibility

by Stephane E. Potvin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marcel Moolenaar wrote:

> All,
>
> I think I recently updated the FreeBSD loader on my CDS
> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
> rather fuzzy :-) In any case, the latest PowerPC U-Boot
> loader is having a problem with netbooting. I see packets
> being transmitted (BOOTP), but none of the responses seem
> to arrive at the loader. Then the ARP resolution is
> attempted, which fails as well.
>
> I'm assuming there's an incompatibility between my U-Boot
> and the loader so I tried building U-Boot on my FreeBSD
> box, but that's failing due to FDT fodder in tools/mkimage.
> In short: Linuxisms.
>
> So, before I dive into U-Boot build issues and waste my
> time on that, can someone tell me if I *do* need to
> upgrade and which U-Boot version (at minimum) I need?
>
> Also: did U-Boot grow support to boot from IDE/ATA that's
> in the VIA chipset on the mainboard?
>
Hi Marcel,

I'm using 1.3.4 with success (on both 8349 and 8379, it should not be making any difference, but YMMV). I'm attaching a patch that I
use locally to enable u-boot to build cleanly on FreeBSD with the devel/cross-* ports.

Hope this helps

Steph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkocNfYACgkQmdOXtTCX/nusVACgniIxLqPsM7tT5CDFRVCRC4+3
IvMAoOYkT4O7f07GXdApLeZhjMUHf0v2
=Knx+
-----END PGP SIGNATURE-----

commit 257e73a8d19a52b08213fa04a53e5777be6d71a3
Author: Stephane E. Potvin <spotvin@...>
Date:   Fri Jan 16 17:19:27 2009 -0500

    Add FreeBSD host support
   
    Signed-off-by: Stephane E. Potvin <spotvin@...>

diff --git a/include/image.h b/include/image.h
index 46138fa..85804ff 100644
--- a/include/image.h
+++ b/include/image.h
@@ -33,7 +33,13 @@
 #ifndef __IMAGE_H__
 #define __IMAGE_H__
 
+#ifdef __FreeBSD__
+#include <sys/endian.h>
+
+typedef u_long ulong;
+#else
 #include <asm/byteorder.h>
+#endif
 #include <command.h>
 
 #ifndef USE_HOSTCC
diff --git a/include/libfdt_env.h b/include/libfdt_env.h
index a7fd2f8..7300edc 100644
--- a/include/libfdt_env.h
+++ b/include/libfdt_env.h
@@ -30,12 +30,23 @@
 #endif /* USE_HOSTCC */
 
 #include <stddef.h>
+#ifdef __FreeBSD__
+#include <sys/endian.h>
+#else
 #include <asm/byteorder.h>
+#endif
 extern struct fdt_header *working_fdt;  /* Pointer to the working fdt */
 
+#ifdef __FreeBSD__
+#define fdt32_to_cpu(x) be32toh(x)
+#define cpu_to_fdt32(x) htobe32(x)
+#define fdt64_to_cpu(x) be64toh(x)
+#define cpu_to_fdt64(x) htobe64(x)
+#else
 #define fdt32_to_cpu(x) __be32_to_cpu(x)
 #define cpu_to_fdt32(x) __cpu_to_be32(x)
 #define fdt64_to_cpu(x) __be64_to_cpu(x)
 #define cpu_to_fdt64(x) __cpu_to_be64(x)
+#endif
 
 #endif /* _LIBFDT_ENV_H */
diff --git a/include/u-boot/md5.h b/include/u-boot/md5.h
index 8b44a7f..2a0e665 100644
--- a/include/u-boot/md5.h
+++ b/include/u-boot/md5.h
@@ -6,7 +6,13 @@
 #ifndef _MD5_H
 #define _MD5_H
 
+#ifdef __FreeBSD__
+#include <sys/types.h>
+
+typedef uint32_t __u32;
+#else
 #include <linux/types.h>
+#endif
 
 struct MD5Context {
  __u32 buf[4];
diff --git a/lib_generic/md5.c b/lib_generic/md5.c
index 9150510..212a53f 100644
--- a/lib_generic/md5.c
+++ b/lib_generic/md5.c
@@ -32,7 +32,13 @@
 #include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
+#ifdef __FreeBSD__
+#include <sys/types.h>
+
+typedef uint32_t __u32;
+#else
 #include <linux/types.h>
+#endif
 #include <u-boot/md5.h>
 
 static void
commit c166b9f962151c6365e4c81ad1164c2bc12bb625
Author: Stephane E. Potvin <spotvin@...>
Date:   Fri Jan 16 12:05:01 2009 -0500

    Search for bash under /usr/local/bin also.
   
    Signed-off-by: Stephane E. Potvin <spotvin@...>

diff --git a/config.mk b/config.mk
index 1dac29b..bbf5bb2 100644
--- a/config.mk
+++ b/config.mk
@@ -73,7 +73,8 @@ endif
 
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
     else if [ -x /bin/bash ]; then echo /bin/bash; \
-    else echo sh; fi ; fi)
+    else if [ -x /usr/local/bin/bash ]; then echo /usr/local/bin/bash; \
+    else echo sh; fi ; fi ; fi)
 
 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
 HOSTCC = cc
commit 58601ca2a4dc8cbbd74e13512f61e613c1f2a804
Author: Stephane E. Potvin <spotvin@...>
Date:   Fri Jan 16 12:03:36 2009 -0500

    Fix the sed expression used to change the source extension to .o to make
    it work under Solaris and FreeBSD.
   
    Signed-off-by: Stephane E. Potvin <spotvin@...>

diff --git a/rules.mk b/rules.mk
index a77451b..d35fd8d 100644
--- a/rules.mk
+++ b/rules.mk
@@ -28,7 +28,7 @@ _depend: $(obj).depend
 $(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS)
  @rm -f $@
  @for f in $(SRCS); do \
- g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \
+ g=`basename $$f | sed -e 's/\(.*\)\..*/\1.o/'`; \
  $(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
  done
 


_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

fbsd_support.diff.sig (98 bytes) Download Attachment

Re: MPC8555CDS: U-Boot vs loader compatibility

by Rafal Jaworowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2009-05-26, at 18:50, Marcel Moolenaar wrote:

> I think I recently updated the FreeBSD loader on my CDS
> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
> rather fuzzy :-) In any case, the latest PowerPC U-Boot
> loader is having a problem with netbooting. I see packets
> being transmitted (BOOTP), but none of the responses seem
> to arrive at the loader. Then the ARP resolution is
> attempted, which fails as well.

I'll try the latest loader tomorrow and let you know how this work here.

Has your U-Boot been modified back then so as to avoid d-cache  
disabling before passing control to the ELF entry point? (see this  
patch http://people.freebsd.org/~raj/patches/misc/uboot-dcache-workaround.diff)
  U-Boot on 85xx does not flush d-cache before disabling it and we  
have seen strange effects without this workaround. To quickly verify  
this suspicion please try converting the loader ELF to raw binary and  
running with 'go' command (the raw binary way should not expose any  
problems).

> I'm assuming there's an incompatibility between my U-Boot
> and the loader so I tried building U-Boot on my FreeBSD
> box, but that's failing due to FDT fodder in tools/mkimage.
> In short: Linuxisms.
>
> So, before I dive into U-Boot build issues and waste my
> time on that, can someone tell me if I *do* need to
> upgrade and which U-Boot version (at minimum) I need?
>
> Also: did U-Boot grow support to boot from IDE/ATA that's
> in the VIA chipset on the mainboard?

I think there already should be code to handle VIA on CDS, but I never  
tried this. Beware however that recent U-Boot was kinda unstable on  
85xx (when trying some week or two ago it would just hang during 8555  
CDS bootup), so have a JTAG debugger handy :-)

Rafal

_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

Re: MPC8555CDS: U-Boot vs loader compatibility

by Rafal Jaworowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2009-05-26, at 21:15, Rafal Jaworowski wrote:

> On 2009-05-26, at 18:50, Marcel Moolenaar wrote:
>
>> I think I recently updated the FreeBSD loader on my CDS
>> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
>> rather fuzzy :-) In any case, the latest PowerPC U-Boot
>> loader is having a problem with netbooting. I see packets
>> being transmitted (BOOTP), but none of the responses seem
>> to arrive at the loader. Then the ARP resolution is
>> attempted, which fails as well.
>
> I'll try the latest loader tomorrow and let you know how this work  
> here.

I checked a freshly built loader from HEAD and it works fine with U-
Boot 2008.10-rc2-00091-g2f4342b.

One other random thought: I don't know if you were altering your set-
up, but make sure the Ethernet cable is physically connected to the  
socket, whose MAC address you expect to be recognized/served by DHCP/
BOOTP. U-Boot silently switches to a next phy on the list in search  
for the active link if the given one is not active, so when the found-
to-be active does not match you could observe things like this...

Rafal

_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

Re: MPC8555CDS: U-Boot vs loader compatibility

by Marcel Moolenaar-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 28, 2009, at 7:48 AM, Rafal Jaworowski wrote:

>
> On 2009-05-26, at 21:15, Rafal Jaworowski wrote:
>
>> On 2009-05-26, at 18:50, Marcel Moolenaar wrote:
>>
>>> I think I recently updated the FreeBSD loader on my CDS
>>> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
>>> rather fuzzy :-) In any case, the latest PowerPC U-Boot
>>> loader is having a problem with netbooting. I see packets
>>> being transmitted (BOOTP), but none of the responses seem
>>> to arrive at the loader. Then the ARP resolution is
>>> attempted, which fails as well.
>>
>> I'll try the latest loader tomorrow and let you know how this work  
>> here.
>
> I checked a freshly built loader from HEAD and it works fine with U-
> Boot 2008.10-rc2-00091-g2f4342b.
>
> One other random thought: I don't know if you were altering your set-
> up, but make sure the Ethernet cable is physically connected to the  
> socket, whose MAC address you expect to be recognized/served by DHCP/
> BOOTP. U-Boot silently switches to a next phy on the list in search  
> for the active link if the given one is not active, so when the  
> found-to-be active does not match you could observe things like  
> this...

It's not the D-cache disabling that's a problem, nor ethernet
connectivity (ping from U-Boot works). I also see packets on
the wire that originate from the loader, so it's partially
functional. I wonder if packets are being rejected by the
loader due to, say, checksum mismatches --- Hmmm, maybe a
compiler bug (see below).

In any case: I messed things up. I built an invalid U-Boot in
the sense that it doesn't have all the commands and now I'm
stuck. I need to program a new U-Boot through the ICE (no,
the 2nd bank doesn't have a valid U-Boot :-)

BTW: I'm building natively on my xserve, so that may introduce
the problem for me...

--
Marcel Moolenaar
xcllnt@...



_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

Re: MPC8555CDS: U-Boot vs loader compatibility

by Marcel Moolenaar-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 28, 2009, at 7:48 AM, Rafal Jaworowski wrote:

>
> On 2009-05-26, at 21:15, Rafal Jaworowski wrote:
>
>> On 2009-05-26, at 18:50, Marcel Moolenaar wrote:
>>
>>> I think I recently updated the FreeBSD loader on my CDS
>>> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
>>> rather fuzzy :-) In any case, the latest PowerPC U-Boot
>>> loader is having a problem with netbooting. I see packets
>>> being transmitted (BOOTP), but none of the responses seem
>>> to arrive at the loader. Then the ARP resolution is
>>> attempted, which fails as well.
>>
>> I'll try the latest loader tomorrow and let you know how this work  
>> here.
>
> I checked a freshly built loader from HEAD and it works fine with U-
> Boot 2008.10-rc2-00091-g2f4342b.

Ok, the problem is this: when packets arrive on the interface that
are larger than the buffer being passed to U-Boot from the loader,
then the eth_receive returns -1 and leaves the packet saved. The
next call to eth_receive(0 will find that same packet and can fail
for the exact same reason. A typical scenario is the loader doing
ARP with a buffer of 66 bytes. The end result is that the ARP
will fail and the loader panics.

This obviously depends on the amount and kind of traffic on the
LAN in question...

The following U-Boot patch fixes the problem (against 1.3.4):

diff -u u-boot-1.3.4-orig/net/eth.c u-boot-1.3.4-local/net/eth.c
--- u-boot-1.3.4-orig/net/eth.c 2008-08-12 07:08:38.000000000 -0700
+++ u-boot-1.3.4-local/net/eth.c 2009-05-30 12:19:20.000000000 -0700
@@ -526,10 +526,7 @@
  return -1;
  }

- if (length < eth_rcv_bufs[eth_rcv_current].length)
- return -1;
-
- length = eth_rcv_bufs[eth_rcv_current].length;
+ length = min(length, eth_rcv_bufs[eth_rcv_current].length);

  for (i = 0; i < length; i++)
  p[i] = eth_rcv_bufs[eth_rcv_current].data[i];

FYI,

--
Marcel Moolenaar
xcllnt@...



_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."

Re: MPC8555CDS: U-Boot vs loader compatibility

by Rafal Jaworowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2009-05-30, at 21:37, Marcel Moolenaar wrote:

> On May 28, 2009, at 7:48 AM, Rafal Jaworowski wrote:
>
>>
>> On 2009-05-26, at 21:15, Rafal Jaworowski wrote:
>>
>>> On 2009-05-26, at 18:50, Marcel Moolenaar wrote:
>>>
>>>> I think I recently updated the FreeBSD loader on my CDS
>>>> that has U-Boot version 1.3.2-rc1 on it (yes, that sounds
>>>> rather fuzzy :-) In any case, the latest PowerPC U-Boot
>>>> loader is having a problem with netbooting. I see packets
>>>> being transmitted (BOOTP), but none of the responses seem
>>>> to arrive at the loader. Then the ARP resolution is
>>>> attempted, which fails as well.
>>>
>>> I'll try the latest loader tomorrow and let you know how this work  
>>> here.
>>
>> I checked a freshly built loader from HEAD and it works fine with U-
>> Boot 2008.10-rc2-00091-g2f4342b.
>
> Ok, the problem is this: when packets arrive on the interface that
> are larger than the buffer being passed to U-Boot from the loader,
> then the eth_receive returns -1 and leaves the packet saved. The
> next call to eth_receive(0 will find that same packet and can fail
> for the exact same reason. A typical scenario is the loader doing
> ARP with a buffer of 66 bytes. The end result is that the ARP
> will fail and the loader panics.
>
> This obviously depends on the amount and kind of traffic on the
> LAN in question...
>
> The following U-Boot patch fixes the problem (against 1.3.4):
>
> diff -u u-boot-1.3.4-orig/net/eth.c u-boot-1.3.4-local/net/eth.c
> --- u-boot-1.3.4-orig/net/eth.c 2008-08-12 07:08:38.000000000 -0700
> +++ u-boot-1.3.4-local/net/eth.c 2009-05-30 12:19:20.000000000 -0700
> @@ -526,10 +526,7 @@
> return -1;
> }
>
> - if (length < eth_rcv_bufs[eth_rcv_current].length)
> - return -1;
> -
> - length = eth_rcv_bufs[eth_rcv_current].length;
> + length = min(length, eth_rcv_bufs[eth_rcv_current].length);
>
> for (i = 0; i < length; i++)
> p[i] = eth_rcv_bufs[eth_rcv_current].data[i];
>
> FYI,

So this seems like a bug in generic networking U-Boot code. Are you  
willing to push this fix to the U-Boot main line?

Rafal

_______________________________________________
freebsd-ppc@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@..."