3 # Simple helper script for upgrade target.
5 # Expects MACHINE to be passed in with the environment, the "pass number"
6 # as the first argument the name of the file to leave its droppings in
7 # as the second. CURDIR is also passed in the environment from ${.CURDIR}
12 cd ${CURDIR}/sys/${MACHINE}/conf
14 # Create kernel configuration file for pass #1
15 if [ $PASS -eq 1 ]; then
16 echo "The following files are in ${CURDIR}/sys/${MACHINE}/conf:"; echo
18 echo; echo -n "Which config file do you wish to use? [GENERIC] "
20 if [ -z "${answer}" ]; then
25 if [ ! -f ${KERN} ]; then
28 if ! grep -q atkbdc0 ${KERN}; then
29 if [ ! -f ${KERN}.bkup ]; then
30 cp ${KERN} ${KERN}.bkup
32 sed -e 's/^device.*sc0.*$/ \
33 controller atkbdc0 at isa? port IO_KBD tty \
34 device atkbd0 at isa? tty irq 1 \
35 device vga0 at isa? port ? conflicts \
36 device sc0 at isa? tty \
37 pseudo-device splash \
38 /' -e 's/sd\([0-9]\)/da\1/' -e 's/st\([0-9]\)/sa\1/' < ${KERN}.bkup > ${KERN}
41 ROOTDEV=`awk '$2~/\/$/{print substr($1, 6, 3)}' /etc/fstab`
42 echo -n "What is your boot device (e.g. wd0 or sd0)? [${ROOTDEV}] "
44 if [ -n "${answer}" ]; then
47 echo "KERNEL=${KERN}" > ${CONF}
48 echo "ROOTDEV=${ROOTDEV}" >> ${CONF}
49 if ! file /kernel | grep -q ELF; then
50 echo "NEWBOOT=YES" >> ${CONF}
54 # Build and install kernel as pass #2
55 if [ $PASS -eq 2 -a -f ${CONF} ]; then
57 if [ "x${NEWBOOT}" = "xYES" ]; then
58 echo "--------------------------------------------------------------"
59 echo " Installing new boot blocks"
60 echo "--------------------------------------------------------------"
61 if [ ! -f /boot/loader ]; then
62 (cd ${CURDIR}/lib/libstand; make obj; make -B depend all install)
63 (cd ${CURDIR}/sys/boot; make obj; make -B depend all install)
65 if ! disklabel -B ${ROOTDEV}; then
66 echo "Installation of new boot blocks failed! Please correct"
67 echo "this manually BEFORE you reboot your system!"
71 if ! file /kernel | grep -q ELF; then
72 echo "--------------------------------------------------------------"
73 echo " Building an elf kernel for ${KERNEL} using the new tools"
74 echo "--------------------------------------------------------------"
76 cd ${CURDIR}/sys/compile/${KERNEL} && make -B depend -DFORCE all install