0001-Add-two-variables-to-adjust-where-to-install-kernel.patch

qhwt+dfly, 02/08/2009 08:24 AM

Download (8 KB)

View differences:

share/mk/bsd.kmod.mk
12 12
.endif
13 13

  
14 14
.include "${SYSDIR}/conf/kmod.mk"
15
.include "${SYSDIR}/conf/kern.paths.mk"
15 16

  
16 17
.include <bsd.sys.mk>
share/mk/bsd.own.mk
84 84
# LIBMODE	Library mode. [${NOBINMODE}]
85 85
#
86 86
#
87
# KMODDIR	Base path for loadable kernel modules
88
#		(see kld(4)). [/boot/modules]
89
#
90
# KMODOWN	KLD owner. [${BINOWN}]
91
#
92
# KMODGRP	KLD group. [${BINGRP}]
93
#
94
# KMODMODE	KLD mode. [${BINMODE}]
95
#
96
#
97 87
# SHAREDIR	Base path for architecture-independent ascii
98 88
#		text files. [/usr/share]
99 89
#
......
151 141
BINMODE?=	555
152 142
NOBINMODE?=	444
153 143

  
154
KMODDIR?=	/boot/modules
155
KMODOWN?=	${BINOWN}
156
KMODGRP?=	${BINGRP}
157
KMODMODE?=	${BINMODE}
158

  
159 144
LIBDIR?=	/usr/lib
160 145
GCCLIBDIR?=	${LIBDIR}/${CCVER}
161 146
LIBCOMPATDIR?=	/usr/lib/compat
sys/conf/kern.paths.mk
1
# Set up the default install paths for kernel/modules
2
#
3
# DESTLABEL		add suffix to kernel and modules directory [not set]
4
# DESTKERNDIR		where kernel and modules are to be installed [/boot]
5
# DESTKERNNAME		name of installed kernel [${KERNEL}]
6
# DESTMODULESNAME	name of modules directory [modules]
7
#
8
.if defined(DESTLABEL)
9
DESTKERNNAME?=		${KERNEL}.${DESTLABEL}
10
DESTMODULESNAME?=	modules.${DESTLABEL}
11
.else
12
DESTKERNNAME?=		${KERNEL}
13
DESTMODULESNAME?=	modules
14
.endif
15
DESTKERNDIR?=		/boot
sys/conf/kern.post.mk
9 9

  
10 10
_MACHINE_FWD=	${.OBJDIR}
11 11
.include "$S/conf/kern.fwd.mk"
12
.include "$S/conf/kern.paths.mk"
12 13

  
13 14
depend kernel-depend modules-depend: ${FORWARD_HEADERS_COOKIE}
14 15

  
......
111 112
		echo "You must build a kernel first." ; \
112 113
		exit 1 ; \
113 114
	fi
114
.  if exists(${DESTDIR}/boot/${DESTKERNNAME})
115
.  if exists(${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME})
115 116
.ifndef NOFSCHG
116
	-chflags noschg ${DESTDIR}/boot/${DESTKERNNAME}
117
	-chflags noschg ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
117 118
.endif
118 119
.    ifdef NO_KERNEL_OLD_STRIP
119
	cp -p ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
120
	cp -p ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
120 121
.    else
121
	${OBJCOPY} --strip-debug ${DESTDIR}/boot/${DESTKERNNAME} ${DESTDIR}/boot/${DESTKERNNAME}.old
122
	${OBJCOPY} --strip-debug ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
122 123
.    endif
123 124
.  endif
125
	mkdir -p ${DESTDIR}${DESTKERNDIR}
124 126
.ifdef NOFSCHG
125 127
	${INSTALL} -m 555 -o root -g wheel \
126
		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
128
		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
127 129
.else
128 130
	${INSTALL} -m 555 -o root -g wheel -fschg \
129
		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
131
		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
130 132
.endif
131 133

  
132 134
kernel-reinstall: kernel-installable
135
	mkdir -p ${DESTDIR}${DESTKERNDIR}
133 136
.ifdef NOFSCHG
134 137
	${INSTALL} -m 555 -o root -g wheel \
135
		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
138
		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
136 139
.else
137 140
	${INSTALL} -m 555 -o root -g wheel -fschg \
138
		${SELECTEDKERNEL} ${DESTDIR}/boot/${DESTKERNNAME}
141
		${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
139 142
.endif
140 143

  
141
# Require DESTDIR to be manually specified when installing a
142
# virtual kernel.
143
#
144 144
kernel-installable:
145 145
.if ${P} == vkernel
146 146
.if !defined(DESTDIR)
147 147
	@echo "When installing a virtual kernel, DESTDIR must be manually specified"
148 148
	@exit 1
149 149
.endif
150
.endif
151 150
	@if [ -f ${DESTDIR}/${DESTKERNNAME} ]; then \
152 151
		echo "You need to make buildworld, installworld, and upgrade"; \
153 152
		echo "before you can install a new kernel, because the"; \
......
199 198
modules-install:
200 199
.if !defined(NO_MODULES_OLD)
201 200
.  ifdef NO_KERNEL_OLD_STRIP
202
	set -- ${DESTDIR}/boot/modules/*; \
201
	set -- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
203 202
	if [ -f "$$1" ]; then \
204
		mkdir -p ${DESTDIR}/boot/modules.old; \
203
		mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
205 204
		for file; do \
206
		cp -p $$file ${DESTDIR}/boot/modules.old; \
205
		cp -p $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
207 206
		done; \
208 207
	fi
209 208
.  else
210
	set -- ${DESTDIR}/boot/modules/*; \
209
	set -- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
211 210
	if [ -f "$$1" ]; then \
212
		mkdir -p ${DESTDIR}/boot/modules.old; \
211
		mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
213 212
		for file; do \
214
		${OBJCOPY} --strip-debug $$file ${DESTDIR}/boot/modules.old/$${file##*/}; \
213
		${OBJCOPY} --strip-debug $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old/$${file##*/}; \
215 214
		done; \
216 215
	fi
217 216
.  endif
218 217
.endif
219
	mkdir -p ${DESTDIR}/boot/modules # Ensure that the modules directory exists!
218
	mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
220 219
	cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
221 220

  
222 221
modules-reinstall:
223
	mkdir -p ${DESTDIR}/boot/modules # Ensure that the modules directory exists!
222
	mkdir -p ${DESTDIR}/${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
224 223
	cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
225 224

  
226 225
config.o:
sys/conf/kern.pre.mk
106 106
FULLKERNEL=	${KERNEL}.nodebug
107 107
SELECTEDKERNEL= ${KERNEL}.stripped
108 108
.endif
109
DESTKERNNAME?=	${KERNEL}
110 109

  
111 110

  
112 111
MKMODULESENV=	MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
sys/conf/kmod.mk
12 12
#
13 13
# KMOD          The name of the kernel module to build.
14 14
#
15
# KMODDIR	Base path for kernel modules (see kld(4)). [/modules]
15
# KMODDIR	Base path for kernel modules (see kld(4)).
16
#		[${DESTKERNDIR}/${DESTMODULESNAME}]
16 17
#
17 18
# KMODOWN	KLD owner. [${BINOWN}]
18 19
#
......
33 34
#
34 35
# KMODDEPS	List of modules which this one is dependant on
35 36
#
36
# DESTDIR	Change the tree where the module gets installed. [not set]
37
# DESTKERNDIR	Change the tree where the kernel and the modules get
38
#		installed. [/boot]  ${DESTDIR} changes the root of the tree
39
#		pointed to by ${DESTKERNDIR}.
37 40
#
38 41
# MFILES	Optionally a list of interfaces used by the module.
39 42
#		This file contains a default list of interfaces.
......
62 65
KMODLOAD?=	/sbin/kldload
63 66
KMODUNLOAD?=	/sbin/kldunload
64 67

  
68
KMODDIR?=	${DESTKERNDIR}/${DESTMODULESNAME}
69
KMODOWN?=	${BINOWN}
70
KMODGRP?=	${BINGRP}
71
KMODMODE?=	${BINMODE}
72

  
65 73
.include <bsd.init.mk>
66 74

  
67 75
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
68
-