| Summary: | KERNEL used both by Makefile.inc1 and Makefile.${MACHINE} | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | k <k> | ||||
| Component: | kern | Assignee: | Sheldon Hearn <sheldonh> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.0-RELEASE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Hi I was asked to describe how the 'How-to-repeat' case bahaivs with my patch aplied. I have run the build/install-kernel target w/o and w/ the patch. I have also run both targets with a new version of the patch that also alows one to install multiple kernels (see patch below). And as one can see below: w/o the patch the two kernels are linked twice, one time for each name in $KERNEL and the install fails. w/ the patch each kernel is linked only once with its proper name and the first kernel is installed. w/ the new patch each kernel is linked only once and _both_ kernels are installed. /Johan K w/o the patch ================ numeri# make KERNEL='GENERIC NEWCARD' buildkernel > & org.build numeri# ls /GENERIC /NEWCARD ls: /GENERIC: No such file or directory ls: /NEWCARD: No such file or directory numeri# make KERNEL='GENERIC NEWCARD' installkernel > & org.inst numeri# ls /GENERIC /NEWCARD ls: /GENERIC: No such file or directory ls: /NEWCARD: No such file or directory numeri# cat org.build -------------------------------------------------------------- >>> Rebuilding kernel(s) -------------------------------------------------------------- ===> GENERIC [ CUT ] sh /usr/src/sys/conf/newvers.sh GENERIC cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking GENERIC text data bss dec hex filename 2197157 161496 126200 2484853 25ea75 GENERIC linking NEWCARD text data bss dec hex filename 2197157 161496 126200 2484853 25ea75 NEWCARD ===> NEWCARD [ CUT ] sh /usr/src/sys/conf/newvers.sh NEWCARD cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking GENERIC text data bss dec hex filename 2040750 155408 118776 2314934 2352b6 GENERIC linking NEWCARD text data bss dec hex filename 2040750 155408 118776 2314934 2352b6 NEWCARD numeri# cat org.inst cd /usr/obj/usr/src/sys/GENERIC; MAKEOBJDIRPREFIX=/usr/obj COMPILER_PATH=/usr/obj/usr/src/i386/usr/libexec:/usr/obj/usr/src/i386/usr/bin LIBRARY_PATH=/usr/obj/usr/src/i386/usr/lib:/usr/obj/usr/src/i386/usr/lib OBJFORMAT_PATH=/usr/obj/usr/src/i386/usr/libexec PERL5LIB=/usr/obj/usr/src/i38 6/usr/libdata/perl/5.00503 MACHINE=i386 make install [: NEWCARD: unexpected operator install -c -m 555 -o root -g wheel -fschg GENERIC NEWCARD /GENERIC NEWCARD usage: install [-CcDpsv] [-f flags] [-g group] [-m mode] [-o owner] file1 file2 install [-CcDpsv] [-f flags] [-g group] [-m mode] [-o owner] file1 ... fileN directory install -d [-v] [-g group] [-m mode] [-o owner] directory ... *** Error code 64 Stop in /usr/obj/usr/src/sys/GENERIC. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. numeri# ================ w/ the patch ================ numeri# make KERNELS=GENERIC NEWCARD buildkernel >& new.build numeri# ls /GENERIC /NEWCARD ls: /GENERIC: No such file or directory ls: /NEWCARD: No such file or directory numeri# make KERNELS='GENERIC NEWCARD' installkernel > & new.inst numeri# ls /GENERIC /NEWCARD ls: /NEWCARD: No such file or directory /GENERIC numeri# cat new.build -------------------------------------------------------------- >>> Rebuilding kernel(s) -------------------------------------------------------------- ===> GENERIC [ CUT ] sh /usr/src/sys/conf/newvers.sh GENERIC cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking GENERIC text data bss dec hex filename 2197157 161496 126200 2484853 25ea75 GENERIC ===> NEWCARD [ CUT ] sh /usr/src/sys/conf/newvers.sh NEWCARD cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking NEWCARD text data bss dec hex filename 2040750 155408 118776 2314934 2352b6 NEWCARD numeri# cat new.inst cd /usr/obj/usr/src/sys/GENERIC; MAKEOBJDIRPREFIX=/usr/obj COMPILER_PATH=/usr/obj/usr/src/i386/usr/libexec:/usr/obj/usr/src/i386/usr/bin LIBRARY_PATH=/usr/obj/usr/src/i386/usr/lib:/usr/obj/usr/src/i386/usr/lib OBJFORMAT_PATH=/usr/obj/usr/src/i386/usr/libexec PERL5LIB=/usr/obj/usr/src/i38 6/usr/libdata/perl/5.00503 MACHINE=i386 KERNEL=GENERIC make install install -c -m 555 -o root -g wheel -fschg GENERIC /GENERIC numeri# ================ w/ new patch below ================== numeri# make KERNELS=GENERIC NEWCARD buildkernel >& new2.build numeri# ls /GENERIC /NEWCARD ls: /GENERIC: No such file or directory ls: /NEWCARD: No such file or directory numeri# make KERNELS='GENERIC NEWCARD' installkernel > & new2.inst numeri# ls /GENERIC /NEWCARD /GENERIC /NEWCARD numeri# cat new2.build -------------------------------------------------------------- >>> Rebuilding kernel(s) -------------------------------------------------------------- ===> GENERIC [ CUT ] sh /usr/src/sys/conf/newvers.sh GENERIC cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking GENERIC text data bss dec hex filename 2197157 161496 126200 2484853 25ea75 GENERIC ===> NEWCARD [ CUT ] sh /usr/src/sys/conf/newvers.sh NEWCARD cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/../include -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 vers.c linking NEWCARD text data bss dec hex filename 2040750 155408 118776 2314934 2352b6 NEWCARD numeri# cat new2.inst -------------------------------------------------------------- >>> Installing kernel(s) -------------------------------------------------------------- ===> GENERIC cd /usr/obj/usr/src/sys/GENERIC ; MAKEOBJDIRPREFIX=/usr/obj COMPILER_PATH=/usr/obj/usr/src/i386/usr/libexec:/usr/obj/usr/src/i386/usr/bin LIBRARY_PATH=/usr/obj/usr/src/i386/usr/lib:/usr/obj/usr/src/i386/usr/lib OBJFORMAT_PATH=/usr/obj/usr/src/i386/usr/libexec PERL5LIB=/usr/obj/usr/src/i38 6/usr/libdata/perl/5.00503 MACHINE=i386 KERNEL=GENERIC make install install -c -m 555 -o root -g wheel -fschg GENERIC /GENERIC ===> NEWCARD cd /usr/obj/usr/src/sys/NEWCARD ; MAKEOBJDIRPREFIX=/usr/obj COMPILER_PATH=/usr/obj/usr/src/i386/usr/libexec:/usr/obj/usr/src/i386/usr/bin LIBRARY_PATH=/usr/obj/usr/src/i386/usr/lib:/usr/obj/usr/src/i386/usr/lib OBJFORMAT_PATH=/usr/obj/usr/src/i386/usr/libexec PERL5LIB=/usr/obj/usr/src/i38 6/usr/libdata/perl/5.00503 MACHINE=i386 KERNEL=NEWCARD make install install -c -m 555 -o root -g wheel -fschg NEWCARD /NEWCARD numeri # ================== New patch ================== --- Makefile.inc1.orig Thu Mar 9 07:28:19 2000 +++ Makefile.inc1 Tue Mar 28 20:09:57 2000 @@ -328,7 +328,7 @@ # buildkernel and installkernel # # Which kernels to build and/or install is specified by setting -# KERNEL. If not defined a GENERIC kernel is built/installed. +# KERNELS. If not defined a GENERIC kernel is built/installed. # Only the existing (depending MACHINE) config files are used # for building kernels and only the first of these is designated # as the one being installed. @@ -338,7 +338,7 @@ # be set to cross-build, we have to make sure MACHINE is set # properly. -KERNEL?= GENERIC GENERIC98 +KERNELS?= GENERIC GENERIC98 # The only exotic MACHINE_ARCH/MACHINE combination valid at this # time is i386/pc98. In all other cases set MACHINE equal to @@ -356,13 +356,11 @@ .endif BUILDKERNELS= -INSTALLKERNEL= -.for _kernel in ${KERNEL} +INSTALLKERNELS= +.for _kernel in ${KERNELS} .if exists(${KRNLCONFDIR}/${_kernel}) BUILDKERNELS+= ${_kernel} -.if empty(INSTALLKERNEL) -INSTALLKERNEL= ${_kernel} -.endif +INSTALLKERNELS+= ${_kernel} .endif .endfor @@ -384,8 +382,10 @@ cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \ ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile; \ - ${WMAKEENV} MACHINE=${MACHINE} ${MAKE} depend; \ - ${WMAKEENV} MACHINE=${MACHINE} ${MAKE} all + ${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \ + ${MAKE} depend; \ + ${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \ + ${MAKE} all .endfor # @@ -394,8 +394,16 @@ # Install the kernel defined by INSTALLKERNEL # installkernel: - cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ - ${IMAKEENV} MACHINE=${MACHINE} ${MAKE} install + @echo + @echo "--------------------------------------------------------------" + @echo ">>> Installing kernel(s)" + @echo "--------------------------------------------------------------" +.for _kernel in ${INSTALLKERNELS} + @echo "===> ${_kernel}" + cd ${KRNLOBJDIR}/${_kernel} ;\ + ${IMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \ + ${MAKE} install +.endfor # # update ================== Responsible Changed From-To: freebsd-bugs->sheldonh I'll take this one, although I'll probably want to consult with marcel. State Changed From-To: open->closed A simplified version of your patch (in which variables were not renamed) has been committed as rev 1.143 of src/Makefile.inc1 and merged onto the RELENG_4 branch. Thanks! |
The variable KERNEL is used both by ${SRC}/Makefile.inc1 and ${SRC}/sys/conf/Makefile.* When using the buildkernel/installkernel targets this is a problem. By specifying two or more existing kernel config files to these targets using the KERNEL variable (as suggested in the makefile) the buildkernel target will link two (or more) identical kernels with the given names. The installkernel target will fail since 'install' do not know how to handle this case. I propose to use KERNELS in Makefile.inc1 instead, see patch below. Also, since each config file generates a kernel with the same name and the installed kernel get install under this name, I suggest that all built kernels get install. This way it will be easier to test them. For exampel I would like to get both GENERIC and my custom kernel installed. However this is out of the scoop of this PR :-) How-To-Repeat: cd /usr/src; make KERNEL='GENERIC NEWCARD' buildkernel cd /usr/src; make KERNEL='GENERIC NEWCARD' installkernel on a x86 machine.