x86 hd image creator

A script that creates a HD image ready to be booted by an x86
emulator, ready to work in a crossbuild environment.

It's really just for qemu/kvm as there's no boot code in
the MBR and no bootloader installed so we rely on the in-kvm
multiboot implementation for now. This is very convenient for
passing args too.

To minimize reliance on external tools, we use the Minix
'partition' utility to write the partition table of the HD
image, which therefore has to be compiled natively.

	. new script releasetools/x86_hdimage.sh
	. natively compile minix 'partition' utility
	. make <machine/partition.h> 64-bit safe for it

Change-Id: If645b4691536752271e0b8a8ed59a34f248dace4
This commit is contained in:
Ben Gras
2013-09-24 15:15:55 +02:00
committed by Gerrit Code Review
parent 9dfbfc9af7
commit a9db0ea184
8 changed files with 228 additions and 32 deletions

View File

@@ -2,17 +2,19 @@
#ifndef _PARTITION_H
#define _PARTITION_H
#include <stdint.h>
struct part_entry {
unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
unsigned char start_head; /* head value for first sector */
unsigned char start_sec; /* sector value + cyl bits for first sector */
unsigned char start_cyl; /* track value for first sector */
unsigned char sysind; /* system indicator */
unsigned char last_head; /* head value for last sector */
unsigned char last_sec; /* sector value + cyl bits for last sector */
unsigned char last_cyl; /* track value for last sector */
unsigned long lowsec; /* logical first sector */
unsigned long size; /* size of partition in sectors */
uint8_t bootind; /* boot indicator 0/ACTIVE_FLAG */
uint8_t start_head; /* head value for first sector */
uint8_t start_sec; /* sector value + cyl bits for first sector */
uint8_t start_cyl; /* track value for first sector */
uint8_t sysind; /* system indicator */
uint8_t last_head; /* head value for last sector */
uint8_t last_sec; /* sector value + cyl bits for last sector */
uint8_t last_cyl; /* track value for last sector */
uint32_t lowsec; /* logical first sector */
uint32_t size; /* size of partition in sectors */
};
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */

View File

@@ -2,17 +2,19 @@
#ifndef _PARTITION_H
#define _PARTITION_H
#include <stdint.h>
struct part_entry {
unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
unsigned char start_head; /* head value for first sector */
unsigned char start_sec; /* sector value + cyl bits for first sector */
unsigned char start_cyl; /* track value for first sector */
unsigned char sysind; /* system indicator */
unsigned char last_head; /* head value for last sector */
unsigned char last_sec; /* sector value + cyl bits for last sector */
unsigned char last_cyl; /* track value for last sector */
unsigned long lowsec; /* logical first sector */
unsigned long size; /* size of partition in sectors */
uint8_t bootind; /* boot indicator 0/ACTIVE_FLAG */
uint8_t start_head; /* head value for first sector */
uint8_t start_sec; /* sector value + cyl bits for first sector */
uint8_t start_cyl; /* track value for first sector */
uint8_t sysind; /* system indicator */
uint8_t last_head; /* head value for last sector */
uint8_t last_sec; /* sector value + cyl bits for last sector */
uint8_t last_cyl; /* track value for last sector */
uint32_t lowsec; /* logical first sector */
uint32_t size; /* size of partition in sectors */
};
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */