/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2016 Toomas Soome <tsoome@me.com>
*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/sysmacros.h>
#include <sys/multiboot.h>
#include "bblk_einfo.h"
#include "boot_utils.h"
#include "mboot_extra.h"
/*
* Add version to loader bootblock file. The file should have fake
* multiboot header and version data will be added at the end of the file.
* MB header is fake in sense that this bootblock is *not* MB compatible,
* and MB header will only include load_addr and load_end_addr components.
* load_addr will be set to value 0 to indicate the beginning of the file
* and load_end_addr will be set to the size of the original file.
* The flags value in header must be exactly AOUT kludge.
*
* version data is aligned by 8 bytes and whole blootblock will be padded to
* 512B sector size.
*
* To use and verify version data, first find MB header, then load_end_addr
* will point to the end of the original file, aligned up by 8, is version
* data implemented as bblk einfo.
*/
void
{
int fd;
int ret;
char *buf;
if (fd == -1) {
perror("open");
return;
}
perror("fstat");
return;
}
/*
* make sure we have enough space to append EINFO.
*/
perror("malloc");
return;
}
/*
* read in whole file. we need to access MB header and einfo
* will create MD5 hash.
*/
perror("read");
return;
}
!= BC_SUCCESS) {
printf("Unable to find multiboot header\n");
return;
}
/*
* this is location for EINFO data
*/
if (fd == -1) {
perror("open");
return;
}
}