From 411ff5dead3fa1595ab906afe84751c842834eb1 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 2 Apr 2010 21:29:30 +0000 Subject: [PATCH] Move install CDs over to / on cd9660 (instead of a memory disk image) --- distrib/sparc64/bootfs/Makefile | 9 +- distrib/sparc64/bootfs/boot.cfg | 1 + distrib/sparc64/bootfs/list | 6 +- distrib/sparc64/cdroms/installcd/Makefile | 61 +++++++++- distrib/sparc64/cdroms/installcd/dot.profile | 110 +++++++++++++++++++ 5 files changed, 178 insertions(+), 9 deletions(-) create mode 100644 distrib/sparc64/bootfs/boot.cfg create mode 100644 distrib/sparc64/cdroms/installcd/dot.profile diff --git a/distrib/sparc64/bootfs/Makefile b/distrib/sparc64/bootfs/Makefile index b32f04a4decd..0bb7d737986b 100644 --- a/distrib/sparc64/bootfs/Makefile +++ b/distrib/sparc64/bootfs/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2010/03/12 23:07:13 martin Exp $ +# $NetBSD: Makefile,v 1.9 2010/04/02 21:29:30 martin Exp $ # # boot.fs is the image for cdrom booting. # @@ -15,7 +15,7 @@ .include IMAGE= boot.fs -IMAGESIZE= 9m +IMAGESIZE= 1m IMAGEENDIAN= be LISTS= ${.CURDIR}/list @@ -26,9 +26,8 @@ RAMDISK= ${RAMDISKDIR}/install.fs PRIMARYBOOT= ${DESTDIR}/usr/mdec/bootblk PARSELISTENV= RAMDISKDIR=${RAMDISKDIR:Q} -IMAGEDEPENDS= ${RAMDISKDIR}/netbsd-INSTALL.gz ${DESTDIR}/usr/mdec/ofwboot \ - ${PRIMARYBOOT} -IMAGEPOSTBUILD= ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${IMAGE} ${PRIMARYBOOT} /boot +IMAGEDEPENDS= ${DESTDIR}/usr/mdec/ofwboot ${PRIMARYBOOT} +IMAGEPOSTBUILD= ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${IMAGE} ${PRIMARYBOOT} IMAGE_RELEASEDIR= installation/misc diff --git a/distrib/sparc64/bootfs/boot.cfg b/distrib/sparc64/bootfs/boot.cfg new file mode 100644 index 000000000000..8c94d5a81309 --- /dev/null +++ b/distrib/sparc64/bootfs/boot.cfg @@ -0,0 +1 @@ +bootpartition :a diff --git a/distrib/sparc64/bootfs/list b/distrib/sparc64/bootfs/list index 1b94603336e6..1590af72b0a0 100644 --- a/distrib/sparc64/bootfs/list +++ b/distrib/sparc64/bootfs/list @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.3 2002/11/18 12:39:55 lukem Exp $ +# $NetBSD: list,v 1.4 2010/04/02 21:29:30 martin Exp $ -COPY ${DESTDIR}/usr/mdec/ofwboot ofwboot -COPY ${RAMDISKDIR}/netbsd-INSTALL.gz netbsd +COPY ${DESTDIR}/usr/mdec/ofwboot ofwboot +COPY ${NETBSDSRCDIR}/distrib/sparc64/bootfs/boot.cfg boot.cfg diff --git a/distrib/sparc64/cdroms/installcd/Makefile b/distrib/sparc64/cdroms/installcd/Makefile index 475e2a81975c..253f23ecd0d3 100644 --- a/distrib/sparc64/cdroms/installcd/Makefile +++ b/distrib/sparc64/cdroms/installcd/Makefile @@ -1,13 +1,72 @@ -# $NetBSD: Makefile,v 1.1 2007/03/06 21:57:24 bouyer Exp $ +# $NetBSD: Makefile,v 1.2 2010/04/02 21:29:30 martin Exp $ CDBASE= sparc64cd # gives ${CDBASE}.iso CDRELEASE= true # include $RELEASEDIR/$MACHINE # for PRINTOBJDIR .include +SYSINSTDIR!= cd ${.CURDIR}/../../../utils/sysinst/arch/${MACHINE} && ${PRINTOBJDIR} + +CDRELEASE_NOISOS= true CDBOOTIMAGEDIR!= cd ${NETBSDSRCDIR}/distrib/sparc64/bootfs && ${PRINTOBJDIR} CDBOOTIMAGE= ${CDBOOTIMAGEDIR}/boot.fs SUN_BOOT_ARGS:= - - - - ${CDBOOTIMAGE} + +CDRUNTIME+= ./bin +CDRUNTIME+= ./dev/MAKEDEV +CDRUNTIME+= ./etc +CDRUNTIME+= ./lib +CDRUNTIME+= ./libexec +CDRUNTIME+= ./mnt +CDRUNTIME+= ./sbin +# CDRUNTIME+= ./stand +CDRUNTIME+= ./tmp +CDRUNTIME+= ./usr/bin/ftp +CDRUNTIME+= ./usr/bin/gzcat +CDRUNTIME+= ./usr/bin/gzip +CDRUNTIME+= ./usr/bin/gunzip +CDRUNTIME+= ./usr/bin/grep +CDRUNTIME+= ./usr/bin/less +CDRUNTIME+= ./usr/bin/more +CDRUNTIME+= ./usr/bin/netstat +CDRUNTIME+= ./usr/bin/progress +CDRUNTIME+= ./usr/bin/sed +CDRUNTIME+= ./usr/bin/sort +CDRUNTIME+= ./usr/bin/tip +CDRUNTIME+= ./usr/bin/vmstat +CDRUNTIME+= ./usr/lib/libbz2.so* +CDRUNTIME+= ./usr/lib/libc.so* +CDRUNTIME+= ./usr/lib/libcurses.so* +CDRUNTIME+= ./usr/lib/libedit.so* +CDRUNTIME+= ./usr/lib/libkvm.so* +CDRUNTIME+= ./usr/lib/libterminfo.so* +CDRUNTIME+= ./usr/lib/libutil.so* +CDRUNTIME+= ./usr/lib/libz.so* +CDRUNTIME+= ./usr/libexec/ld.elf_so +CDRUNTIME+= ./usr/mdec +CDRUNTIME+= ./usr/sbin/chat +CDRUNTIME+= ./usr/sbin/chown +CDRUNTIME+= ./usr/sbin/chroot +CDRUNTIME+= ./usr/sbin/installboot +CDRUNTIME+= ./usr/sbin/pppd +CDRUNTIME+= ./usr/sbin/wiconfig +CDRUNTIME+= ./usr/share/misc/terminfo.db +CDRUNTIME+= ./usr/share/locale + +image_md_pre: + ${MKDIR} cdrom/etc + ${CP} ${.CURDIR}/dot.profile cdrom/etc/rc + ${ECHO} "" >> cdrom/etc/rc + ${ECHO} "# exit to single user mode" >> cdrom/etc/rc + ${ECHO} "exit 1" >> cdrom/etc/rc + ${MKDIR} cdrom/mnt2 cdrom/targetroot + ${CP} ${SYSINSTDIR}/sysinst cdrom + ${CHMOD} ugo+rx cdrom/sysinst + ${CP} ${SYSINSTDIR}/sysinstmsgs.?? cdrom + ${MKDIR} cdrom/var + ${MKDIR} cdrom/kern + ${CP} ${RELEASEDIR}/sparc64/binary/kernel/netbsd-GENERIC.gz cdrom/netbsd + image_md_post: SUNLABEL=${TOOL_SUNLABEL:Q} \ ${HOST_SH} ${NETBSDSRCDIR}/distrib/common/sunbootcd.sh \ diff --git a/distrib/sparc64/cdroms/installcd/dot.profile b/distrib/sparc64/cdroms/installcd/dot.profile new file mode 100644 index 000000000000..026e542a3422 --- /dev/null +++ b/distrib/sparc64/cdroms/installcd/dot.profile @@ -0,0 +1,110 @@ +# $NetBSD: dot.profile,v 1.1 2010/04/02 21:29:30 martin Exp $ +# +# Copyright (c) 1997 Perry E. Metzger +# Copyright (c) 1994 Christopher G. Demetriou +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed for the +# NetBSD Project. See http://www.NetBSD.org/ for +# information about NetBSD. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# <> + +PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ +export PATH + +# Check if we are on a framebuffer or on serial console and default +# the terminal type accordingly. +# There is no /var/db/dev.db, so sysctl might not map the devicename properly; +# ttyE0 is 90,0 -> 0x5a00 +case $(sysctl -nx kern.consdev) in + 0000000000005a0*) + TERM=wsvt25 + ;; + *) + TERM=vt220 + ;; +esac + +export TERM +HOME=/ +export HOME +BLOCKSIZE=1k +export BLOCKSIZE +EDITOR=ed +export EDITOR + +umask 022 + +if [ "X${DONEPROFILE}" = "X" ]; then + DONEPROFILE=YES + export DONEPROFILE + + # set up some sane defaults + echo 'erase ^?, werase ^W, kill ^U, intr ^C' + stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 + echo '' + + if [ $TERM != "wsvt25" ]; then + cat << "EOM" +You are using a serial console, we do not know your terminal emulation. +Please select one, typical values are: + + vt100 + ansi + xterm + +EOM + echo -n "Terminal type (just hit ENTER for '$TERM'): " + read ans + if [ -n "$ans" ];then + TERM=$ans + fi + fi + + # mount the kern_fs so that we can find the root device, and also + # examine the dmesg state + mount -t kernfs /kern /kern + + # hack to get around bugs in kernfs's rootdev/rrootdev lookup. + ls -l /dev/* > /dev/null 2>&1 + + # mount the ramdisk read write + mount -t -r cd9660 -u /kern/rootdev / + + # mount a few tempfs to allow modifications over the CD contents + mount -t tmpfs tmpfs /tmp + mount -t tmpfs tmpfs /var + mount -t tmpfs -o union tmpfs /etc + + # prepare important directories in the tmpfses, so dhcpcd will work + mkdir -p /var/run /var/db + echo > /tmp/dhcpcd-lease + + # run the installation or upgrade script. + sysinst || { + echo "Oops, something went wrong - we will try again"; exit; } +fi