Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fwts_coreboot.c: add fwts_coreboot_cbmem_console_dump() #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/include/fwts.h
Expand Up @@ -89,6 +89,7 @@
#include "fwts_arch.h"
#include "fwts_checkeuid.h"
#include "fwts_clog.h"
#include "fwts_coreboot.h"
#include "fwts_cpu.h"
#include "fwts_dump.h"
#include "fwts_dump_data.h"
Expand Down
35 changes: 35 additions & 0 deletions src/lib/include/fwts_coreboot.h
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2010-2018 Canonical
* Copyright (C) 2017 Google Inc.
* Copyright (C) 2018 9elements Cyber Security
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#ifndef __FWTS_COREBOOT_H__
#define __FWTS_COREBOOT_H__

#include "fwts.h"

#ifdef FWTS_ARCH_INTEL

extern char *fwts_coreboot_cbmem_console_dump(void);

#endif

fwts_list* fwts_coreboot_cbmem_log(void);

#endif
2 changes: 2 additions & 0 deletions src/lib/src/Makefile.am
Expand Up @@ -61,6 +61,8 @@ libfwts_la_SOURCES = \
fwts_checksum.c \
fwts_clog.c \
fwts_cmos.c \
fwts_coreboot.c \
fwts_coreboot_cbmem.c \
fwts_cpu.c \
fwts_dump.c \
fwts_dump_data.c \
Expand Down
3 changes: 2 additions & 1 deletion src/lib/src/fwts_clog.c
Expand Up @@ -68,7 +68,6 @@ bool fwts_clog_available(fwts_framework *fw)

/*
* read coreboot log and return as list of lines
* TODO: find coreboot log in /dev/mem
*/
fwts_list *fwts_clog_read(fwts_framework *fw)
{
Expand All @@ -78,6 +77,8 @@ fwts_list *fwts_clog_read(fwts_framework *fw)
return list;
if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) != NULL)
return list;
if ((list = fwts_coreboot_cbmem_log()) != NULL)
return list;

return NULL;
}
Expand Down
52 changes: 52 additions & 0 deletions src/lib/src/fwts_coreboot.c
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2010-2018 Canonical
* Copyright (C) 2017 Google Inc.
* Copyright (C) 2018 9elements Cyber Security
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "fwts.h"

#ifdef FWTS_ARCH_INTEL

fwts_list* fwts_coreboot_cbmem_log(void)
{
fwts_list *console_list;
char *console;

console = fwts_coreboot_cbmem_console_dump();

if (!console)
return NULL;

console_list = fwts_list_from_text(console);
free(console);

return console_list;
}

#else

fwts_list* fwts_coreboot_cbmem_log(void)
{
/*
* TODO: add arm plattform support
*/
return NULL;
}

#endif