OpenBMC Boot time improvements

Dhananjay Phadke dphadke at
Wed Sep 14 05:34:04 AEST 2022

On 9/12/2022 2:56 PM, Patrick Williams wrote:
 > On Mon, Sep 12, 2022 at 01:32:19PM -0700, Ed Tanous wrote:
 >> Decompressing the dtb, initramfs, and kernel images is seconds 5-14.  If
 >> there's a way to optimize that better that u-bmc has implemented 
ahead of
 >> us, that seems like an area for improvement that we could pull in.
 > I switched some systems to use zstd instead of xz.  I'm not sure if that
 > was done as a default or not, but it is significantly faster for
 > decompression.

 > Kernel starts at ~20 seconds, then 3.5 seconds of dead air... not sure
 > what's going on there.

Uhh, no. There's no decompression in u-boot, and kernel doesn't even
start until 19s. Much of the time is spent by u-boot in loading FIT
from flash.

[5.043504 0.000782]      Type:         Kernel Image
[5.044270 0.000766]      Compression:  uncompressed

[11.636475 0.000980]      Type:         RAMDisk Image
[11.637248 0.000773]      Compression:  uncompressed

[19.914196 0.000063] Starting kernel ...

While enabling compression in FIT image can reduce flash read time, 
based on my experimentation arm32 doesn't do well with decompression so 
that time is somewhat compensated.


(1) Don't know what u-boot code you're running, but if you have
following patch series included, I hoped spi-mem might work better
by using spi-mem, where Aspeed's SPI controller's command mode
implicitly generates command and address based and CPU accesses,
instead of driver.

[13.909357 2.254427] ## Loading fdt from FIT Image at 20080000 ...

(2) I found that libfdt in u-boot (loading FIT) and crypto lib don't
perform well while booting directly from flash. I've a proposal which
I'll send patch for is to do read out FIT image into RAM and then
run bootm on mem address.

In fact, there's infra in upstream u-boot [see
cmd/disk.c:common_diskboot()] that reads FIT header to determine total
size and reads that to memory.

 > First serial line printed to u-boot "hit any key" startup init is 3
 > seconds
 > 3 seconds of countdown for "hit any key to stop autoboot".  I'm sure
 > u-boot has a way to disable that, so there's 3 seconds right there.

Default should be to allow shell for debug, while prod builds can turn
it off just like gbmc already does?

- meta-phosphor/recipes-bsp/u-boot/
   - meta-phosphor/recipes-bsp/u-boot/files/disable-u-boot-shell.cfg

I've some more thoughts on boot optimization, will post some changes.


More information about the openbmc mailing list