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

Conversation

sylv-io
Copy link
Collaborator

@sylv-io sylv-io commented Jul 10, 2018

No description provided.

@sylv-io sylv-io force-pushed the squash_cbmem branch 2 times, most recently from 639faec to cd1ce41 Compare July 10, 2018 14:43

#include "fwts.h"

fwts_list* fwts_coreboot_cbmem_log(void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ on next line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

struct lb_record {
uint32_t tag; /* tag ID */
uint32_t size; /* size of record (in bytes) */
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on all structs: attribute ((packed))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


mem = malloc(size);

if (!mem)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwts_munmap(phy, size);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


count = memconsole_coreboot_read(console, coreboot_log, 0, console_p->size-1);
if (count == 0) {
free(console_p);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

free(coreboot_log);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

free(console_p);
return NULL;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

free(console_p);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return NULL;
}

coreboot_log = malloc(console_p->size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console->size

return NULL;
}

memset(coreboot_log, '\0', console_p->size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console->size

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


memset(coreboot_log, '\0', console_p->size);

count = memconsole_coreboot_read(console, coreboot_log, 0, console_p->size-1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console->size

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sylv-io sylv-io force-pushed the squash_cbmem branch 2 times, most recently from e053ae6 to e8149a5 Compare July 17, 2018 08:05
Parse the full coreboot console log out of /dev/mem, if the google
kernel module is not loaded. Does only work on x86 plattform.

Todo:
- add arm plattform support

Tested with:
- Lenovo thinkpad t410
- Qemu x86

The code is based on:
- google kernel module memconsole-coreboot
- coreboot util/cbmem https://review.coreboot.org/coreboot.git

Signed-off-by: Marcello Sylvester Bauer <info@marcellobauer.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants