Convert prep to use the new unified mkbootimage rather than it's own. This

mkbootimage can be shared by prep, rs6000, and bebox.

TODO: Convert bebox to use this.  Needs someone to test.
This commit is contained in:
garbled 2008-04-30 21:15:33 +00:00
parent 95369fc30f
commit c3408ed04a
11 changed files with 54 additions and 29 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.10 2006/03/23 18:51:19 garbled Exp $
# $NetBSD: Makefile.inc,v 1.11 2008/04/30 21:15:33 garbled Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@ -13,7 +13,8 @@ TMPKERNEL= ${.OBJDIR}/netbsd
${IMAGE}: ${KERNEL}
gzip -cd ${KERNEL} > ${TMPKERNEL}
${TOOL_PREPMKBOOTIMAGE} -b ${BOOTLOADER} -k ${TMPKERNEL} ${.TARGET}
${TOOL_POWERPCMKBOOTIMAGE} -m ${MACHINE} -b ${BOOTLOADER} \
-k ${TMPKERNEL} ${.TARGET}
-rm -f ${TMPKERNEL}
KFILES= ${IMAGE}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mkbootimage.8,v 1.3 2008/04/30 13:10:58 martin Exp $
.\" $NetBSD: mkbootimage.8,v 1.4 2008/04/30 21:15:33 garbled Exp $
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
@ -26,7 +26,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 23, 2006
.Dd April 30, 2008
.Dt MKBOOTIMAGE 8
.Os
.Sh NAME
@ -34,15 +34,17 @@
.Nd create a prep boot image
.Sh SYNOPSIS
.Nm
.Op Fl ls
.Op Fl lsv
.Op Fl m Ar machine_arch
.Op Fl b Ar bootfile
.Op Fl k Ar kernel
.Op Fl r Ar rawdev
.Ar boot-image
.Sh DESCRIPTION
.Nm
is the utility used to create a bootable prep kernel image on
.Nx .
is the utility used to create a bootable kernel image on
.Nx
for prep, bebox or rs6000.
.Pp
The
.Nm
@ -69,12 +71,20 @@ Defaults to
.It Fl l
Creates a partition table for a 2.88MB floppy instead of a 1.44MB floppy.
This is primarily used for El-Torrito style CD images.
.It Fl m
Selects the machine architecture to build the image for.
Currently supports prep, rs6000 and bebox.
Defaults to the machine architecture you are currently running on.
This option is required if you are building an image for another machine, such
as building a prep boot image on i386.
.It Fl r
Specifies the raw device to read to gather the current partition table.
This is generally
.Pa /dev/rsd0c .
.It Fl s
Generates a standalone image with no partition table embedded.
.It Fl v
Generates verbose output, useful for debugging.
.El
.Pp
There are three primary ways to use
@ -118,11 +128,11 @@ You may then use the other partitions for your normal disk layout.
The PReP boot partition can be placed anywhere on the disk, but it is
recommended that it be placed at the beginning of the disk.
.Sh EXAMPLES
Create a floppy or netboot image named
Create a floppy or netboot image for prep named
.Sq boot.fs :
.Dl Ic mkbootimage -b /usr/mdec/boot -k /netbsd boot.fs
Create a standalone image for booting from a hard disk:
.Dl Ic mkbootimage -s -b /usr/mdec/boot -k /netbsd boot.fs
.Dl Ic mkbootimage -m prep -b /usr/mdec/boot -k /netbsd boot.fs
Create a standalone bebox image for booting from a hard disk:
.Dl Ic mkbootimage -s -m bebox -b /usr/mdec/boot -k /netbsd boot.fs
Use the partition information on
.Sq sd0
to create a new bootable image with com0 as the console:

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.204 2008/03/31 02:42:27 lukem Exp $
# $NetBSD: bsd.README,v 1.205 2008/04/30 21:15:33 garbled Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new (as of 1993) make "include" files
@ -1379,7 +1379,7 @@ TOOL_PAX Manipulate file archives and copy directories. [pax]
TOOL_PIC Compile pictures for groff. [pic]
TOOL_PREPMKBOOTIMAGE prep-mkbootimage (XXXBUILDSH). [prep-mkbootimage]
TOOL_POWERPCMKBOOTIMAGE powerpc-mkbootimage (XXXBUILDSH). [powerpc-mkbootimage]
TOOL_PWD_MKDB Generate the password databases. [pwd_mkdb]

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.own.mk,v 1.505 2008/03/31 02:42:27 lukem Exp $
# $NetBSD: bsd.own.mk,v 1.506 2008/04/30 21:15:33 garbled Exp $
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
@ -243,7 +243,7 @@ TOOL_MSGC= MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
TOOL_MTREE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
TOOL_PAX= ${TOOLDIR}/bin/${_TOOL_PREFIX}pax
TOOL_PIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}pic
TOOL_PREPMKBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}prep-mkbootimage
TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage
TOOL_PWD_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb
TOOL_REFER= ${TOOLDIR}/bin/${_TOOL_PREFIX}refer
TOOL_ROFF_ASCII= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.sys.mk,v 1.162 2008/04/22 12:47:59 tsutsui Exp $
# $NetBSD: bsd.sys.mk,v 1.163 2008/04/30 21:15:33 garbled Exp $
#
# Build definitions used for NetBSD source tree builds.
@ -166,7 +166,7 @@ TOOL_MSGC?= msgc
TOOL_MTREE?= mtree
TOOL_PAX?= pax
TOOL_PIC?= pic
TOOL_PREPMKBOOTIMAGE?= prep-mkbootimage
TOOL_POWERPCMKBOOTIMAGE?= powerpc-mkbootimage
TOOL_PWD_MKDB?= pwd_mkdb
TOOL_REFER?= refer
TOOL_ROFF_ASCII?= nroff

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.9 2008/03/04 08:12:12 mrg Exp $
# $NetBSD: Makefile,v 1.10 2008/04/30 21:15:33 garbled Exp $
SUBDIR= include .WAIT include/ibm4xx include/oea
SUBDIR= include .WAIT include/ibm4xx include/oea stand
.include <bsd.kinc.mk>

View File

@ -1,5 +1,6 @@
# $NetBSD: Makefile,v 1.1 2007/12/18 18:19:07 garbled Exp $
# $NetBSD: Makefile,v 1.2 2008/04/30 21:15:33 garbled Exp $
BINDIR= /usr/mdec
PROG= mkbootimage
SRCS= mkbootimage.c byteorder.c
NOMAN= # defined

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkbootimage.c,v 1.8 2008/04/28 20:23:32 martin Exp $ */
/* $NetBSD: mkbootimage.c,v 1.9 2008/04/30 21:15:33 garbled Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -47,8 +47,13 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/signal.h>
#ifdef __NetBSD__
#undef USE_SYSCTL
#if defined(__NetBSD__) && !defined(HAVE_NBTOOL_CONFIG_H)
#define USE_SYSCTL 1
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
#endif
@ -119,7 +124,7 @@ usage(int extended)
fprintf(stderr, " %s", sup_plats[i]);
fprintf(stderr, "\n\n");
}
#ifdef __NetBSD__
#ifdef USE_SYSCTL
fprintf(stderr, "usage: %s [-lsv] [-m machine_arch] [-b bootfile] "
"[-k kernel] [-r rawdev] bootimage\n", getprogname());
#else
@ -822,7 +827,7 @@ main(int argc, char **argv)
int ch, lfloppyflag=0;
char *kernel = NULL, *boot = NULL, *rawdev = NULL, *outname = NULL;
char *march = NULL;
#ifdef __NetBSD__
#ifdef USE_SYSCTL
char machine_arch[SYS_NMLN];
int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
#endif
@ -874,7 +879,7 @@ main(int argc, char **argv)
march = NULL;
if (march == NULL) {
int i;
#ifdef __NetBSD__
#ifdef USE_SYSCTL
size_t len = sizeof(machine_arch);
if (sysctl(mib, sizeof (mib) / sizeof (mib[0]), machine_arch,

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.6 2006/06/27 23:26:13 garbled Exp $
# $NetBSD: Makefile,v 1.7 2008/04/30 21:15:33 garbled Exp $
SUBDIR= common .WAIT boot_com0 boot_com0_vreset boot mkbootimage #installboot
SUBDIR= common .WAIT boot_com0 boot_com0_vreset boot #mkbootimage installboot
.include <bsd.subdir.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.114 2007/11/12 14:54:43 jmmv Exp $
# $NetBSD: Makefile,v 1.115 2008/04/30 21:15:33 garbled Exp $
.include <bsd.own.mk>
@ -64,7 +64,7 @@ SUBDIR+= macppc-fixcoff
.endif
.if ${MACHINE} == "prep"
SUBDIR+= prep-mkbootimage
SUBDIR+= powerpc-mkbootimage
.endif
.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2008/04/30 21:15:33 garbled Exp $
HOSTPROGNAME= ${_TOOL_PREFIX}powerpc-mkbootimage
HOST_SRCDIR= sys/arch/powerpc/stand/mkbootimage
HOST_CPPFLAGS+= -I${.CURDIR}
.include "${.CURDIR}/../Makefile.host"