pretty code

2020年5月21日 星期四

The Delay in UEFI Shell Entry

I did a lot of tests in past two weeks. Due to our tool issue, we must reboot system after testing one bit. The system took 24 seconds to reboot, but our one bit test just took 55 ~ 56 seconds. This is a heavy wasting for completing a test. I cannot do any improvements for this issue because I am not the owner of this function. However, I can do another way to decrease the boot time.

In original UEFI Shell, it waits 5 seconds to prevent from user wants to stop launching the "startup.nsh". If we can decrease this time, it can also reduce our test time.

The UEFI Shell Entry is in "Root\ShellPkg\Application\Shell\Shell.c". We can search the key word "UefiMain" and we can find the setting is in this "ProcessCommandLine" function. The setting is stored in the "ShellInfoObject.ShellInitSettings.Delay" variable.

After modifying this variable, we can just wait 1 second, this can decrease 4 seconds in our one bit test time. It is not bad. Just for fun.


2020/05/21 Update

I am a stupid man. We can use "argv" to set up this delay time. This information is described in "3.2 Invocation" of "UEFI_Shell Specification". We can pass "-delay n" to UEFI Shell.

I thought one question when I ate lunch. How do I pass "-delay n" in boot time?  I think this is a good question. I don't know right now !

4 則留言:

Leo 提到...

Hi Sir,

在 ShellPkg\Application\Shell\Shell.c 有寫到一段話

"ShellOpt-options Options which control the initialization behavior of the shell. These options are read from the EFI global variable "ShellOpt" and are processed before options or file-name."

我在 https://blog.fpmurphy.com/2012/07/problems-with-uefi-shell-options.html 有看到有人實作, 我弄了一下, 好像有成功, 不過怪怪的.

你可以試試看!!

tylpk 提到...

Hi Leo,

非常感謝提供資訊,我後來也有在 Spec 看到 "ShellOpt" 的描述,但是現在暫時沒有需求。
由於我們的測試工具都會包一個 Shell 進去,故直接更動 Shell Binary 似乎最快。

感覺你們公司似乎也有拿 UEFI Shell 做一些事?是嗎?

Leo 提到...

Hi Sir,

很遺憾的是我公司並不在意測試, 很多都土法煉鋼的在作,
我弄這些都是我自己為了能找到下一間公司作準備的,

tylpk 提到...

Hi Leo,

我們是工程師,本來就應該聰明工作。

所以不用管公司的想法,做自己認為對的事就好,一起努力吧。