You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
Soemtimes when JTAG based debug is not available, it might be easier
to have Shell access in earlier stage to check lots of platform
settings. Today it is impossible because full Shell has lots of other
dependencies which might not satisfy in early stage. This patch added
a PCD PcdMiniShellEnabled to build a mini Shell with very few
dependencies. This mini Shell can be used in early debug phase for SBL.
To use it, add the following to override the PCD for a specific stage
in BootloaderCorePkg.dsc.
EX:
$(PLATFORM_PACKAGE)/Stage1B/Stage1B.inf {
<PcdsFeatureFlag>
gPlatformCommonLibTokenSpaceGuid.PcdMiniShellEnabled | TRUE
...
}
Then include ShellLib.h in stage C code and add ShellLib in related
stage INF file. If adding it into Stage1A, it needs to be after the
Stage1A banner print out.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
61 lines
1.8 KiB
C
61 lines
1.8 KiB
C
/** @file
|
|
|
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#include <Library/DebugLib.h>
|
|
#include <Library/ShellExtensionLib.h>
|
|
#include "ShellCmds.h"
|
|
#include "Shell.h"
|
|
|
|
/**
|
|
Load shell commands.
|
|
|
|
@param[in] Shell shell instance
|
|
|
|
@retval EFI_SUCCESS Shell command loaded successfully
|
|
|
|
**/
|
|
EFI_STATUS
|
|
LoadShellCommands (
|
|
IN SHELL *Shell
|
|
)
|
|
{
|
|
CONST SHELL_COMMAND **ShellExtensionCmds;
|
|
CONST SHELL_COMMAND **Iter;
|
|
|
|
// Basic Shell commands
|
|
ShellCommandRegister (Shell, &ShellCommandExit);
|
|
ShellCommandRegister (Shell, &ShellCommandHelp);
|
|
ShellCommandRegister (Shell, &ShellCommandMm);
|
|
ShellCommandRegister (Shell, &ShellCommandCpuid);
|
|
ShellCommandRegister (Shell, &ShellCommandMsr);
|
|
ShellCommandRegister (Shell, &ShellCommandMtrr);
|
|
ShellCommandRegister (Shell, &ShellCommandUcode);
|
|
ShellCommandRegister (Shell, &ShellCommandCls);
|
|
|
|
if (!FeaturePcdGet (PcdMiniShellEnabled)) {
|
|
// More Shell commands
|
|
ShellCommandRegister (Shell, &ShellCommandPci);
|
|
ShellCommandRegister (Shell, &ShellCommandHob);
|
|
ShellCommandRegister (Shell, &ShellCommandMmap);
|
|
ShellCommandRegister (Shell, &ShellCommandPerf);
|
|
ShellCommandRegister (Shell, &ShellCommandBoot);
|
|
ShellCommandRegister (Shell, &ShellCommandMmcDll);
|
|
ShellCommandRegister (Shell, &ShellCommandCdata);
|
|
ShellCommandRegister (Shell, &ShellCommandDmesg);
|
|
ShellCommandRegister (Shell, &ShellCommandReset);
|
|
ShellCommandRegister (Shell, &ShellCommandFs);
|
|
|
|
// Load Platform specific shell commands
|
|
ShellExtensionCmds = GetShellExtensionCmds ();
|
|
for (Iter = ShellExtensionCmds; *Iter != NULL; Iter++) {
|
|
ShellCommandRegister (Shell, *Iter);
|
|
}
|
|
}
|
|
|
|
return EFI_SUCCESS;
|
|
}
|