/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <libintl.h>
#include <sys/multiboot.h>
#include <sys/sysmacros.h>
#include "bblk_einfo.h"
#include "boot_utils.h"
#include "mboot_extra.h"
/*
* Common functions to deal with the fake-multiboot encapsulation of the
* bootblock and the location of the extra information area.
*/
/* mboot checksum routine. */
{
int i;
return (-cksum);
}
/* Given a buffer, look for a multiboot header within it. */
int
{
int i = 0;
*mboot_off = 0;
/* multiboot header has to be within the first 32K. */
continue;
/* Found magic signature -- check checksum. */
BOOT_DEBUG("multiboot magic found at %p, but checksum "
"mismatches (is %x, should be %x)\n", mboot,
continue;
} else {
BOOT_DEBUG("multiboot structure found, but no "
"AOUT kludge specified, skipping.\n");
continue;
} else {
/* proper multiboot structure found. */
*mboot_off = i;
return (BC_SUCCESS);
}
}
}
return (BC_ERROR);
}
/*
* Given a pointer to the extra information area (a sequence of bb_header_ext_t
* + payload chunks), find the extended information structure.
*/
{
BOOT_DEBUG("Unable to find extended versioning information, "
"data size too big\n");
return (NULL);
}
ext_header->size);
BOOT_DEBUG("Unable to find extended versioning information, "
"data looks corrupted\n");
return (NULL);
}
/*
* Currently we only have one extra header so it must be encapsulating
* the extended information structure.
*/
BOOT_DEBUG("Unable to read stage2 extended versioning "
"information, wrong magic identifier\n");
return (NULL);
}
return (einfo);
}
/*
* Given a pointer to the extra area, add the extended information structure
* encapsulated by a bb_header_ext_t structure.
*/
void
{
unsigned char *dest;
int ret;
BOOT_DEBUG("WARNING: no update string passed to "
"add_stage2_einfo()\n");
return;
}
/* Reserve space for the extra header. */
/* Place the extended information structure. */
&used_space);
if (ret != 0) {
"versioning information\n"));
return;
}
/* Fill the extended information associated header. */
}