Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/distrib/common/bootimage Pull up following revision(s) (r...
details: https://anonhg.NetBSD.org/src/rev/7d00665cf8c5
branches: netbsd-6
changeset: 774082:7d00665cf8c5
user: riz <riz%NetBSD.org@localhost>
date: Wed May 09 19:58:27 2012 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #235):
distrib/common/bootimage/Makefile.bootimage: revision 1.5
Add two optional variables for liveimage/installimage builds:
---
MBR_BOOTCODE
optional MBR bootcode which should be installed by fdisk(8)
(default: empty)
- specified MBR_BOOTCODE must exist in ${DESTDIR}/usr/mdec
- if MBR_BOOTCODE is not specified,
MBR_DEFAULT_BOOTCODE (default: mbr) will be used
if the target ${MACHINE} has the one in /usr/mdec
INSTALLBOOTOPTIONS
options passed to installboot(8), e.g., -o console=com0
(default: empty)
---
Proposed by Brook Milligan on current-users@:
http://mail-index.NetBSD.org/current-users/2012/04/16/msg019892.html
Also make USE_MBR work on ${MACHINE}s which don't have the default
/usr/mdec/mbr bootcode. (no such port has the liveimage target yet though)
XXX: tools fdisk(8) implicitly uses host's /usr/mdec/mbr for the default
XXX: bootcode even for non-x86 targets if host is x86
diffstat:
distrib/common/bootimage/Makefile.bootimage | 40 ++++++++++++++++++++++++----
1 files changed, 34 insertions(+), 6 deletions(-)
diffs (94 lines):
diff -r 2e1a8c7826b6 -r 7d00665cf8c5 distrib/common/bootimage/Makefile.bootimage
--- a/distrib/common/bootimage/Makefile.bootimage Wed May 09 18:22:32 2012 +0000
+++ b/distrib/common/bootimage/Makefile.bootimage Wed May 09 19:58:27 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bootimage,v 1.3 2012/01/22 16:56:22 tsutsui Exp $
+# $NetBSD: Makefile.bootimage,v 1.3.2.1 2012/05/09 19:58:27 riz Exp $
#
# Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved.
#
@@ -40,6 +40,13 @@
# USE_MBR
# set yes if target disk image requires MBR partition
# (defautl: no)
+# MBR_BOOTCODE
+# optional MBR bootcode which should be installed by fdisk(8)
+# (default: empty)
+# - specified MBR_BOOTCODE must exist in ${DESTDIR}/usr/mdec
+# - if MBR_BOOTCODE is not specified,
+# MBR_DEFAULT_BOOTCODE (default: mbr) will be used
+# if the target ${MACHINE} has the one in /usr/mdec
# USE_SUNLABEL
# set yes if target disk image requires Sun's label
# (default: no)
@@ -92,6 +99,9 @@
# IMGMAKEFSOPTIONS
# options passed to makefs(8) to create root file system
# (default: -o bsize=16384,fsize=2048,density=8192)
+# INSTALLBOOTOPTIONS
+# options passed to installboot(8), e.g., -o console=com0
+# (default: empty)
# PRIMARY_BOOT
# primary boot loader that should be installed into
# the target image via installboot(8)
@@ -286,7 +296,7 @@
${IMGMAKEFSOPTIONS} \
${WORKFS} ${WORKDIR}
.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} == "no"
- ${TOOL_INSTALLBOOT} -vm ${MACHINE} ${WORKFS} \
+ ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKFS} \
${WORKDIR}/usr/mdec/${PRIMARY_BOOT} ${SECONDARY_BOOT_ARG}
.endif
@echo done.
@@ -301,6 +311,8 @@
DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.in
.endif
+MBR_DEFAULT_BOOTCODE?= mbr
+
OMIT_SWAPIMG?= no
WORKMBR?= work.mbr
@@ -328,14 +340,30 @@
mv ${WORKLABEL}.tmp ${WORKLABEL}
${IMGBASE}.img: ${TARGETFS} ${WORKLABEL}
-.if ${LABELSECTORS} != "0"
+.if ${USE_MBR} != "no"
@echo creating MBR labels...
${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1
- ${TOOL_FDISK} -f -u \
+ ${TOOL_FDISK} -f -i -u \
-b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS} \
-0 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS} \
- -i -c ${WORKDIR}/usr/mdec/mbr \
-F ${WORKMBR}
+.if empty(MBR_BOOTCODE)
+ @if [ -f ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} ]; then \
+ echo ${TOOL_FDISK} -f \
+ -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \
+ -F ${WORKMBR}; \
+ ${TOOL_FDISK} -f \
+ -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \
+ -F ${WORKMBR}; \
+ fi
+.else
+ @if [ ! -f ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} ]; then \
+ echo "${MBR_BOOTCODE} is not found in DESTDIR/usr/mdec, aborting"; \
+ false; \
+ fi
+ ${TOOL_FDISK} -f -i -c ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} \
+ -F ${WORKMBR}
+.endif
${DD} if=${WORKMBR} count=${LABELSECTORS} | \
${CAT} - ${TARGETFS} > ${WORKIMG}
.else
@@ -354,7 +382,7 @@
.endif
${TOOL_DISKLABEL} -R -F ${WORKIMG} ${WORKLABEL}
.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} != "no"
- ${TOOL_INSTALLBOOT} -vm ${MACHINE} ${WORKIMG} \
+ ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTOINS} ${WORKIMG} \
${WORKDIR}/usr/mdec/${PRIMARY_BOOT}
.endif
mv ${WORKIMG} ${.TARGET}
Home |
Main Index |
Thread Index |
Old Index