diff --git a/distrib/prep/floppies/bootfloppy-common/Makefile.inc b/distrib/prep/floppies/bootfloppy-common/Makefile.inc index d797df10895e..e6a76cd43ff6 100644 --- a/distrib/prep/floppies/bootfloppy-common/Makefile.inc +++ b/distrib/prep/floppies/bootfloppy-common/Makefile.inc @@ -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 .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} diff --git a/share/man/man8/man8.prep/mkbootimage.8 b/share/man/man8/man8.prep/mkbootimage.8 index cd0f26e6ca79..f1df74a9ee3d 100644 --- a/share/man/man8/man8.prep/mkbootimage.8 +++ b/share/man/man8/man8.prep/mkbootimage.8 @@ -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: diff --git a/share/mk/bsd.README b/share/mk/bsd.README index fdbd562f8260..fef2c3799a2c 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -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] diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 7583cedb3bd7..bbc13007cae0 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -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 diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index dbe621dd418d..b64597001456 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -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 diff --git a/sys/arch/powerpc/Makefile b/sys/arch/powerpc/Makefile index ff17bf892e12..2c568626c2c2 100644 --- a/sys/arch/powerpc/Makefile +++ b/sys/arch/powerpc/Makefile @@ -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 diff --git a/sys/arch/powerpc/stand/mkbootimage/Makefile b/sys/arch/powerpc/stand/mkbootimage/Makefile index c74d06eaa0f0..866921192ed1 100644 --- a/sys/arch/powerpc/stand/mkbootimage/Makefile +++ b/sys/arch/powerpc/stand/mkbootimage/Makefile @@ -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 diff --git a/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c b/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c index 788f299b5395..a5dc2f0afa94 100644 --- a/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c +++ b/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c @@ -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 #include #include +#include -#ifdef __NetBSD__ +#undef USE_SYSCTL + +#if defined(__NetBSD__) && !defined(HAVE_NBTOOL_CONFIG_H) +#define USE_SYSCTL 1 +#include #include #include #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, diff --git a/sys/arch/prep/stand/Makefile b/sys/arch/prep/stand/Makefile index 7ba82eea2b04..f91340fdde44 100644 --- a/sys/arch/prep/stand/Makefile +++ b/sys/arch/prep/stand/Makefile @@ -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 diff --git a/tools/Makefile b/tools/Makefile index c74fbdace6af..e286080c6c31 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -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 @@ -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") diff --git a/tools/powerpc-mkbootimage/Makefile b/tools/powerpc-mkbootimage/Makefile new file mode 100644 index 000000000000..3b3342ee7853 --- /dev/null +++ b/tools/powerpc-mkbootimage/Makefile @@ -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"