blob: 8953919825409f9051112dab25e3b761cdc45bf7 [file] [log] [blame]
/*
* Copyright 2014 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; 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include "drivers/console/display.h"
#include "net/gigaboot/gigaboot.h"
#include "net/netboot/netboot.h"
#include "net/netboot/params.h"
/*
* These are the real implementations for developer-build features that override
* the symbols from stubs.c. They must never be linked into production images!
*/
GigabootBuffer *gigaboot_get_buffer(const char *name, size_t size)
{
static GigabootBuffer kernel = {
.data = (void *)(uintptr_t)CONFIG_KERNEL_START,
.size = CONFIG_KERNEL_SIZE,
};
static char cmdline_buf[4096];
static GigabootBuffer cmdline = {
.data = cmdline_buf,
.size = sizeof(cmdline_buf),
};
if (!strcmp(name, gigaboot_buffer_kernel))
return &kernel;
if (!strcmp(name, gigaboot_buffer_cmdline))
return &cmdline;
return NULL;
}
void dc_dev_netboot(void)
{
if (CONFIG_DRIVER_CONSOLE_DISPLAY)
display_console_attach();
if (CONFIG_GIGABOOT)
gigaboot();
else
netboot(NULL, 0);
}