199767f8919635c4928607450d9e0abb932109ceToomas Soome * This file and its contents are supplied under the terms of the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Common Development and Distribution License ("CDDL"), version 1.0.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You may only use this file in accordance with the terms of version
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1.0 of the CDDL.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * A full copy of the text of the CDDL should have accompanied this
199767f8919635c4928607450d9e0abb932109ceToomas Soome * source. A copy of the CDDL is also available via the Internet at
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright 2015 Toomas Soome <tsoome@me.com>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Chain loader to load BIOS boot block either from MBR or PBR.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Note the boot block location 0000:7c000 conflicts with loader, so we need to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * read in to temporary space and relocate on exec, when btx is stopped.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The MBR/VBR is located in first sector of disk/partition.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read 512B to temporary location and set up relocation. Then
199767f8919635c4928607450d9e0abb932109ceToomas Soome * exec relocator.
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(chain, "chain", "chain load boot block from device", command_chain);
199767f8919635c4928607450d9e0abb932109ceToomas Soome command_errmsg = "no device or file name specified";
199767f8919635c4928607450d9e0abb932109ceToomas Soome i386_getdev((void **)(&rootdev), argv[1], NULL);
199767f8919635c4928607450d9e0abb932109ceToomas Soome command_errmsg = "can't determine root device";
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (archsw.arch_readin(fd, mem, size) != size) {