Merge branch 'sandbox' of git://git.denx.de/u-boot-x86

This commit is contained in:
Tom Rini 2015-02-16 08:37:22 -05:00
commit 9577639185
7 changed files with 43 additions and 33 deletions

View File

@ -5,10 +5,16 @@ PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM -DCONFIG_SYS_GENERIC_BOARD
PLATFORM_LIBS += -lrt
# Define this to avoid linking with SDL, which requires SDL libraries
# This can solve 'sdl-config: Command not found' errors
ifneq ($(NO_SDL),)
PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
else
ifdef CONFIG_SANDBOX_SDL
PLATFORM_LIBS += $(shell sdl-config --libs)
PLATFORM_CPPFLAGS += $(shell sdl-config --cflags)
endif
endif
# Support generic board on sandbox
__HAVE_ARCH_GENERIC_BOARD := y
@ -18,9 +24,3 @@ cmd_u-boot__ = $(CC) -o $@ -T u-boot.lds \
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
CONFIG_ARCH_DEVICE_TREE := sandbox
# Define this to avoid linking with SDL, which requires SDL libraries
# This can solve 'sdl-config: Command not found' errors
ifneq ($(NO_SDL),)
PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
endif

View File

@ -78,11 +78,13 @@ int sandbox_main_loop_init(void)
/* Execute command if required */
if (state->cmd) {
int retval;
cli_init();
run_command_list(state->cmd, -1, 0);
retval = run_command_list(state->cmd, -1, 0);
if (!state->interactive)
os_exit(state->exit_type);
os_exit(retval);
}
return 0;

View File

@ -13,11 +13,6 @@
static struct sandbox_state main_state;
static struct sandbox_state *state; /* Pointer to current state record */
void state_record_exit(enum exit_type_id exit_type)
{
state->exit_type = exit_type;
}
static int state_ensure_space(int extra_size)
{
void *blob = state->state_fdt;

View File

@ -10,13 +10,6 @@
#include <stdbool.h>
#include <linux/stringify.h>
/* How we exited U-Boot */
enum exit_type_id {
STATE_EXIT_NORMAL,
STATE_EXIT_COLD_REBOOT,
STATE_EXIT_POWER_OFF,
};
/**
* Selects the behavior of the serial terminal.
*
@ -50,7 +43,6 @@ struct sandbox_state {
const char *cmd; /* Command to execute */
bool interactive; /* Enable cmdline after execute */
const char *fdt_fname; /* Filename of FDT binary */
enum exit_type_id exit_type; /* How we exited U-Boot */
const char *parse_err; /* Error to report from parsing */
int argc; /* Program arguments */
char **argv; /* Command line arguments */
@ -138,13 +130,6 @@ struct sandbox_state_io {
.compat = _compat, \
}
/**
* Record the exit type to be reported by the test program.
*
* @param exit_type Exit type to record
*/
void state_record_exit(enum exit_type_id exit_type);
/**
* Gets a pointer to the current state.
*

View File

@ -197,13 +197,14 @@ class Toolchains:
Returns:
Filename of C compiler if found, else None
"""
fnames = []
for subdir in ['.', 'bin', 'usr/bin']:
dirname = os.path.join(path, subdir)
if verbose: print " - looking in '%s'" % dirname
for fname in glob.glob(dirname + '/*gcc'):
if verbose: print " - found '%s'" % fname
return fname
return None
fnames.append(fname)
return fnames
def Scan(self, verbose):
@ -219,8 +220,8 @@ class Toolchains:
if verbose: print 'Scanning for tool chains'
for path in self.paths:
if verbose: print " - scanning path '%s'" % path
fname = self.ScanPath(path, verbose)
if fname:
fnames = self.ScanPath(path, verbose)
for fname in fnames:
self.Add(fname, True, verbose)
def List(self):

View File

@ -129,7 +129,7 @@ def GetUpstream(git_dir, branch):
return upstream, msg
if remote == '.':
return merge
return merge, None
elif remote and merge:
leaf = merge.split('/')[-1]
return '%s/%s' % (remote, leaf), None

View File

@ -235,6 +235,31 @@ def _UpdateDefaults(parser, config):
else:
print "WARNING: Unknown setting %s" % name
def _ReadAliasFile(fname):
"""Read in the U-Boot git alias file if it exists.
Args:
fname: Filename to read.
"""
if os.path.exists(fname):
bad_line = None
with open(fname) as fd:
linenum = 0
for line in fd:
linenum += 1
line = line.strip()
if not line or line.startswith('#'):
continue
words = line.split(' ', 2)
if len(words) < 3 or words[0] != 'alias':
if not bad_line:
bad_line = "%s:%d:Invalid line '%s'" % (fname, linenum,
line)
continue
alias[words[1]] = [s.strip() for s in words[2].split(',')]
if bad_line:
print bad_line
def Setup(parser, project_name, config_fname=''):
"""Set up the settings module by reading config files.
@ -244,6 +269,8 @@ def Setup(parser, project_name, config_fname=''):
for sections named "project_section" as well.
config_fname: Config filename to read ('' for default)
"""
# First read the git alias file if available
_ReadAliasFile('doc/git-mailrc')
config = _ProjectConfigParser(project_name)
if config_fname == '':
config_fname = '%s/.patman' % os.getenv('HOME')