We should be including u-boot in the mpc8315e-rdb images. v2010.09 is documented in README.hardware as the preferred version. However, neither this version, nor v2010.12, nor HEAD will compile with the 1.0 toolchain: $ /opt/poky/1.0/sysroots/x86_64-pokysdk-linux/usr/bin/ppc603e-poky-linux/powerpc-poky-linux-gcc --version powerpc-poky-linux-gcc (GCC) 4.5.1 Regardless of the version, gcc complains about the -Os option: dvhart@doubt:u-boot.git$ make ARCH=powerpc CROSS_COMPILE=/opt/poky/1.0/sysroots/x86_64-pokysdk-linux/usr/bin/ppc603e-poky-linux/powerpc-poky-linux- MPC8315ERDB_config awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }' boards.cfg > .boards.depend Generating include/autoconf.mk cc1: error: Do not use -Os option if --enable-target-optspace is not set. Generating include/autoconf.mk.dep cc1: error: Do not use -Os option if --enable-target-optspace is not set. Configuring for MPC8315ERDB board... The following patch gets past this: diff --git a/config.mk b/config.mk index eb95093..374b262 100644 --- a/config.mk +++ b/config.mk @@ -151,7 +151,7 @@ ARFLAGS = crv endif RELFLAGS= $(PLATFORM_RELFLAGS) DBGFLAGS= -g # -DDEBUG -OPTFLAGS= -Os #-fomit-frame-pointer +OPTFLAGS= #-Os #-fomit-frame-pointer ifndef LDSCRIPT #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug ifeq ($(CONFIG_NAND_U_BOOT),y) The build failures for the three points in the git file follow as attachments.
Created attachment 126 [details] v2010.09 Build Failure: crc32.c:85:1: error: initializer element is not constant crc32.c:85:1: error: (near initialization for 'crc_table[0]')
Created attachment 127 [details] v2010.12 Build Failure: ehci-hcd.c:59:3: error: initializer element is not constant
I see that v2011.03 was released today. Building with the Poky 4.5.1 gcc results in the same error there as for v2010.12.
(In reply to comment #3) > I see that v2011.03 was released today. Building with the Poky 4.5.1 gcc > results in the same error there as for v2010.12. It looks like the omission of -Os is fatal in this case. cpu_to_le{16,32} are translated to swab family of functions, where in include/linux/byteorder/swab.h, there is: --- #if defined(__GNUC__) && (__GNUC__ >=2) && defined(__OPTIMIZE__) # define __swab16(x) \ (__builtin_constant_p((__u16)(x))? \ ___swab16((x)) : \ __fswab16((x))) ... #else # define __swab16(x) __fswab16(x) ... #endif /* OPTIMIZE */ --- So, when -Os is missing, __OPTIMIZE__ is not set, and cpu_to_le16 is translated to __fswab16(x) which is not constant foldable (f denotes function here). I try to always define __swab16 (two underscores) to be ___swab16 (three underscores) in the above file, and the compilation passed this point (but linking still fails).
Created attachment 132 [details] the patch to pass compilation This patch fix the constant folding of cpu_to_le
Created attachment 133 [details] updated patch to fix compilation
Please submit the patch to the list for review. Qing, can you please accept the bug as well?
(In reply to comment #7) > Please submit the patch to the list for review. Qing, can you please accept the > bug as well? Darren, is the patch fix your problem? I've been waiting for response for a while. This bug is against building external u-boot with 1.0 toolchain, which is exposed by a known limitation of ppc toolchain (lack of -Os). I'm not sure what do you want me to fix, the possibilities are: 1. building external u-boot 2. building u-boot recipe within yocto 3. fixing the toolchain limitation However, 1. the fix is for external u-boot, which is not part of yocto (thus not fixable). I thought you met the build failure in the middle of u-boot enabling for mpc8315e-rdb, am I missing anything? 2. if this is the case, please be clear in the description and include the error message generated by "bitbake u-boot". Also, if u-boot is not current included in mpc8315e-rdb images (and not buildable), I doubt whether it should be target for 1.0 point release. 3. I don't know the exact reason why -Os is disabled on ppc, but that needs a separate bug. So, can you please clarify?
Qing, the goal would be to apply your patch to the u-boot recipe in oe core and see if it builds. If so, this addresses the bug as reported. If not, it may be we need to refresh our u-boot recipe as well to a newer version to get u-boot to build for the mpc within poky.
(In reply to comment #9) > Qing, the goal would be to apply your patch to the u-boot recipe in oe core and > see if it builds. If so, this addresses the bug as reported. If not, it may be > we need to refresh our u-boot recipe as well to a newer version to get u-boot > to build for the mpc within poky. got it. Thank you. I remember that the build still failed at some later stage after applying the patch to solve constant initializer patch. Saul, is u-boot enabled in the mpc8315e-rdb in the 1.0? If not, it seems not suitable for targeting point release.
(In reply to comment #10) > Saul, is u-boot enabled in the mpc8315e-rdb in the 1.0? If not, it seems not > suitable for targeting point release. It is not. Getting it for 1.1 should be fine. This is a feature add for mpc, not purely a bug fix.
This is not required for 1.0. The stock u-boot for this board seems to be capable of booting the linux-yocto kernel specified for this board. Retargeted to 1.1.
Transfer to Liming to debug on ppc.
anyone can provide info how to compile u-boot for mpc8315-rdb successfully using 4.5.1 poky gcc? all patches in this thread don't resolve the building issues.
OK, no patch used here. Using O2 instead of Os can build the u-boot successfully. I have tested "v2010.12" version on mpc8315e-rdb, it works well. The boot message: U-Boot 2010.12-dirty (May 12 2011 - 13:43:46) MPC83XX Reset Status: Software Hard, External/Internal Soft, External/Internal Hard CPU: e300c3, MPC8315E, Rev: 1.2 at 400 MHz, CSB: 133.333 MHz Board: Freescale MPC8315ERDB Rev 1.0 I2C: ready DRAM: 128 MiB (DDR2, 32-bit, ECC off, 266.667 MHz) FLASH: 8 MiB NAND: 32 MiB *** Warning - bad CRC, using default environment PCIE0: No link PCIE1: No link In: serial Out: serial Err: serial Net: eTSEC0, eTSEC1 Hit any key to stop autoboot: 0
But the bad news is that after I reboot the board, the board can't boot now. I think some part of hardware initializing failed on the board. Previous success is that I used "reset" command to reboot the board after I re-flash the u-boot to the latest version. We need more time to test this case. But we need jtag to re-flash the board first.
Moving to 1.1 M4. It is possible we'll just drop u-boot entirely for this board and suggest users use the known-to-be-working u-boot that ships with the board.
Move to post 1.1 as it works as is with factory u-boot.
I believe this can be marked as resolved, as of this commit: commit 15b96762f1862057c16f0a453c77bb1a0688692d Author: Paul Gortmaker <paul.gortmaker@windriver.com> Date: Thu Jul 19 20:01:55 2012 -0400 mpc8315: build u-boot v2012.04 by default.
Mark as resolved as mentioned by Paul
Verified with 1.3 danny branch. gitinfo: 27af23e65f63b41962a7cfddba9e9372d5212396