[RFC PATCH u-boot 00/12] U-Boot LTO (Sandbox + ARM Nokia RX-51)

Pali Rohár pali at kernel.org
Thu May 13 11:22:24 CEST 2021


On Monday 10 May 2021 10:28:05 Simon Glass wrote:
> Hi Marek,
> 
> On Sun, 9 May 2021 at 12:45, Marek Behun <marek.behun at nic.cz> wrote:
> >
> > On Sun, 9 May 2021 09:14:14 -0500
> > Adam Ford <aford173 at gmail.com> wrote:
> >
> > > On Sat, Mar 6, 2021 at 10:06 PM Marek Behun <marek.behun at nic.cz> wrote:
> > > >
> > > > On Sat, 6 Mar 2021 21:45:02 -0600
> > > > Adam Ford <aford173 at gmail.com> wrote:
> > > >
> > > > > On Sat, Mar 6, 2021 at 3:49 PM Marek Behun <marek.behun at nic.cz> wrote:
> > > > > >
> > > > > > On Sat, 6 Mar 2021 22:38:52 +0100
> > > > > > Pali Rohár <pali at kernel.org> wrote:
> > > > > >
> > > > > > > On Saturday 06 March 2021 22:19:22 Marek Behun wrote:
> > > > > > > > On Sat, 6 Mar 2021 22:00:45 +0100
> > > > > > > > Pali Rohár <pali at kernel.org> wrote:
> > > > > > > >
> > > > > > > > > On Saturday 06 March 2021 21:54:00 Marek Behun wrote:
> > > > > > > > > > On Sat, 6 Mar 2021 21:41:14 +0100
> > > > > > > > > > Pali Rohár <pali at kernel.org> wrote:
> > > > > > > > > >
> > > > > > > > > > > On Saturday 06 March 2021 15:08:13 Tom Rini wrote:
> > > > > > > > > > > > Perhaps we'll default to yes on some SoCs.  The omap3 thing is a bit
> > > > > > > > > > > > odd, but we'll see what happens on real N900 hardware.
> > > > > > > > > > >
> > > > > > > > > > > Hello!
> > > > > > > > > > >
> > > > > > > > > > > Could you send me a link to git repo / branch and tell me from which
> > > > > > > > > > > commit should I do tests on real N900 hardware? I will test it and let
> > > > > > > > > > > you know results.
> > > > > > > > > > >
> > > > > > > > > > > Adding maemo ML to the loop as on the maemo list are more people with
> > > > > > > > > > > N900 HW and U-Boot.
> > > > > > > > > >
> > > > > > > > > > https://github.com/elkablo/u-boot branch lto
> > > > > > > > >
> > > > > > > > > Sorry, compilation is failing :-(
> > > > > > > > >
> > > > > > > > > $ git clone https://github.com/elkablo/u-boot -b lto --depth=100
> > > > > > > > > Cloning into 'u-boot'...
> > > > > > > > > remote: Enumerating objects: 33644, done.
> > > > > > > > > remote: Counting objects: 100% (33644/33644), done.
> > > > > > > > > remote: Compressing objects: 100% (20116/20116), done.
> > > > > > > > > remote: Total 33644 (delta 15838), reused 19947 (delta 13018), pack-reused 0
> > > > > > > > > Receiving objects: 100% (33644/33644), 26.28 MiB | 10.21 MiB/s, done.
> > > > > > > > > Resolving deltas: 100% (15838/15838), done.
> > > > > > > > >
> > > > > > > > > $ cd u-boot
> > > > > > > > >
> > > > > > > > > $ make CROSS_COMPILE=arm-linux-gnueabi- nokia_rx51_config
> > > > > > > > >   HOSTCC  scripts/basic/fixdep
> > > > > > > > >   HOSTCC  scripts/kconfig/conf.o
> > > > > > > > >   YACC    scripts/kconfig/zconf.tab.c
> > > > > > > > >   LEX     scripts/kconfig/zconf.lex.c
> > > > > > > > >   HOSTCC  scripts/kconfig/zconf.tab.o
> > > > > > > > >   HOSTLD  scripts/kconfig/conf
> > > > > > > > > #
> > > > > > > > > # configuration written to .config
> > > > > > > > > #
> > > > > > > > >
> > > > > > > > > $ make CROSS_COMPILE=arm-linux-gnueabi- u-boot.bin
> > > > > > > > > ...
> > > > > > > > >   LTO     u-boot
> > > > > > > > > /usr/lib/gcc-cross/arm-linux-gnueabi/8/../../../../arm-linux-gnueabi/bin/ld: /usr/lib/gcc-cross/arm-linux-gnueabi/8/../../../../arm-linux-gnueabi/bin/ld: DWARF error: offset (1258291444) greater than or equal to .debug_str size (676)
> > > > > > > > > /usr/lib/gcc-cross/arm-linux-gnueabi/8/../../../../arm-linux-gnueabi/bin/ld: DWARF error: offset (1459618036) greater than or equal to .debug_str size (676)
> > > > > > > > > /usr/lib/gcc-cross/arm-linux-gnueabi/8/../../../../arm-linux-gnueabi/bin/ld: DWARF error: could not find abbrev number 48028
> > > > > > > > > /tmp/cc8l0QSQ.ltrans3.ltrans.o: in function `omap3_set_aux_cr_secure':
> > > > > > > > > <artificial>:(.text+0x6eb8): undefined reference to `do_omap3_emu_romcode_call'
> > > > > > > > > collect2: error: ld returned 1 exit status
> > > > > > > > > make: *** [Makefile:1808: u-boot] Error 1
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I'm using arm-linux-gnueabi-gcc version 8.3.0 which is available in
> > > > > > > > > current Debian stable (Debian 10 Buster).
> > > > > > > >
> > > > > > > > Fixed and force-pushed, it seems ar needs the P flag that Bin Meng
> > > > > > > > questioned.
> > > > > > >
> > > > > > > Problem is fixed, now compilation succeeded. u-boot.bin has size 243788
> > > > > > > bytes.
> > > > > > >
> > > > > > > And seems that compiled U-Boot is working fine!
> > > > > > >
> > > > > > > Nokia RX-51 # version
> > > > > > > U-Boot 2021.04-rc3-00338-g88d0a5042c97 (Mar 06 2021 - 22:19:08 +0100)
> > > > > > >
> > > > > > > arm-linux-gnueabi-gcc (Debian 8.3.0-2) 8.3.0
> > > > > > > GNU ld (GNU Binutils for Debian) 2.31.1
> > > > > > >
> > > > > > > I can send binary files via usbtty and 'loadb' command. I can boot linux
> > > > > > > kernel via 'bootm'. I can chainload to another U-Boot binary (loaded by
> > > > > > > 'loadb') via 'go' command. Also 'ext4ls' and 'fatls' commands are
> > > > > > > working. Also 'onenand dump bootloader' is working.
> > > > > > >
> > > > > > > Do you need something more to test?
> > > > > > >
> > > > > > > If not you can add my 'Tested-by: Pali Rohár <pali at kernel.org>' line for
> > > > > > > all patches which are up to the commit 88d0a5042c97.
> > > > > > >
> > > > > > > Good job!
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > I am still working on these patches, since I have discovered some more
> > > > > > defconfigs which fail to build for one reason or another.
> > > > > >
> > > > > > I will send a patch enabling LTO for Nokia N900 though.
> > > > > >
> > > > >
> > > > > I have my DM3730 booting now
> > > > >
> > > > > diff --git a/arch/arm/mach-omap2/omap3/Makefile
> > > > > b/arch/arm/mach-omap2/omap3/Makefile
> > > > > index 91ed8ebc9f..4c96c81bf7 100644
> > > > > --- a/arch/arm/mach-omap2/omap3/Makefile
> > > > > +++ b/arch/arm/mach-omap2/omap3/Makefile
> > > > > @@ -6,6 +6,8 @@
> > > > >  # If clock.c is compiled for Thumb2, then it fails on OMAP3530
> > > > >  CFLAGS_clock.o += -marm
> > > > >
> > > > > +CFLAGS_REMOVE_board.o := $(LTO_CFLAGS)
> > > > > +
> > > > >  obj-y  := lowlevel_init.o
> > > > >
> > > > >  obj-y  += board.o
> > > > >
> > > > > The board.c file has a few functions with assembly code and some
> > > > > functions called by assembly.  I wonder if there needs to be some
> > > > > compiler flags added to it to ensure it boots.  I am not as
> > > > > experienced with compiler directives and Makefile tweaks, but I am
> > > > > willing to try stuff if people have suggestions.
> > > > >
> > > > > However, at least for now, the omap3_logic board works.  I haven't
> > > > > tried the AM3517 yet.  It's similar to the omap3 with a different
> > > > > memory controller so I'm more concerned about it than the OMAP3530.
> > > > > If I have time tomorrow, I'll run some tests on the AM3517.
> > > > >
> > > > > adam
> > > >
> > > > Adding to my patches, thanks.
> > >
> > > Do you think you'll be re-submitting any of this for the next release of U-Boot?
> > > I felt like we had some good momentum going.
> > >
> > > >
> > > > Marek
> >
> > I shall look into this again this week. There is one problem I
> > discovered last month and haven't yet time to look into it. It is
> > pretty important - network does not work with the mvneta driver on
> > Turris Omnia when compiled with LTO...
> 
> Granted that this might be a more widespread issue, but you can make
> LTO depend on that driver not being present. The way to get people to
> try it out is to get something merged. People can turn it on as help
> you fix the remaining problems.

I agree. At least patches can be merged without enabling LTO by default
and issues in particular drivers can be fixed later.

> Regards,
> Simon


More information about the U-Boot mailing list