1 |
commit: dd7015229da7ba9823e0d446231d6bd4c819c396 |
2 |
Author: Yixun Lan <dlan <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 2 09:34:07 2022 +0000 |
4 |
Commit: Yixun Lan <dlan <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jul 2 09:34:20 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/riscv.git/commit/?id=dd701522 |
7 |
|
8 |
sys-apps/kexec-tools: import original 2.0.24 from official tree |
9 |
|
10 |
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org> |
11 |
|
12 |
sys-apps/kexec-tools/Manifest | 1 + |
13 |
sys-apps/kexec-tools/files/90_kexec | 9 + |
14 |
sys-apps/kexec-tools/files/README.Gentoo | 33 ++++ |
15 |
sys-apps/kexec-tools/files/kexec-r2.init | 200 +++++++++++++++++++++ |
16 |
.../kexec-tools-2.0.4-disable-kexec-test.patch | 17 ++ |
17 |
.../files/kexec-tools-2.0.4-out-of-source.patch | 24 +++ |
18 |
sys-apps/kexec-tools/files/kexec.conf | 16 ++ |
19 |
sys-apps/kexec-tools/files/kexec.conf-2.0.4 | 34 ++++ |
20 |
sys-apps/kexec-tools/files/kexec.service | 16 ++ |
21 |
sys-apps/kexec-tools/kexec-tools-2.0.24.ebuild | 124 +++++++++++++ |
22 |
sys-apps/kexec-tools/metadata.xml | 13 ++ |
23 |
11 files changed, 487 insertions(+) |
24 |
|
25 |
diff --git a/sys-apps/kexec-tools/Manifest b/sys-apps/kexec-tools/Manifest |
26 |
new file mode 100644 |
27 |
index 0000000..d6b3aa3 |
28 |
--- /dev/null |
29 |
+++ b/sys-apps/kexec-tools/Manifest |
30 |
@@ -0,0 +1 @@ |
31 |
+DIST kexec-tools-2.0.24.tar.xz 303808 BLAKE2B 8188602f1b843c1dccc0307131f8c9ec0426c6cb3de898040352c1fed5f6d4bd7c58a0c2bf54290b91c8fe3401180df682959ee6c41693d07acc199c087c7db2 SHA512 ef7cf78246e2d729d81a3649791a5a23c385353cc75cbe8ef279616329fdaccc876d614c7f51e1456822a13a11520296070d9897467d24310399909e049c3822 |
32 |
|
33 |
diff --git a/sys-apps/kexec-tools/files/90_kexec b/sys-apps/kexec-tools/files/90_kexec |
34 |
new file mode 100644 |
35 |
index 0000000..40bad42 |
36 |
--- /dev/null |
37 |
+++ b/sys-apps/kexec-tools/files/90_kexec |
38 |
@@ -0,0 +1,9 @@ |
39 |
+#!/bin/sh |
40 |
+ |
41 |
+version="$1" ; shift |
42 |
+image="$1" ; shift |
43 |
+ |
44 |
+exec sed \ |
45 |
+ -e "s:\"vmlinuz-.*\":\"vmlinuz-${version}\":" \ |
46 |
+ -e "s:/boot/initramfs-.*\.img:/boot/initramfs-${version}\.img:" \ |
47 |
+ -i /etc/kexec.conf |
48 |
|
49 |
diff --git a/sys-apps/kexec-tools/files/README.Gentoo b/sys-apps/kexec-tools/files/README.Gentoo |
50 |
new file mode 100644 |
51 |
index 0000000..7735e32 |
52 |
--- /dev/null |
53 |
+++ b/sys-apps/kexec-tools/files/README.Gentoo |
54 |
@@ -0,0 +1,33 @@ |
55 |
+Usage |
56 |
+===== |
57 |
+ |
58 |
+Do |
59 |
+ $ man 8 kexec |
60 |
+for full understanding of the underlying kexec command. |
61 |
+Gentoo offers a wrapper to the bare kexec command through |
62 |
+/etc/init.d/kexec. |
63 |
+ |
64 |
+Configuration |
65 |
+------------- |
66 |
+ |
67 |
+Configuration is done in /etc/conf.d/kexec, which is self-documented. |
68 |
+ |
69 |
+Usage |
70 |
+----- |
71 |
+ |
72 |
+In Gentoo, kexec is invoked, i.e., the new kernel will be booted when |
73 |
+rebooting, by reboot (8) command or by pressing Ctrl+Alt+Del. |
74 |
+ |
75 |
+If you want to use kexec once, just run |
76 |
+ $ /etc/init.d/kexec start |
77 |
+ |
78 |
+It'll reserve kexec call at reboot. Later on, you can reboot anytime, |
79 |
+letting kexec starts another (or the same) kernel. When all is done in |
80 |
+the runlevel 6 - killing processes, unmounting volumes, etc - kexec |
81 |
+starts the new kernel instead of doing the normal hardware reboot. |
82 |
+ |
83 |
+If you want kexec to be run every time you reboot, add it to a runlevel: |
84 |
+ $ rc-update add kexec <runlevel> |
85 |
+ |
86 |
+If you want to reboot in the normal way this time, do: |
87 |
+ $ touch /nokexec |
88 |
|
89 |
diff --git a/sys-apps/kexec-tools/files/kexec-r2.init b/sys-apps/kexec-tools/files/kexec-r2.init |
90 |
new file mode 100644 |
91 |
index 0000000..0578f51 |
92 |
--- /dev/null |
93 |
+++ b/sys-apps/kexec-tools/files/kexec-r2.init |
94 |
@@ -0,0 +1,200 @@ |
95 |
+#!/sbin/openrc-run |
96 |
+# Copyright 1999-2020 Gentoo Authors |
97 |
+# Distributed under the terms of the GNU General Public License v2 |
98 |
+ |
99 |
+# Set up some defaults. |
100 |
+: "${LOAD_DURING_SHUTDOWN:=yes}" |
101 |
+: "${BOOTPART:=/boot}" |
102 |
+: "${DONT_MOUNT_BOOT:=no}" |
103 |
+ |
104 |
+depend() { |
105 |
+ need localmount |
106 |
+} |
107 |
+ |
108 |
+auto_prefix_bootpath() { |
109 |
+ # Only auto-add prefix to relative paths. |
110 |
+ case $1 in |
111 |
+ */*) echo "$1";; |
112 |
+ *) echo "${BOOTPART}/$1" ;; |
113 |
+ esac |
114 |
+} |
115 |
+ |
116 |
+get_genkernel_arch() { |
117 |
+ case $1 in |
118 |
+ x86_64) echo "amd64" ;; |
119 |
+ i[3456]86) echo "x86" ;; |
120 |
+ *) echo "$1" ;; |
121 |
+ esac |
122 |
+} |
123 |
+ |
124 |
+image_path() { |
125 |
+ # Do no sanity checking if the user has set a value. |
126 |
+ if [ -n "${KNAME}" ]; then |
127 |
+ auto_prefix_bootpath "${KNAME}" |
128 |
+ return |
129 |
+ fi |
130 |
+ |
131 |
+ local x kver="$(uname -r)" karch="$(uname -m)" |
132 |
+ local gkarch="$(get_genkernel_arch $karch)" |
133 |
+ for x in \ |
134 |
+ "bzImage" \ |
135 |
+ "vmlinux" \ |
136 |
+ "vmlinuz" \ |
137 |
+ "kernel" \ |
138 |
+ "bzImage-${kver}" \ |
139 |
+ "vmlinux-${kver}" \ |
140 |
+ "vmlinuz-${kver}" \ |
141 |
+ "kernel-genkernel-${karch}-${kver}" \ |
142 |
+ "kernel-genkernel-${gkarch}-${kver}" \ |
143 |
+ "kernel-${kver}" \ |
144 |
+ "kernel-${karch}"; do |
145 |
+ if [ -e "${BOOTPART}/${x}" ]; then |
146 |
+ echo "${BOOTPART}/${x}" |
147 |
+ return |
148 |
+ fi |
149 |
+ done |
150 |
+ |
151 |
+ return 1 |
152 |
+} |
153 |
+ |
154 |
+initrd_path() { |
155 |
+ # Do no sanity checking if the user has set a value. |
156 |
+ if [ -n "${INITRD}" ]; then |
157 |
+ auto_prefix_bootpath "${INITRD}" |
158 |
+ return 0 |
159 |
+ fi |
160 |
+ |
161 |
+ local x kver="$(uname -r)" karch="$(uname -m)" |
162 |
+ local gkarch="$(get_genkernel_arch $karch)" |
163 |
+ for x in \ |
164 |
+ "initrd" \ |
165 |
+ "initramfs" \ |
166 |
+ "initrd.img-${kver}" \ |
167 |
+ "initrd-${kver}.img" \ |
168 |
+ "initrd-${kver}" \ |
169 |
+ "initramfs-${kver}.img" \ |
170 |
+ "initramfs-genkernel-${karch}-${kver}" \ |
171 |
+ "initramfs-genkernel-${gkarch}-${kver}"; do |
172 |
+ if [ -e "${BOOTPART}/${x}" ]; then |
173 |
+ echo "${BOOTPART}/${x}" |
174 |
+ return 0 |
175 |
+ fi |
176 |
+ done |
177 |
+ |
178 |
+ return 1 |
179 |
+} |
180 |
+ |
181 |
+mount_boot() { |
182 |
+ [ "${DONT_MOUNT_BOOT}" != "no" ] && return 1 |
183 |
+ mountinfo -q "${BOOTPART}" && return 1 |
184 |
+ |
185 |
+ ebegin "Mounting ${BOOTPART}" |
186 |
+ mount "${BOOTPART}" |
187 |
+ eend $? |
188 |
+} |
189 |
+ |
190 |
+load_image() { |
191 |
+ if [ "${KNAME}" = "-" ]; then |
192 |
+ ebegin "Disabling kexec" |
193 |
+ kexec -u |
194 |
+ eend $? |
195 |
+ return # eend preserved $? for us. |
196 |
+ fi |
197 |
+ |
198 |
+ local img initrd="$(initrd_path)" mounted=false kparamopt initrdopt |
199 |
+ |
200 |
+ if ! img="$(image_path)"; then |
201 |
+ if mount_boot; then |
202 |
+ if img="$(image_path)"; then |
203 |
+ mounted=true |
204 |
+ initrd="$(initrd_path)" |
205 |
+ else |
206 |
+ eerror "No kernel image found in ${BOOTPART}!" |
207 |
+ umount "${BOOTPART}" |
208 |
+ return 1 |
209 |
+ fi |
210 |
+ else |
211 |
+ eerror "No kernel image found in ${BOOTPART}!" |
212 |
+ return 1 |
213 |
+ fi |
214 |
+ fi |
215 |
+ |
216 |
+ local is_rootpart_autodetected=no |
217 |
+ if [ -z "${ROOTPART}" ]; then |
218 |
+ ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")" |
219 |
+ is_rootpart_autodetected=yes |
220 |
+ fi |
221 |
+ |
222 |
+ local is_reusing_cmdline=no |
223 |
+ if [ -z "${KPARAM}" ]; then |
224 |
+ kparamopt="--reuse-cmdline" |
225 |
+ is_reusing_cmdline=yes |
226 |
+ fi |
227 |
+ |
228 |
+ if ! yesno "${is_rootpart_autodetected}" || ! yesno "${is_reusing_cmdline}"; then |
229 |
+ # Only append root when explicit set in config or |
230 |
+ # if we aren't re-using kernel cmdline |
231 |
+ KPARAM="${KPARAM:+"${KPARAM} "}root=${ROOTPART}" |
232 |
+ fi |
233 |
+ |
234 |
+ if [ -n "${initrd}" ]; then |
235 |
+ initrdopt="--initrd=${initrd}" |
236 |
+ fi |
237 |
+ |
238 |
+ local msg |
239 |
+ [ -n "${initrd}" ] && \ |
240 |
+ msg=" (with ${initrd})" |
241 |
+ ebegin "Using kernel image ${img}${msg} for kexec" |
242 |
+ |
243 |
+ kexec ${KEXEC_OPT_ARGS} ${kparamopt} \ |
244 |
+ -l "${img}" ${KPARAM:+--append="${KPARAM}"} ${initrdopt} |
245 |
+ local ret=$? |
246 |
+ |
247 |
+ ${mounted} && umount "${BOOTPART}" |
248 |
+ eend ${ret} |
249 |
+ return ${ret} |
250 |
+} |
251 |
+ |
252 |
+start() { |
253 |
+ if [ "${LOAD_DURING_SHUTDOWN}" = "yes" ]; then |
254 |
+ local mounted |
255 |
+ if mount_boot; then |
256 |
+ mounted=true |
257 |
+ fi |
258 |
+ if ! image_path >/dev/null; then |
259 |
+ ewarn "Cannot find kernel image!" |
260 |
+ ewarn "Please make sure a valid kernel image is present before reboot." |
261 |
+ return 0 |
262 |
+ fi |
263 |
+ if [ -n "${mounted}" ]; then |
264 |
+ ebegin "Unmounting ${BOOTPART}" |
265 |
+ umount "${BOOTPART}" |
266 |
+ eend $? |
267 |
+ fi |
268 |
+ # $? is already set to the previous calls. |
269 |
+ return |
270 |
+ else |
271 |
+ load_image |
272 |
+ fi |
273 |
+} |
274 |
+ |
275 |
+stop() { |
276 |
+ if ! yesno ${RC_REBOOT}; then |
277 |
+ ebegin "Not rebooting; disabling kexec" |
278 |
+ kexec -u |
279 |
+ eend $? |
280 |
+ return |
281 |
+ fi |
282 |
+ |
283 |
+ if [ -f /nokexec ]; then |
284 |
+ ebegin "Rebooting; disabling kexec due to /nokexec" |
285 |
+ rm -f /nokexec |
286 |
+ kexec -u |
287 |
+ eend $? |
288 |
+ return |
289 |
+ fi |
290 |
+ |
291 |
+ if [ "${LOAD_DURING_SHUTDOWN}" = "yes" ]; then |
292 |
+ load_image |
293 |
+ fi |
294 |
+} |
295 |
|
296 |
diff --git a/sys-apps/kexec-tools/files/kexec-tools-2.0.4-disable-kexec-test.patch b/sys-apps/kexec-tools/files/kexec-tools-2.0.4-disable-kexec-test.patch |
297 |
new file mode 100644 |
298 |
index 0000000..6fc73f2 |
299 |
--- /dev/null |
300 |
+++ b/sys-apps/kexec-tools/files/kexec-tools-2.0.4-disable-kexec-test.patch |
301 |
@@ -0,0 +1,17 @@ |
302 |
+diff --git kexec-tools-2.0.3/kexec_test/Makefile kexec-tools-2.0.3/kexec_test/Makefile |
303 |
+index fec6210..2ed4d51 100644 |
304 |
+--- kexec-tools-2.0.3/kexec_test/Makefile |
305 |
++++ kexec-tools-2.0.3/kexec_test/Makefile |
306 |
+@@ -8,12 +8,6 @@ dist += kexec_test/Makefile $(KEXEC_TEST_SRCS) \ |
307 |
+ kexec_test/x86-setup-legacy-pic.S |
308 |
+ |
309 |
+ BUILD_KEXEC_TEST = no |
310 |
+-ifeq ($(ARCH),i386) |
311 |
+-BUILD_KEXEC_TEST = yes |
312 |
+-endif |
313 |
+-ifeq ($(ARCH),x86_64) |
314 |
+-BUILD_KEXEC_TEST = yes |
315 |
+-endif |
316 |
+ |
317 |
+ ifeq ($(BUILD_KEXEC_TEST),yes) |
318 |
+ |
319 |
|
320 |
diff --git a/sys-apps/kexec-tools/files/kexec-tools-2.0.4-out-of-source.patch b/sys-apps/kexec-tools/files/kexec-tools-2.0.4-out-of-source.patch |
321 |
new file mode 100644 |
322 |
index 0000000..64c6cd8 |
323 |
--- /dev/null |
324 |
+++ b/sys-apps/kexec-tools/files/kexec-tools-2.0.4-out-of-source.patch |
325 |
@@ -0,0 +1,24 @@ |
326 |
+ Makefile.in | 3 ++- |
327 |
+ 1 file changed, 2 insertions(+), 1 deletion(-) |
328 |
+ |
329 |
+diff --git a/Makefile.in b/Makefile.in |
330 |
+index c1859d1..1aa8559 100644 |
331 |
+--- a/Makefile.in |
332 |
++++ b/Makefile.in |
333 |
+@@ -44,7 +44,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ |
334 |
+ |
335 |
+ # Base compiler flags. These are extended by the subcomponent-Makefiles |
336 |
+ # where necessary. |
337 |
+-CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \ |
338 |
++CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/include -I$(srcdir)/include -I$(srcdir)/util_lib/include \ |
339 |
+ -Iinclude/ $($(ARCH)_CPPFLAGS) |
340 |
+ CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes |
341 |
+ PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@ |
342 |
+@@ -77,6 +77,7 @@ pkgincludedir = $(includedir)/$(PACKAGE_NAME) |
343 |
+ DESTDIR = |
344 |
+ |
345 |
+ srcdir = @srcdir@ |
346 |
++top_builddir = @top_builddir@ |
347 |
+ VPATH = .:$(srcdir) |
348 |
+ |
349 |
+ # install paths |
350 |
|
351 |
diff --git a/sys-apps/kexec-tools/files/kexec.conf b/sys-apps/kexec-tools/files/kexec.conf |
352 |
new file mode 100644 |
353 |
index 0000000..aa829b9 |
354 |
--- /dev/null |
355 |
+++ b/sys-apps/kexec-tools/files/kexec.conf |
356 |
@@ -0,0 +1,16 @@ |
357 |
+# Kernel image pathname, relative from /boot. |
358 |
+KNAME="bzimage" |
359 |
+ |
360 |
+# Additional arguments passed to kexec (8) |
361 |
+# Following arguments are support: |
362 |
+# |
363 |
+# --reuse-cmdline |
364 |
+# Use the current boot command line |
365 |
+# |
366 |
+# --command-line=string |
367 |
+# Use a different command line |
368 |
+# |
369 |
+# --initrd=file |
370 |
+# Specify an initrd to use |
371 |
+# |
372 |
+KEXEC_OPT_ARGS="--reuse-cmdline" |
373 |
|
374 |
diff --git a/sys-apps/kexec-tools/files/kexec.conf-2.0.4 b/sys-apps/kexec-tools/files/kexec.conf-2.0.4 |
375 |
new file mode 100644 |
376 |
index 0000000..b71ea2b |
377 |
--- /dev/null |
378 |
+++ b/sys-apps/kexec-tools/files/kexec.conf-2.0.4 |
379 |
@@ -0,0 +1,34 @@ |
380 |
+# Load kexec kernel image into memory during shutdown instead of bootup |
381 |
+# (default: yes) |
382 |
+#LOAD_DURING_SHUTDOWN="yes" |
383 |
+ |
384 |
+# Additional arguments passed to kexec (8) |
385 |
+#KEXEC_OPT_ARGS="" |
386 |
+ |
387 |
+# Kernel image partition. Mounted automatically if not. |
388 |
+# (default: /boot) |
389 |
+#BOOTPART="/boot" |
390 |
+ |
391 |
+# Root partition (should be autodetected) |
392 |
+#ROOTPART="/dev/hda3" |
393 |
+ |
394 |
+# Kernel image pathname, relative from BOOTPART. |
395 |
+# If it's one of |
396 |
+# {kernel-genkernel,bzImage,vmlinuz,kernel}-<currently running kernel version>, |
397 |
+# or bzImage, vmlinuz (without suffix), |
398 |
+# then it's automaticaly detected. |
399 |
+# Setting it to "-" will disable kexec. |
400 |
+#KNAME="vmlinuz-3.9.0" |
401 |
+ |
402 |
+# Initrd |
403 |
+# Same automatic detection restriction as for KNAME apply. |
404 |
+# initramfs-genkernel-<currently running kernel version>, |
405 |
+# initrd{,.img}-<currently running kernel version>{,.img} |
406 |
+# will be detected. |
407 |
+#INITRD="/boot/fbsplash-emergence-1024x768" |
408 |
+ |
409 |
+# Kernel parameters (should be autodetected) |
410 |
+#KPARAM="splash=silent,theme:emergence" |
411 |
+ |
412 |
+# Do not try to mount /boot |
413 |
+# DONT_MOUNT_BOOT="yes" |
414 |
|
415 |
diff --git a/sys-apps/kexec-tools/files/kexec.service b/sys-apps/kexec-tools/files/kexec.service |
416 |
new file mode 100644 |
417 |
index 0000000..289aae0 |
418 |
--- /dev/null |
419 |
+++ b/sys-apps/kexec-tools/files/kexec.service |
420 |
@@ -0,0 +1,16 @@ |
421 |
+[Unit] |
422 |
+Description=Gracefully restart the box |
423 |
+Documentation=man:kexec(8) |
424 |
+After=boot.mount |
425 |
+Before=shutdown.target umount.target final.target |
426 |
+ConditionPathExists=!/nokexec |
427 |
+ |
428 |
+[Service] |
429 |
+Type=oneshot |
430 |
+RemainAfterExit=yes |
431 |
+EnvironmentFile=/etc/kexec.conf |
432 |
+ExecStart=/usr/sbin/kexec -l /boot/${KNAME} ${KEXEC_OPT_ARGS} |
433 |
+ExecStop=/usr/sbin/kexec -l /boot/${KNAME} ${KEXEC_OPT_ARGS} |
434 |
+ |
435 |
+[Install] |
436 |
+WantedBy=multi-user.target |
437 |
|
438 |
diff --git a/sys-apps/kexec-tools/kexec-tools-2.0.24.ebuild b/sys-apps/kexec-tools/kexec-tools-2.0.24.ebuild |
439 |
new file mode 100644 |
440 |
index 0000000..5723fa8 |
441 |
--- /dev/null |
442 |
+++ b/sys-apps/kexec-tools/kexec-tools-2.0.24.ebuild |
443 |
@@ -0,0 +1,124 @@ |
444 |
+# Copyright 1999-2022 Gentoo Authors |
445 |
+# Distributed under the terms of the GNU General Public License v2 |
446 |
+ |
447 |
+EAPI=8 |
448 |
+ |
449 |
+inherit libtool linux-info systemd |
450 |
+ |
451 |
+if [[ ${PV} == "9999" ]] ; then |
452 |
+ inherit git-r3 autotools |
453 |
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git" |
454 |
+else |
455 |
+ SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kexec/${P/_/-}.tar.xz" |
456 |
+ [[ "${PV}" == *_rc* ]] || \ |
457 |
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" |
458 |
+fi |
459 |
+ |
460 |
+DESCRIPTION="Load another kernel from the currently executing Linux kernel" |
461 |
+HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/" |
462 |
+ |
463 |
+LICENSE="GPL-2" |
464 |
+SLOT="0" |
465 |
+IUSE="booke lzma xen zlib" |
466 |
+ |
467 |
+REQUIRED_USE="lzma? ( zlib )" |
468 |
+ |
469 |
+DEPEND=" |
470 |
+ lzma? ( app-arch/xz-utils ) |
471 |
+ zlib? ( sys-libs/zlib )" |
472 |
+RDEPEND="${DEPEND}" |
473 |
+ |
474 |
+S="${WORKDIR}/${P/_/-}" |
475 |
+ |
476 |
+CONFIG_CHECK="~KEXEC" |
477 |
+ |
478 |
+PATCHES=( |
479 |
+ "${FILESDIR}"/${PN}-2.0.4-disable-kexec-test.patch |
480 |
+ "${FILESDIR}"/${PN}-2.0.4-out-of-source.patch |
481 |
+) |
482 |
+ |
483 |
+pkg_setup() { |
484 |
+ # GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC) |
485 |
+ export ASFLAGS="${CCASFLAGS}" |
486 |
+} |
487 |
+ |
488 |
+src_prepare() { |
489 |
+ default |
490 |
+ |
491 |
+ # Append PURGATORY_EXTRA_CFLAGS flags set by configure, instead of overriding them completely. |
492 |
+ sed -e "/^PURGATORY_EXTRA_CFLAGS =/s/=/+=/" -i Makefile.in || die |
493 |
+ |
494 |
+ if [[ "${PV}" == 9999 ]] ; then |
495 |
+ eautoreconf |
496 |
+ else |
497 |
+ elibtoolize |
498 |
+ fi |
499 |
+} |
500 |
+ |
501 |
+src_configure() { |
502 |
+ local myeconfargs=( |
503 |
+ $(use_with booke) |
504 |
+ $(use_with lzma) |
505 |
+ $(use_with xen) |
506 |
+ $(use_with zlib) |
507 |
+ ) |
508 |
+ econf "${myeconfargs[@]}" |
509 |
+} |
510 |
+ |
511 |
+src_compile() { |
512 |
+ # Respect CFLAGS for purgatory. |
513 |
+ # purgatory/Makefile uses PURGATORY_EXTRA_CFLAGS variable. |
514 |
+ # -mfunction-return=thunk and -mindirect-branch=thunk conflict with |
515 |
+ # -mcmodel=large which is added by build system. |
516 |
+ # Replace them with -mfunction-return=thunk-inline and -mindirect-branch=thunk-inline. |
517 |
+ local flag flags=() |
518 |
+ for flag in ${CFLAGS}; do |
519 |
+ [[ ${flag} == -mfunction-return=thunk ]] && flag="-mfunction-return=thunk-inline" |
520 |
+ [[ ${flag} == -mindirect-branch=thunk ]] && flag="-mindirect-branch=thunk-inline" |
521 |
+ flags+=("${flag}") |
522 |
+ done |
523 |
+ local -x PURGATORY_EXTRA_CFLAGS="${flags[*]}" |
524 |
+ |
525 |
+ default |
526 |
+} |
527 |
+ |
528 |
+src_install() { |
529 |
+ default |
530 |
+ |
531 |
+ dodoc "${FILESDIR}"/README.Gentoo |
532 |
+ |
533 |
+ newinitd "${FILESDIR}"/kexec-r2.init kexec |
534 |
+ newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec |
535 |
+ |
536 |
+ insinto /etc |
537 |
+ doins "${FILESDIR}"/kexec.conf |
538 |
+ |
539 |
+ insinto /etc/kernel/postinst.d |
540 |
+ doins "${FILESDIR}"/90_kexec |
541 |
+ |
542 |
+ systemd_dounit "${FILESDIR}"/kexec.service |
543 |
+} |
544 |
+ |
545 |
+pkg_postinst() { |
546 |
+ if systemd_is_booted || has_version sys-apps/systemd; then |
547 |
+ elog "For systemd support the new config file is" |
548 |
+ elog " /etc/kexec.conf" |
549 |
+ elog "Please adopt it to your needs as there is no autoconfig anymore" |
550 |
+ fi |
551 |
+ |
552 |
+ local n_root_args=$(grep -o -- '\<root=' /proc/cmdline 2>/dev/null | wc -l) |
553 |
+ local has_rootpart_set=no |
554 |
+ if [[ -f "${EROOT}/etc/conf.d/kexec" ]]; then |
555 |
+ if grep -q -E -- '^ROOTPART=' "${EROOT}/etc/conf.d/kexec" 2>/dev/null; then |
556 |
+ has_rootpart_set=yes |
557 |
+ fi |
558 |
+ fi |
559 |
+ |
560 |
+ if [[ ${n_root_args} -gt 1 && "${has_rootpart_set}" == "no" ]]; then |
561 |
+ ewarn "WARNING: Multiple root arguments (root=) on kernel command-line detected!" |
562 |
+ ewarn "This was probably caused by a previous version of ${PN}." |
563 |
+ ewarn "Please reboot system once *without* kexec to avoid boot problems" |
564 |
+ ewarn "in case running system and initramfs do not agree on detected" |
565 |
+ ewarn "root device name!" |
566 |
+ fi |
567 |
+} |
568 |
|
569 |
diff --git a/sys-apps/kexec-tools/metadata.xml b/sys-apps/kexec-tools/metadata.xml |
570 |
new file mode 100644 |
571 |
index 0000000..d56b5de |
572 |
--- /dev/null |
573 |
+++ b/sys-apps/kexec-tools/metadata.xml |
574 |
@@ -0,0 +1,13 @@ |
575 |
+<?xml version="1.0" encoding="UTF-8"?> |
576 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
577 |
+<pkgmetadata> |
578 |
+ <maintainer type="project"> |
579 |
+ <email>base-system@g.o</email> |
580 |
+ <name>Gentoo Base System</name> |
581 |
+ </maintainer> |
582 |
+ <use> |
583 |
+ <flag name="lzma">Enables support for LZMA compressed kernel images</flag> |
584 |
+ <flag name="booke">Include support for Book-E memory management</flag> |
585 |
+ <flag name="xen">Enable extended xen support</flag> |
586 |
+ </use> |
587 |
+</pkgmetadata> |