Date: Sun, 15 Aug 1999 19:37:32 -0700 (PDT) From: george+freebsd@m5p.com To: FreeBSD-gnats-submit@freebsd.org Subject: i386/13171: "config" not quite right for kernel not named "kernel" Message-ID: <199908160237.TAA08540@southstation.m5p.com>
index | next in thread | raw e-mail
>Number: 13171
>Category: i386
>Synopsis: "config" not quite right for kernel not named "kernel"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 15 19:40:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: George Mitchell
>Release: FreeBSD 3.2-RELEASE i386
>Organization:
Mitchell Voting Products, Inc.
>Environment:
>Description:
The config command generates a Makefile which assumes that the kernel
being configured will be named "kernel", even if the config statement
in the configuration file says otherwise.
>How-To-Repeat:
1. Create a kernel configuration file named TEST containing the line:
config frobozz root on da0
(and everything else necessary to configure a kernel).
2. Run "config" on this configuration file.
3. Observe that ../../compile/TEST/Makefile has multiple references
to the file "kernel" instead of "frobozz".
>Fix:
The following diff to /usr/src/usr.sbin/config/mkmakefile.c will
substitute the real kernel name for all occurences of %KERNEL in
the Makefile template file:
*** mkmakefile.c.orig Tue Sep 15 14:07:54 1998
--- mkmakefile.c Sun Aug 15 18:27:16 1999
***************
*** 148,153 ****
--- 148,155 ----
struct opt *op;
int warn_make_clean = 0;
int versreq;
+ struct file_list *fl;
+ char *kernel_name = 0;
read_files();
strcpy(line, "Makefile.");
***************
*** 190,201 ****
fprintf(ofp, "PROF=-pg\n");
fprintf(ofp, "PROFLEVEL=%d\n", profiling);
}
while (fgets(line, BUFSIZ, ifp) != 0) {
! if (*line != '%') {
! fprintf(ofp, "%s", line);
! continue;
}
! if (eq(line, "%BEFORE_DEPEND\n"))
do_before_depend(ofp);
else if (eq(line, "%OBJS\n"))
do_objs(ofp);
--- 192,223 ----
fprintf(ofp, "PROF=-pg\n");
fprintf(ofp, "PROFLEVEL=%d\n", profiling);
}
+ for (fl = conf_list; fl; fl = fl->f_next) {
+ if (fl->f_type == SYSTEMSPEC) {
+ kernel_name = fl->f_needs;
+ break;
+ }
+ }
while (fgets(line, BUFSIZ, ifp) != 0) {
! if ((*line != '%') || (strncmp (line, "%KERNEL", 7) == 0)) {
! char rewritten_line [256];
! char *ip, *op;
! for (ip = line, op = rewritten_line;
! *ip != '\0';
! ) {
! if ((*ip != '%') ||
! (strncmp (ip, "%KERNEL", 7) != 0))
! *op++ = *ip++;
! else {
! strcpy (op, kernel_name);
! op += strlen (op);
! ip += 7;
! }
! }
! *op = '\0';
! fprintf(ofp, "%s", rewritten_line);
}
! else if (eq(line, "%BEFORE_DEPEND\n"))
do_before_depend(ofp);
else if (eq(line, "%OBJS\n"))
do_objs(ofp);
The following diff will put "%KERNEL" in the appropriate places
in /usr/src/sys/i386/conf/Makefile.i386:
*** Makefile.i386.orig Sun Apr 25 05:44:06 1999
--- Makefile.i386 Sun Aug 15 18:20:32 1999
***************
*** 123,129 ****
clean:
rm -f *.o *.so *.So *.ko *.s eddep errs genassym gensetdefs \
! kernel linterrs makelinks param.c setdef[01].c setdefs.h \
symbols.exclude symbols.sort tags \
vers.c vnode_if.c vnode_if.h ${CLEAN}
--- 123,129 ----
clean:
rm -f *.o *.so *.So *.ko *.s eddep errs genassym gensetdefs \
! %KERNEL linterrs makelinks param.c setdef[01].c setdefs.h \
symbols.exclude symbols.sort tags \
vers.c vnode_if.c vnode_if.h ${CLEAN}
***************
*** 194,202 ****
rm -f .depend
links:
! egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
! echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink
--- 194,202 ----
rm -f .depend
links:
! egrep '#if' ${CFILES:Nswap%KERNEL.c} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
! echo ${CFILES:Nswap%KERNEL.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink
***************
*** 205,216 ****
@echo "see $S/kern/Makefile for tags"
install:
! @if [ ! -f kernel ] ; then \
echo "You must first build your kernel before trying to install." ; \
exit 1 ; \
fi
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
! @if [ -f /kernel -a "`file /kernel 2>/dev/null | grep ELF`" = "" ]; then \
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
--- 205,216 ----
@echo "see $S/kern/Makefile for tags"
install:
! @if [ ! -f %KERNEL ] ; then \
echo "You must first build your kernel before trying to install." ; \
exit 1 ; \
fi
.if ${KERNFORMAT} == "elf" && !defined(FORCE)
! @if [ -f /%KERNEL -a "`file /%KERNEL 2>/dev/null | grep ELF`" = "" ]; then \
echo "WARNING: You are about to install an ELF kernel for the first time!" ; \
echo "Please be sure you have upgraded your bootblocks and/or /boot/loader so" ; \
echo "that you can boot it. Old bootblocks WILL NOT WORK! Please read:" ; \
***************
*** 219,236 ****
exit 1 ; \
fi
.endif
! .if exists(${DESTDIR}/kernel)
! -chflags noschg ${DESTDIR}/kernel
! mv ${DESTDIR}/kernel ${DESTDIR}/kernel.old
.endif
PATH=$${PATH}:/sbin:/usr/sbin; \
! if [ `sysctl -n kern.bootfile` = ${DESTDIR}/kernel ] ; then \
! sysctl -w kern.bootfile=${DESTDIR}/kernel.old ; \
if [ -f /var/db/kvm_kernel.db ] ; then \
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
fi \
fi
! install -c -m 555 -o root -g wheel -fschg kernel ${DESTDIR}/
config.o:
${NORMAL_C}
--- 219,236 ----
exit 1 ; \
fi
.endif
! .if exists(${DESTDIR}/%KERNEL)
! -chflags noschg ${DESTDIR}/%KERNEL
! mv ${DESTDIR}/%KERNEL ${DESTDIR}/%KERNEL.old
.endif
PATH=$${PATH}:/sbin:/usr/sbin; \
! if [ `sysctl -n kern.bootfile` = ${DESTDIR}/%KERNEL ] ; then \
! sysctl -w kern.bootfile=${DESTDIR}/%KERNEL.old ; \
if [ -f /var/db/kvm_kernel.db ] ; then \
mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
fi \
fi
! install -c -m 555 -o root -g wheel -fschg %KERNEL ${DESTDIR}/
config.o:
${NORMAL_C}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908160237.TAA08540>
