From 4cea3a19f886cf8154af235fb233dc35cd60d0ea Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Mon, 13 Aug 2018 15:24:30 -0700 Subject: Add support for ram payloads This is enabled by CONFIG_RAMPAYLOAD. The code will look for a ram payload and, if it is found, try to run it. If the load fails or the payload returns it will continue with ramstage. We also include a new payload, linuxcheck, which is intended to verify that linux can be loaded and run, e.g. as a LinuxBoot payload. Currently, it fails. This does not yet work but it makes sense as a foundation on which to build. For one thing, we need to build at least a few tables for Linux. The goal for LinuxBoot is to build as few as possible. To test with linuxcheck (linux is not even close to working): cd payloads/linuxcheck/ cp x86config .config make cd ../.. make ./build/cbfstool build/coreboot.rom add-payload -n fallback/rampayload -f payloads/linuxcheck/linuxcheck.elf qemu-system-x86_64 -nographic -m 8192 -bios build/coreboot.rom -monitor /dev/pts/$1 -s We need to change the payload menu so we can add a rampayload but it's a bit tricky as written, so that must come later. Note that I'm still creating a special purpose romselfboot. The idea of merging romselfboot and selfboot is probably a good idea -- in the future. I think until we know how this should look, such a merge is premature. Signed-off-by: Ronald G. Minnich Change-Id: I8199aae6776f6dee969b370b0e6a41ef96e854d8 clang-formatted-by: Ronald G. Minnich Reviewed-on: https://review.coreboot.org/28402 Reviewed-by: Philipp Deppenwiese Tested-by: Philipp Deppenwiese --- payloads/linuxcheck/linuxcheck.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 payloads/linuxcheck/linuxcheck.c (limited to 'payloads/linuxcheck/linuxcheck.c') diff --git a/payloads/linuxcheck/linuxcheck.c b/payloads/linuxcheck/linuxcheck.c new file mode 100644 index 000000000000..516df45b84d8 --- /dev/null +++ b/payloads/linuxcheck/linuxcheck.c @@ -0,0 +1,43 @@ +/* + * This file is part of the coreinfo project. + * + * Copyright (C) 2018 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + */ + +#include +#include + +extern struct console_output_driver *console_out; +extern struct sysinfo_t lib_sysinfo; +static void buts(char *s) +{ + int i; + for (i = 0; i < strlen(s); i++) + outb(s[i], 0x3f8); +} +int main(void) +{ + buts("Greetings from linuxcheck, via hard-coded calls to serial functions.\n"); + if (console_out == NULL) + buts("Bad news: console_out is NULL\n"); + if (lib_sysinfo.serial == NULL) + buts("Bad news: lib_sysinfo.serial is NULL. Very little will work well.\n"); + buts("The next line should be puts works\n"); + puts("puts works\n"); + buts("If you did not see puts works, then you have a console issues\n"); + buts("The next line should be 'printf works'\n"); + printf("printf works\n"); + buts(" ... if you did not see printf works, then you have a printf issue\n"); + buts("Now we will halt. Bye"); + halt(); + return 0; +} -- cgit v1.2.3