Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jan 1999 08:26:50 -0800
From:      "Jordan K. Hubbard" <jkh@zippy.cdrom.com>
To:        stable@FreeBSD.ORG
Subject:   automated upgrade target patches, MKII
Message-ID:  <86327.917281610@zippy.cdrom.com>

next in thread | raw e-mail | index | archive | help
Forget that previous set I sent out, here's another shar file to
replace it.

Differences from previous patch set:

  o More precautions are taken in building the boot blocks.

  o doupgrade.sh is now moved into tools/tools/upgrade where it belonged
    in the first place (not in release/scripts).  Also given some concept of
    ${.CURDIR} so assumptions about /usr/src are now eliminated.

  o Kernel properly updated for CAM too (whoops!)

  o Ordering corrected for kernel/world build.

Tested against -current; patches should (in theory) apply to RELENG_3
as well though a little hand tweaking might be in order.
Move doupgrade.sh to /usr/src/tools/tools/upgrade and
`make upgrade' should see you off.  `make upgrade NOCONFIRM=1'
if you're feeling *especially* brave. :)

- Jordan

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	upgrade.diffs
#	doupgrade.sh
#
echo x - upgrade.diffs
sed 's/^X//' >upgrade.diffs << 'END-of-upgrade.diffs'
XIndex: Makefile
X===================================================================
XRCS file: /home/ncvs/src/Makefile,v
Xretrieving revision 1.222
Xdiff -u -u -r1.222 Makefile
X--- Makefile	1998/12/28 17:03:49	1.222
X+++ Makefile	1999/01/25 15:30:32
X@@ -63,25 +63,19 @@
X #           Upgrading an i386 system from a.out to elf format
X #
X #
X-# The aout->elf transition build is performed by doing a `make aout-to-elf'
X-# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
X+# The aout->elf transition build is performed by doing a `make upgrade' (or
X+# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
X+# by a `make aout-to-elf-install', depending on user preference.
X # You need to have at least 320 Mb of free space for the object tree.
X #
X # The upgrade process checks the installed release. If this is 3.0-CURRENT,
X # it is assumed that your kernel contains all the syscalls required by the
X # current sources.
X #
X-# For installed systems where `uname -r' reports something other than
X-# 3.0-CURRENT, the upgrade process expects to build a kernel using the
X-# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
X-# defaulted to the GENERIC kernel configuration file on the assumption that
X-# it will be suitable for most systems. Before performing the upgrade,
X-# replace sys/i386/conf/GENERICupgrade with your own version if your
X-# hardware requires a different configuration.
X-#
X # The upgrade procedure will stop and ask for confirmation to proceed
X # several times. On each occasion, you can type Ctrl-C to abort the
X-# upgrade.
X+# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
X+# the confirmation steps.
X #
X # At the end of the upgrade procedure, /etc/objformat is created or
X # updated to contain OBJFORMAT=elf. From then on, you're elf by default.
X@@ -134,6 +128,9 @@
X #
X # Handle the upgrade targets, using the source relative mk files.
X #
X+
X+upgrade:	aout-to-elf
X+
X ${UPGRADE} : upgrade_checks
X 	@cd ${.CURDIR}; \
X 		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
XIndex: Makefile.upgrade
X===================================================================
XRCS file: /home/ncvs/src/Makefile.upgrade,v
Xretrieving revision 1.10
Xdiff -u -u -r1.10 Makefile.upgrade
X--- Makefile.upgrade	1999/01/25 01:47:49	1.10
X+++ Makefile.upgrade	1999/01/25 16:24:10
X@@ -39,16 +39,24 @@
X # with them (in case the installed kernel is an older version), then 
X # install the elf world.
X #
X-aout-to-elf aout-to-elf-install :				\
X+aout-to-elf aout-to-elf-install :	/var/db/update.cfg	\
X 		${MAKEOBJDIRPREFIX}/do_aout_buildworld		\
X 		${MAKEOBJDIRPREFIX}/do_elf_buildworld		\
X 		${MAKEOBJDIRPREFIX}/do_move_aout_libs		\
X 		${MAKEOBJDIRPREFIX}/do_aout_installworld	\
X-		${MAKEOBJDIRPREFIX}/do_aout_kernel		\
X 		${MAKEOBJDIRPREFIX}/do_elf_installworld		\
X+		${MAKEOBJDIRPREFIX}/do_elf_kernel		\
X 		${MAKEOBJDIRPREFIX}/do_set_objformat		\
X-		${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
X+		${MAKEOBJDIRPREFIX}/do_reboot
X 
X+# front-load all the information we're going to need.
X+/var/db/update.cfg:
X+	@if [ -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
X+	    env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 1 /var/db/update.cfg; \
X+	else \
X+	    echo "Your source tree must not be fully populated; unable to find upgrade script"; echo "in ${.CURDIR}/tools/tools/upgrade/doupgrade.sh."; exit 1; \
X+	fi
X+
X #
X # Just do the build parts of the transition build.
X #
X@@ -186,39 +194,15 @@
X 	@touch ${MAKEOBJDIRPREFIX}/do_aout_installworld
X 
X #
X-# The installed kernel may not match the world that is installed, so build
X-# a generic kernel, but don't install it. The user can decide if the kernel
X-# needs to be installed. Perhaps we should install it in the root
X-# directory as an obscure name just in case a reboot is required?
X+# Build and install a new kernel, as well as the boot blocks necessary to
X+# boot it.
X #
X-${MAKEOBJDIRPREFIX}/do_aout_kernel :
X-.if	${INSTALLEDVERSION} >= 300003
X-	@echo
X-	@echo "--------------------------------------------------------------"
X-	@echo " You are already running 3.0, so a kernel build"
X-	@echo " is probably not required."
X-	@echo "--------------------------------------------------------------"
X-.else
X-	@echo
X-	@echo "--------------------------------------------------------------"
X-	@echo " Building a generic kernel using the new aout tools"
X-	@echo "--------------------------------------------------------------"
X-.if	exists(${.CURDIR}/sys/compile/GENERICupgrade)
X-	@rm -rf ${.CURDIR}/sys/compile/GENERICupgrade
X-.endif
X-.if	!exists(${.CURDIR}/sys/${MACHINE}/conf/GENERICupgrade)
X-	-cp ${.CURDIR}/sys/${MACHINE}/conf/GENERIC \
X-		${.CURDIR}/sys/${MACHINE}/conf/GENERICupgrade
X-.endif
X-	@cd ${.CURDIR}/sys/${MACHINE}/conf; config GENERICupgrade
X-	@-cd ${.CURDIR}/sys/compile/GENERICupgrade; \
X-		OBJFORMAT=aout make KERNFORMAT=aout depend && \
X-		OBJFORMAT=aout make KERNFORMAT=aout all
X-	@cd ${.CURDIR}/sys/compile/GENERICupgrade; \
X-		OBJFORMAT=aout make KERNFORMAT=aout depend && \
X-		OBJFORMAT=aout make KERNFORMAT=aout all
X-.endif
X-	@touch ${MAKEOBJDIRPREFIX}/do_aout_kernel
X+${MAKEOBJDIRPREFIX}/do_elf_kernel :
X+	@if [ -f /var/db/update.cfg -a -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
X+	     env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 2 /var/db/update.cfg; \
X+	fi
X+	@touch ${MAKEOBJDIRPREFIX}/do_elf_kernel
X+	@rm -f /var/db/update.cfg
X 
X #
X # Install the elf world overwriting just about all the previously installed
X@@ -246,6 +230,9 @@
X 		PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
X 		TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
X 		make -f Makefile.inc1 -m ${.CURDIR}/share/mk installworld
X+	@if [ ! -f /etc/pam.conf ]; then cp ${.CURDIR}/etc/pam.conf /etc; fi
X+	@if [ ! -f /etc/auth.conf ]; then cp ${.CURDIR}/etc/auth.conf /etc; fi
X+	@if [ ! -f /etc/login.conf ]; then cp ${.CURDIR}/etc/login.conf /etc; fi
X 	@touch ${MAKEOBJDIRPREFIX}/do_elf_installworld
X 
X #
X@@ -260,44 +247,21 @@
X 	@echo "OBJFORMAT=elf" > ${DESTDIR}/etc/objformat
X 	@touch ${MAKEOBJDIRPREFIX}/do_set_objformat
X 
X-#
X-# If not already running a current kernel, install the GENERICupgrade kernel
X-# and reboot.
X #
X-${MAKEOBJDIRPREFIX}/do_install_kernel_reboot	:
X-.if	${INSTALLEDVERSION} >= 300003
X-	@echo
X-	@echo "--------------------------------------------------------------"
X-	@echo " Your system has been updated to run elf by default!"
X-	@echo
X-	@echo " You should reboot your system now."
X-	@echo "--------------------------------------------------------------"
X-	@touch ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
X-.else
X+# Time to reboot!
X+${MAKEOBJDIRPREFIX}/do_reboot	:
X .if !defined(NOCONFIRM)
X 	@echo
X 	@echo "--------------------------------------------------------------"
X-	@echo " Your system has been updated to run elf by default!"
X+ 	@echo " Your system has now been fully updated to elf!"
X 	@echo
X-	@echo " Since you are running ${INSTALLEDNAME}, the kernel must"
X-	@echo " be installed before the system is rebooted. You can type"
X-	@echo " Ctrl-C to abort the kernel installation (at your own risk),"
X-	@echo " or press return for the kernel to be installed and the"
X-	@echo " system rebooted."
X+ 	@echo " It's now time to reboot from your new ELF kernel."
X+ 	@echo " You can type Ctrl-C to abort this (at your own risk)"
X+ 	@echo " or press return to reboot the system."
X 	@echo "--------------------------------------------------------------"
X 	@${MAKEOBJDIRPREFIX}/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
X .endif
X-	@echo
X-	@echo "--------------------------------------------------------------"
X-	@echo " Installing a new GENERICupgrade kernel"
X-	@echo "--------------------------------------------------------------"
X-	@cd ${.CURDIR}/sys/compile/GENERICupgrade; \
X-		OBJFORMAT=aout make KERNFORMAT=aout install
X-	@echo
X-	@echo "--------------------------------------------------------------"
X 	@echo " Rebooting......."
X 	@echo "--------------------------------------------------------------"
X-	@touch ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
X+ 	@touch ${MAKEOBJDIRPREFIX}/do_reboot
X 	@-${MAKEOBJDIRPREFIX}/reboot
X-.endif
X-
END-of-upgrade.diffs
echo x - doupgrade.sh
sed 's/^X//' >doupgrade.sh << 'END-of-doupgrade.sh'
X#!/bin/sh
X
X# Simple helper script for upgrade target.
X
X# Expects MACHINE to be passed in with the environment, the "pass number"
X# as the first argument the name of the file to leave its droppings in
X# as the second.  CURDIR is also passed in the environment from ${.CURDIR}
X
XPASS=$1
XCONF=$2
X
Xcd ${CURDIR}/sys/${MACHINE}/conf
X
X# Create kernel configuration file for pass #1
Xif [ $PASS -eq 1 ]; then
X	echo "The following files are in ${CURDIR}/sys/${MACHINE}/conf:"; echo
X	ls -C
X	echo; echo -n "Which config file do you wish to use? [GENERIC] "
X	read answer
X	if [ -z "${answer}" ]; then
X		KERN=GENERIC
X	else
X		KERN="${answer}"
X	fi
X	if [ ! -f ${KERN} ]; then
X		KERN=GENERIC
X	fi
X	if [ ! -f ${KERN}.bkup ]; then
X		cp ${KERN} ${KERN}.bkup
X	fi
X	sed -e 's/^device.*sc0.*$/ \
Xcontroller      atkbdc0 at isa? port IO_KBD tty \
Xdevice          atkbd0  at isa? tty irq 1 \
Xdevice          vga0    at isa? port ? conflicts \
Xdevice          sc0     at isa? tty \
Xpseudo-device   splash \
X/' -e 's/sd\([0-9]\)/da\1/' -e 's/st\([0-9]\)/sa\1/' < ${KERN}.bkup > ${KERN}
X
X	if [ -r /dev/wd0a ]; then
X		ROOTDEV=wd0
X	else
X		ROOTDEV=da0
X	fi
X	echo -n "What is your boot device (e.g. wd0 or sd0)? [${ROOTDEV}] "
X	read answer
X	if [ -n "${answer}" ]; then
X		ROOTDEV="${answer}"
X	fi
X	echo "KERNEL=${KERN}" > ${CONF}
X	echo "ROOTDEV=${ROOTDEV}" >> ${CONF}
X	if ! file /kernel | grep -q ELF; then
X		echo "NEWBOOT=YES" >> ${CONF}
X	fi
Xfi
X
X# Build and install kernel as pass #2
Xif [ $PASS -eq 2 -a -f ${CONF} ]; then
X	. ${CONF}
X	if [ "x${NEWBOOT}" = "xYES" ]; then
X	   echo "--------------------------------------------------------------"
X	   echo " Installing new boot blocks"
X	   echo "--------------------------------------------------------------"
X	   if [ ! -f /boot/loader ]; then
X	      (cd ${CURDIR}/lib/libstand; make obj; make -B depend all install)
X	      (cd ${CURDIR}/sys/boot; make obj; make -B depend all install)
X	   fi
X	   if ! disklabel -B ${ROOTDEV}; then
X		echo "Installation of new boot blocks failed!  Please correct"
X		echo "this manually BEFORE you reboot your system!"
X		exit 1
X	   fi
X	fi
X	echo "--------------------------------------------------------------"
X	echo " Building an elf kernel for ${KERNEL} using the new tools"
X	echo "--------------------------------------------------------------"
X	config -r ${KERNEL}
X	cd ${CURDIR}/sys/compile/${KERNEL} && make -B depend -DFORCE all install
Xfi
END-of-doupgrade.sh
exit


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86327.917281610>