acidanthera / bugtracker

Acidanthera Bugtracker
385 stars 44 forks source link

OpenShell halts if more than 25 file systems #2005

Open joevt opened 2 years ago

joevt commented 2 years ago

I have an iMac14,2 (Late 2013) running debug version of OpenCore. When I launch OpenShell from OpenCore it does not start. The same problem occurs on my MacPro3,1 (Early 2008). config.plist.zip

The assert message I see (using Serial -> Init in config.plist to output debug messages to PCIe serial port in Thunderbolt enclosure) refers to: https://github.com/acidanthera/audk/blob/d2f79716cb67c0487433b159f882015773dd18b7/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c#L1359

It seems that it is adding three paths for every file system (FS0,…,FS9,FS10,…) to the path environment variable (like PATH in UNIX). The last set of paths that are successfully added are for FS24: FS24:\efitools\;FS24:\efiboot\;FS24:\ (total length 969 characters).

When it adds paths for FS25, the path length is 1009 characters which exceeds an arbitrary limit of the Mac's EFI so an Invalid Parameter result is returned and the path environment variable is cleared. Therefore, if it didn't halt, the final list of paths would only include paths for FS26 to FS36 (439 characters). I didn't check which file system OpenCore is installed on - one would hope it was the first file system FS0 but that's usually not true.

Suggestions:

Other issues:

Questions:

dakanji commented 2 years ago

./build_oc.tool seems to contain unnecessary sleep commands somewhere in the process

It doesn't have unnecessary sleep commands and I suspect the apparent pauses are from slow code such as this:

sym=$(find . -not -type d -not -path "./coreboot/*" -not -path "./UDK/*" -exec file "{}" ";" | grep CRLF)
if [ "${sym}" != "" ]; then
  echo "Repository $1 named $2 contains CRLF line endings"
  echo "$sym"
  exit 1
fi
joevt commented 2 years ago

I believe the grep CRLF check is a one time thing so you shouldn't see it for every build.

The sleep commands are not in ./build_oc.tool, but they are somewhere in the processes used by build_oc.tool. Actually, there is a sleep command in the same file you quoted from: https://github.com/acidanthera/ocbuild/blob/d441ce6fd324e5087394e740828866370058f4f4/efibuild.sh#L59 build_oc.tool downloads efibuild.sh and executes it. It does not keep a copy of efibuild.sh. The sleep command in efibuild.sh is the one I've been encountering. Looking at the script now, I can see that the sleep command is not unnecessary and it is not waisting time. The buildme function executes the build command in the background. It also calls pingme in the background to output a period . every 30 seconds and it will stop the build if it takes longer than 200 seconds. buildme will stop pingme when the build command is done. I suppose pingme would be better if it output a period . every second, to make it appear that it's doing something. In that case the output would look like this (on my MacPro3,1 - faster computers may have fewer periods):

OK
Building...
Building OpenCorePkg/OpenCorePkg.dsc for X64 in DEBUG with XCODE5 and flags  ...
.................... - OK
Building OpenCorePkg/OpenCorePkg.dsc for X64 in RELEASE with XCODE5 and flags  ...
.............................. - OK
Building OpenCorePkg/OpenCorePkg.dsc for X64 in NOOPT with XCODE5 and flags  ...
................... - OK
Building OpenCorePkg/OpenCorePkg.dsc for IA32 in DEBUG with XCODE5 and flags  ...
................... - OK
Building OpenCorePkg/OpenCorePkg.dsc for IA32 in RELEASE with XCODE5 and flags  ...
............................... - OK
Building OpenCorePkg/OpenCorePkg.dsc for IA32 in NOOPT with XCODE5 and flags  ...
.................... - OK
./build_oc.tool: line 788: 17760 Terminated: 15          pingme $! build "$@"  (wd: /Volumes/Work/Programming/EFIProjects/OpenCorePkg/acidanthera-OpenCorePkg/UDK)

To speed up the build, you can choose to build only X64 DEBUG and skip the tests and package builds:

ARCHS=X64
TARGETS=DEBUG
export ARCHS
export TARGETS
time ./build_oc.tool --skip-tests --skip-package 2>&1

I added redirect of stderr to stdout 2>&1 so that stdout and stderr messages appear in the correct order in the terminal.

The arguments passed to build_oc.tool are actually parsed by efibuild.sh. This works because efibuild.sh is executed using eval which makes all the arguments and variables and functions of build_oc.tool available to efibuild.sh.