Re: Bypassing U-Boot (SPL -> kernel)

2,099 views
Skip to first unread message

Brent

unread,
Jun 1, 2013, 10:29:19 AM6/1/13
to beagl...@googlegroups.com, ylla...@gmail.com
Interesting concept, and I would be interested in this as well.  I attached a patch that I did a few days ago that made SPL and u-boot finish in a little over 3 seconds (was about 7 seconds out of the box), but I would like to see this reduced further if possible.  If you find a solution please let me know!

On Friday, May 31, 2013 10:36:36 PM UTC-4, Paul wrote:
Hello folks!

I'm trying to reduce the boot time of a BB Black by skipping u-boot and trying to load a compressed kernel directly from the u-boot SPL. Is there a way to do such thing? If so how?

Thanks in advance!
u-boot.patch

Brent

unread,
Jun 1, 2013, 10:31:56 AM6/1/13
to beagl...@googlegroups.com, ylla...@gmail.com
By the way, the patch is not ideal... I commented out a bunch of things, but ideally you would use the #define's to turn things on/off.  This was just a way for me to hack it quickly so I could figure out the minimum I needed to boot the kernel.

Mark Lazarewicz

unread,
Jun 1, 2013, 12:18:06 PM6/1/13
to beagl...@googlegroups.com

Two stage U-Boot design

This section gives an overview of the two stage U-Boot approach adopted for AM335X.

The size of the internal RAM in AM335X is 128KB out of which 18KB at the end is used by the ROM code. Also, 1 KB at the start (0x402f0000 - 0x402f0400) is secure and it cannot be accessed This places a limit of 109KB on the size of the U-Boot binary which the ROM code can transfer to the internal RAM and use as an initial stack before initialization of DRAM.

Since it is not possible to squeeze in all the functionality that is normally expected from U-Boot in < 110KB (after setting aside some space for stack, heap etc) a two stage approach has been adopted. Initial stage initalize only the required boot devices (NAND, MMC, I2C etc); 2nd full stage initall all other devices (ethernet, timers, clocks etc). The 1st binary is generated MLO and the 2nd stage is generated as u-boot.img.


http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User's_Guide

--- On Sat, 6/1/13, Brent <bren...@hotmail.com> wrote:
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brent C. Sink

unread,
Jun 1, 2013, 6:35:30 PM6/1/13
to beagl...@googlegroups.com

Wow, that's really amazing that you got the kernel to load in 600ms! Do you mind sharing how you achieved this? I haven't started optimizing the kernel yet so any direction would be appreciated.

-brent

On Jun 1, 2013 5:48 PM, "Paul" <ylla...@gmail.com> wrote:
Thank you for the patch, Brent. I'm down to a 3 second boot time (full boot, from PWRON to shell). Still, the kernel boots in less than 600ms, and the rest (2.4s) is up to u-boot. Since I just started learning how to use an embedded linux device, I think it's a shame that u-boot takes so long to do it's thing and that I can't help to develop(?) a way to use the kernel as a payload for SPL for now.

Other things that I used to speed u-boot up are: 

- using other CFLAGS for compiling u-boot (-Os and so on) and removing -g;
- embedding the environment into the u-boot img so as not to read from uEnv.txt;
- use on include/configs/am335x_evm.h:
#define CONFIG_SYS_CONSOLE_INFO_QUIET
#define CONFIG_SILENT_CONSOLE 1
#define CONFIG_SYS_DEVICE_NULLDEV
#define CONFIG_SILENT_U_BOOT_ONLY
#undef  CONFIG_SYS_LONGHELP
#undef  CONFIG_CMD_GPIO
#define CONFIG_EXTRA_ENV_SETTINGS \
........
"verify=no\0" \
"silent=1\0" \ 
.......
#undef  CONFIG_FAT_WRITE
#undef  CONFIG_CMD_EXT2
#undef  CONFIG_CMD_DHCP
#undef  CONFIG_CMD_PING
#undef  CONFIG_BOOTP_DEFAULT
#undef  CONFIG_BOOTP_DNS
#undef  CONFIG_BOOTP_DNS2
#undef  CONFIG_BOOTP_SEND_HOSTNAME
#undef  CONFIG_BOOTP_GATEWAY
#undef  CONFIG_BOOTP_SUBNETMASK 
 
Still it takes a lot of time to run it. Any further tips are appreciated!

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/Hm-WAK_E4xo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

Mark Lazarewicz

unread,
Jun 2, 2013, 10:19:12 AM6/2/13
to beagl...@googlegroups.com
Have you islolated what/where U-boot spends this time? Its hard to imagine what initialization could take that long. uncompressing and copying kernel into DDR should be the lions share of the time spent. I have seen RAM test on really slow really large older memories take a long time but this memory is modern. I think if you google this list there was talk about an easy way to profile/measure. I am spoiled using CCS to measure clock tick between breakpoints so I cant offer any ideas on how to measure beyond the painful old school way of scope and toggle gpio

--- On Sat, 6/1/13, ylla...@gmail.com <ylla...@gmail.com> wrote:

From: ylla...@gmail.com <ylla...@gmail.com>
Subject: Re: [beagleboard] Re: Bypassing U-Boot (SPL -> kernel)
To: beagl...@googlegroups.com
Date: Saturday, June 1, 2013, 9:54 PM

Well, it boils down to this:

- Compile your rootfs with a uClibc toolchain
- Remove unnecessary mounts
- Use a static /dev
- Disable all kernel debugging (really all of it)
- Remove unnecessary functions from the kernel (depends on your needs)
- Use busybox and compile just what you need
- LZO compress your kernel
- Use loglevel=0 as parameter for the kernel
- Set lpj=<num> as parameter for the kernel
- Mount your FS as read-only (if necessary defer mounting as rw only after system is booted)
- If possible, use SquashFS for the rootfs
- Let go of using init and use your application as the initial process: (init=<file> as parameter for the kernel)

And so on... I still have to build a static /dev and use my app as the initial process (allowing me to remove all kinds of console from the kernel and rootfs [console=null as parameter for the kernel] so I think I still have headroom to reduce even more the boot time from the kernel). It's really a shame that u-boot takes so long... 

So... is there a way to reduce even more the time it takes u-boot to run?

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Vladimir Pantelic

unread,
Jun 2, 2013, 4:04:38 PM6/2/13
to beagl...@googlegroups.com
On 06/01/2013 04:36 AM, Paul wrote:
> Hello folks!
>
> I'm trying to reduce the boot time of a BB Black by skipping u-boot and
> trying to load a compressed kernel directly from the u-boot SPL. Is
> there a way to do such thing? If so how?

google for uboot "falcon mode"

Brent C. Sink

unread,
Jun 3, 2013, 11:09:36 PM6/3/13
to beagl...@googlegroups.com
Interesting.  Have you tried this?  How did it perform?


--
For more options, visit http://beagleboard.org/discuss
--- You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/Hm-WAK_E4xo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to beagleboard+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.





--
-brent

Tom Rini

unread,
Jun 4, 2013, 10:12:27 AM6/4/13
to beagl...@googlegroups.com, ylla...@gmail.com

On Friday, May 31, 2013 10:36:36 PM UTC-4, Paul wrote:
Hello folks!

I'm trying to reduce the boot time of a BB Black by skipping u-boot and trying to load a compressed kernel directly from the u-boot SPL. Is there a way to do such thing? If so how?

See doc/README.falcon in mainline, and apply the following patches:
http://patchwork.ozlabs.org/patch/243491/
http://patchwork.ozlabs.org/patch/243494/
http://patchwork.ozlabs.org/patch/243493/
http://patchwork.ozlabs.org/patch/243492/
http://patchwork.ozlabs.org/patch/243490/
http://patchwork.ozlabs.org/patch/243495/

Note that today there's problem or two in top of tree mainline on am335x (so BB Black, White, etc) but they'll be resolved shortly, and the above patches should backport easily to the tree Angstrom uses.

--
Tom

Juanjo

unread,
Jun 7, 2013, 8:41:19 PM6/7/13
to beagl...@googlegroups.com, ylla...@gmail.com
Robert Nelson has a patch for zImage loading.

http://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-U-BootPatches:

On Thursday, June 6, 2013 8:54:44 PM UTC-4, ylla...@gmail.com wrote:
Hey Tom!

I tried applying the patches and when the SPL tries to load the kernel it stops. The messages it outs are:

U-Boot SPL 2013.04-dirty (Jun 06 2013 - 12:32:32)
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
USB Host mode controller at 47401800 using PIO, IRQ 0
OMAP SD/MMC: 0
reading args
reading zImage
reading zImage

and then it gets stuck... my kernel is called zImage (a LZO compressed kernel). Is that perhaps the cause? Can the SPL uncompress the kernel or must it be in the uImage form?

Thanks in advance my friend.

Tom Rini

unread,
Jun 12, 2013, 9:30:55 AM6/12/13
to beagl...@googlegroups.com, ylla...@gmail.com
On Thursday, June 6, 2013 8:54:44 PM UTC-4, ylla...@gmail.com wrote:
Hey Tom!

I tried applying the patches and when the SPL tries to load the kernel it stops. The messages it outs are:

U-Boot SPL 2013.04-dirty (Jun 06 2013 - 12:32:32)
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
USB Host mode controller at 47401800 using PIO, IRQ 0
OMAP SD/MMC: 0
reading args
reading zImage
reading zImage

and then it gets stuck... my kernel is called zImage (a LZO compressed kernel). Is that perhaps the cause? Can the SPL uncompress the kernel or must it be in the uImage form?

I suspect that it only supports uImage right now.

--
Tom

ylla...@gmail.com

unread,
Jun 15, 2013, 1:25:16 PM6/15/13
to beagl...@googlegroups.com, ylla...@gmail.com
Tom, I've built a uImage kernel and tried booting to it. The kernel hangs while trying to match the machine ID, and it seems that something is gone amiss; here is the output from the boot process:

Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported machine ID (r1 = 0x00000e05).
Available machine support:
ID (hex)        NAME
ffffffff        Generic AM33XX (Flattened Device Tree)
ffffffff        Generic OMAP3-GP (Flattened Device Tree)
ffffffff        Generic OMAP3 (Flattened Device Tree)
0000060a        OMAP3 Beagle Board
Please check your kernel config and/or bootloader.

As you can see, the IDs are all set to '1' and of course they don't match the ones passed by the bootloader. Is that perhaps an error with the Flattened Device Tree, or an address error somewhere?

Thank you for the help!

daveh...@gmail.com

unread,
Aug 26, 2013, 5:59:35 PM8/26/13
to beagl...@googlegroups.com, ylla...@gmail.com
Wow, falcon mode looks really slick!  I've been hacking away at u-boot trying to get my system to boot faster, this looks cool!

I'm pretty new to some topics in Linux, and am having trouble patching the u-boot directory properly so that I can compile the new falcon-mode bootloader for the BeagleBone Black.  Can anyone give me some pointers for creating the new bootloaders?

 

Tom Rini

unread,
Aug 27, 2013, 11:42:34 AM8/27/13
to beagl...@googlegroups.com, ylla...@gmail.com, daveh...@gmail.com
On Monday, August 26, 2013 5:59:35 PM UTC-4, daveh...@gmail.com wrote:

Wow, falcon mode looks really slick!  I've been hacking away at u-boot trying to get my system to boot faster, this looks cool!

I'm pretty new to some topics in Linux, and am having trouble patching the u-boot directory properly so that I can compile the new falcon-mode bootloader for the BeagleBone Black.  Can anyone give me some pointers for creating the new bootloaders?

See  http://www.crashcourse.ca/wiki/index.php/U-Boot_on_the_BBB#Building_a_stock_u-boot_for_the_BBB and just use vanilla upstream.  The am335x_boneblack build target will use eMMC for environment, and has settings for falcon mode.

--
Tom

Robert P. J. Day

unread,
Aug 27, 2013, 12:39:02 PM8/27/13
to beagl...@googlegroups.com, ylla...@gmail.com, daveh...@gmail.com
guess i better to make sure that page is up to date. :-) and i'll
check what this falcon mode is all about.

rday

--

========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
Reply all
Reply to author
Forward
0 new messages